Skip to content

Fix: Recognize container that uses multiple DBs#6

Open
chris922 wants to merge 3 commits into
confirm:masterfrom
chris922:develop
Open

Fix: Recognize container that uses multiple DBs#6
chris922 wants to merge 3 commits into
confirm:masterfrom
chris922:develop

Conversation

@chris922

Copy link
Copy Markdown

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.

Comment thread Dockerfile
RUN \
apt-get -y update && \
apt-get -y install mydumper && \
apt-get -y install mydumper git sudo && \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why git?

Copy link
Copy Markdown
Author

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.

Comment thread init.sh
'BACKUP')
OPTIONS=${OPTIONS:-}
;;
'COMPRESSED_BACKUP')

Copy link
Copy Markdown
Member

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?

Comment thread init.sh

echo "===> Starting backup..."
exec su -pc "mydumper ${CLI_OPTIONS}" ${USER}
sudo -u ${USER} mydumper ${CLI_OPTIONS}

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Author

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.

Comment thread init.sh
#
# Call after hooks
#
if [ -d "/hooks" ] && ls /hooks/*.after 1> /dev/null 2>&1; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWESOME IDEA! 👍

@chris922

Copy link
Copy Markdown
Author

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 git - of course it is in general not required)

@domibarton domibarton changed the base branch from develop to master May 16, 2019 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants