-
Notifications
You must be signed in to change notification settings - Fork 24
Fix: Recognize container that uses multiple DBs #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Improvement: Allow backup of all databases
| RUN \ | ||
| apt-get -y update && \ | ||
| apt-get -y install mydumper && \ | ||
| apt-get -y install mydumper git sudo && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why git?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduced the hooks to be able to create a simple script that commits the changes after every backup automatically. So it was required to have git available inside the docker.
| 'BACKUP') | ||
| OPTIONS=${OPTIONS:-} | ||
| ;; | ||
| 'COMPRESSED_BACKUP') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just overwriting OPTIONS?
|
|
||
| echo "===> Starting backup..." | ||
| exec su -pc "mydumper ${CLI_OPTIONS}" ${USER} | ||
| sudo -u ${USER} mydumper ${CLI_OPTIONS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the container properly "stoppable" (i.e. docker stop container vs docker kill container) with just sudo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I haven't tested this yet. Changing from exec to sudo was required to be able to call the hooks afterwards, because exec will not continue with the execution of this script.
| # | ||
| # Call after hooks | ||
| # | ||
| if [ -d "/hooks" ] && ls /hooks/*.after 1> /dev/null 2>&1; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWESOME IDEA! 👍
|
Oh I just wanted to create a pull request for the first commit b62f0f4. The other two commits just contained stuff I needed for my internal purpose and it wasn't planned to include them in this pull request (e. g. that's why I just added |
The docker container doesn't work with my linked in mariadb container. It has issues, because the env. variable
*_ENV_MYSQL_DATABASEis not available.I changed the behaviour so that this variable isn't required anymore. If it is not available mydumper will create a backup for all databases.