Open BlackQube opened 2 months ago
I see the issue you are describing.
We can try to fix those.
Separately, your compose file looks like:
services:
mysql-backup:
image: databack/mysql-backup:master
container_name: mysql-dump-baremetal-test
restart: 'no'
environment:
- RUN_ONCE=true
- DEBUG=true
- RETENTION=2w
- DB_DUMP_FREQ=1440
- DB_DUMP_BEGIN=2345
- DB_DUMP_TARGET=/db
- DB_DUMP_SAFECHARS=true
- DB_SERVER=/var/run/mysqld/mysqld.sock
- DB_USER=${DB_USER}
- DB_PASS=${DB_PW}
- TZ=Europe/Berlin
volumes:
- ./data/dumps:/db
- /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock
user: "0"
command: dump -v 1
So it has both RUN_ONCE=true
and DB_DUMP_BEGIN=2345
. Isn't the error the correct behaviour here? Or are you raising both of these issues independently, that it should have errored out in this case rather than hang, and that it should handle the "I didn't set those at all" case as well?
I see why it didn't catch it. All of the other dump-time configuration flags are DB_DUMP_*
, and we use that with the library to catch it; they also all follow DB_DUMP_
with the exact same name as the CLI flag. RUN_ONCE
is the only one that:
RUN_ONCE
instead of ONCE
DB_DUMP_
The solution is simple, since we have not yet GAed 1.0.0; change the env var. Then it works correctly. PR coming shortly on that.
As for the second issue, I do not see it. If I do not set the env vars at all for DB_DUMP_BEGIN
, it does the right thing. Sure, there is a default, but it recognizes that the default was used, not explicitly set, so it allows once
to override it.
I had an issue with the following scenario:
I want to take dumps of my MariaDB 10.3 on the host from mysql-backup in docker. My docker compose file looks like this:
But, when I'm running the container, it just runs forever and doesn't produce any output. The only output I got was
mysql-dump-baremetal-test | time="2024-06-25T14:05:05Z" level=debug msg="starting dump"
From inside the Container:
When I try to start the dump from inside the container:
efe176c09c75:/# ./entrypoint dump -v 1 --server $DB_SERVER --user $DB_USER --pass $DB_PASS --once
I got the following Error:FATA[0000] if any flags in the group [once begin] are set none of the others can be; [begin once] were all set
The Problem was, that the "RUN_ONCE=true" only works, when you set the
explicitly to nothing:
since the default will set some values for them.
After that:
So the running docker compose config looks like this:
If you need any further/additional infos, please ask.