fix wrong placement of MYSQLDUMP_OPTS variable

This commit is contained in:
Fco. Javier Delgado del Hoyo 2022-02-05 13:01:53 +01:00
parent 8992f162d7
commit f741822403
3 changed files with 4 additions and 3 deletions

View file

@ -29,7 +29,8 @@ COPY --from=binary /go/bin/dockerize /usr/local/bin
ENV CRON_TIME="0 3 * * sun" \ ENV CRON_TIME="0 3 * * sun" \
MYSQL_HOST="mysql" \ MYSQL_HOST="mysql" \
MYSQL_PORT="3306" \ MYSQL_PORT="3306" \
TIMEOUT="10s" TIMEOUT="10s" \
MYSQLDUMP_OPTS="--quick"
COPY ["run.sh", "backup.sh", "restore.sh", "/"] COPY ["run.sh", "backup.sh", "restore.sh", "/"]
RUN mkdir /backup && \ RUN mkdir /backup && \

View file

@ -21,7 +21,7 @@ docker container run -d \
- `MYSQL_PASS`: The password of your mysql database. - `MYSQL_PASS`: The password of your mysql database.
- `MYSQL_PASS_FILE`: The file in container where to find the password of your mysql database (cf. docker secrets). You should use either MYSQL_PASS_FILE or MYSQL_PASS (see examples below). - `MYSQL_PASS_FILE`: The file in container where to find the password of your mysql database (cf. docker secrets). You should use either MYSQL_PASS_FILE or MYSQL_PASS (see examples below).
- `MYSQL_DATABASE`: The database name to dump. Default: `--all-databases`. - `MYSQL_DATABASE`: The database name to dump. Default: `--all-databases`.
- `MYSQLDUMP_OPTS`: Command line arguments to pass to mysqldump. Example: `--single-transaction`. - `MYSQLDUMP_OPTS`: Command line arguments to pass to mysqldump (see [mysqldump documentation](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html)).
- `CRON_TIME`: The interval of cron job to run mysqldump. `0 3 * * sun` by default, which is every Sunday at 03:00. It uses UTC timezone. - `CRON_TIME`: The interval of cron job to run mysqldump. `0 3 * * sun` by default, which is every Sunday at 03:00. It uses UTC timezone.
- `MAX_BACKUPS`: The number of backups to keep. When reaching the limit, the old backup will be discarded. No limit by default. - `MAX_BACKUPS`: The number of backups to keep. When reaching the limit, the old backup will be discarded. No limit by default.
- `INIT_BACKUP`: If set, create a backup when the container starts. - `INIT_BACKUP`: If set, create a backup when the container starts.

View file

@ -21,7 +21,7 @@ do
echo "==> Dumping database: $db" echo "==> Dumping database: $db"
FILENAME=/backup/$DATE.$db.sql FILENAME=/backup/$DATE.$db.sql
LATEST=/backup/latest.$db.sql LATEST=/backup/latest.$db.sql
if mysqldump --single-transaction -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$db" "$MYSQLDUMP_OPTS" > "$FILENAME" if mysqldump --single-transaction "$MYSQLDUMP_OPTS" -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$db" > "$FILENAME"
then then
EXT= EXT=
if [ -z "${USE_PLAIN_SQL}" ] if [ -z "${USE_PLAIN_SQL}" ]