Backing up a docker instance using the bash script

Checklist
I have read intro post: About the Installation Issues category
I have read the tutorials, help and searched for similar issues
I provide relevant information about my server (component names and versions, etc.)
I provide a copy of my logs and healthcheck
I describe the steps I have taken to trouble shoot the problem
I describe the steps on how to reproduce the issue

(I have not gone through the entire checklist because my question does not seem to relate to my specific installation at this point. I will update it if necessary.)

I tried to use bash script provided by Passbolt: Create A Backup of Passbolt Data With A Bash Script

I’m hosting Passbolt community myself using Docker. When running the script I get this message:

±-----------------------------------------------------------------------------------------+
| You don’t have the webserver_user set in the backup.sh file |
| Please correct this and then re-run this script |
±-----------------------------------------------------------------------------------------+

Why does this happen? The article suggest this script can be run outside the docker container. I also tried running the script inside the docker container, but get the message mysql-server is not installed.

Hey, @daankennes welcome to the forum!

For this you need to open the script with an editor and then on lines 3-4 there are instructions

#! /bin/bash

# Be sure to set this variable to what your webserver user is. Typically it will be www-data or nginx
# webserver_user=

So in the end you’d likely want this set to:

#! /bin/bash

# Be sure to set this variable to what your webserver user is. Typically it will be www-data or nginx
webserver_user=www-data
1 Like

Hi Clayton, thank you!

In the article, it seems to be implied that you should not have to edit that line when using Docker. Is that wrong?

I edited the backup script, but I now get this output:

±-----------------------------------------------------------------------------------------+
Docker not detected
±-----------------------------------------------------------------------------------------+
mkdir: cannot create directory ‘/opt/passbolt/tmp/backup-2024-09-09–16-58-12’: No such file or directory
Taking database backup and storing in /opt/passbolt/tmp/backup-2024-09-09–16-58-12
±-----------------------------------------------------------------------------------------+
bash: line 1: /usr/share/php/passbolt/bin/cake: No such file or directory
±-----------------------------------------------------------------------------------------+
Copying /etc/passbolt/passbolt.php to /opt/passbolt/tmp/backup-2024-09-09–16-58-12
±-----------------------------------------------------------------------------------------+
cp: cannot stat ‘/etc/passbolt/passbolt.php’: No such file or directory
Copying /etc/passbolt/gpg/serverkey_private.asc to /opt/passbolt/tmp/backup-2024-09-09–16-58-12
±-----------------------------------------------------------------------------------------+
cp: cannot stat ‘/etc/passbolt/gpg/serverkey_private.asc’: No such file or directory
Copying /etc/passbolt/gpg/serverkey.asc to /opt/passbolt/tmp/backup-2024-09-09–16-58-12
±-----------------------------------------------------------------------------------------+
cp: cannot stat ‘/etc/passbolt/gpg/serverkey.asc’: No such file or directory
Creating archive of /opt/passbolt/tmp/backup-2024-09-09–16-58-12
±-----------------------------------------------------------------------------------------+
tar: /opt/passbolt/tmp/backup-2024-09-09–16-58-12: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar (child): /opt/passbolt/tmp/backup-2024-09-09–16-58-12.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
±-----------------------------------------------------------------------------------------+
Cleaning up /opt/passbolt/tmp
±-----------------------------------------------------------------------------------------+
rm: cannot remove ‘/opt/passbolt/tmp/backup-2024-09-09–16-58-12/*’: No such file or directory
rmdir: failed to remove ‘/opt/passbolt/tmp/backup-2024-09-09–16-58-12’: No such file or directory
Backup completed you can find the file as /opt/passbolt/tmp/backup-2024-09-09–16-58-12.tar.gz

So a couple misunderstandings here, I didn’t initially realize you were trying to run this on the host machine where you have a docker container running. That isn’t supported with this script. It needs to be either on the server where passbolt is running via a package installation or in the docker container itself

As for running it in the container it is correct that you’ll get the error about not having mysql/mariadb installed since we don’t bundle that in the passbolt docker image by default. To run this script you’ll have to install it so you can access the mysqldump command which this relies on