cytopia / devilbox

A modern Docker LAMP stack and MEAN stack for local development
http://devilbox.org
MIT License
4.4k stars 654 forks source link

[Howto]: Use mysqldump-secure in non default PHP containers when running more than one PHP version. #985

Open BWBama85 opened 1 year ago

BWBama85 commented 1 year ago

Have you already checked elsewhere?

What are you struggling with?

When using multiple PHP versions, mysqldump-secure does not work in the non default containers without editing /etc/mysqldump-secure.cnf

After manually editing mysqldump-secure.cnf, mysqldump-secure works but only backs up inside the container and does not back up to the host folder.

mysqldump-secure only works inside the default PHP container.

What have you tried already?

Editing mysqlsecure.cnf but still does not backup to host non container backup directory.

What is your goal?

To be able to use mysqldump-secure inside any php container and not just the default php container.

userwiths commented 1 year ago

Hey, just took a look on my local setup. It seems to be missing in the docs, but according to this piece of code, you can set the variables

MYSQL_BACKUP_USER=user_to_use_for_backup
MYSQL_BACKUP_PASS=your_password_for_that_user
MYSQL_BACKUP_HOST=mysql

in the .env file in the devilbox directory. After that restart the containers and try again. Locally it worked for me, hope it works for you too. Might look into opening a PR for the docs later, but not sure if I will remember.

ALSO for the issue of them not showing in the host's folder, but only in the container. It seems this is missing from the multi-php's docker-composer.override.yml. I added it to my other php containers, and can verify that now the backups are showing in the host's folder too. It should be a part of volumes: key. - ${HOST_PATH_BACKUPDIR:-./backups}:/shared/backups:rw${MOUNT_OPTIONS}

Image for reference. image