-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix: Recognize container that uses multiple DBs #6
base: master
Are you sure you want to change the base?
Conversation
Improvement: Allow backup of all databases
@@ -16,7 +16,7 @@ RUN \ | |||
|
|||
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.
# Based on the mode, different default options will be set. | ||
# | ||
|
||
MODE=${MODE:-BACKUP} | ||
|
||
case "${MODE^^}" in | ||
'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
?
@@ -112,7 +131,7 @@ then | |||
echo "DONE" | |||
|
|||
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_DATABASE
is 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.