Create and restore backups of your HumHub installation: database, modules, configuration, uploads and a custom theme.
zip extensionFor the database component (backup and restore):
exec() must be enabled (not listed in disable_functions)mysqldump or mariadb-dumpmysql or mariadbMany current systems only ship the MariaDB binaries (mariadb-dump, mariadb) without the mysql* aliases; both names are detected. The binaries are searched in PATH and in the usual installation directories. If they are missing, the settings page shows a warning. Files can still be backed up without them.
zlib (gzip) and the PHP bz2 extension (bzip2). The settings page only offers what is available. A backup made with bzip2 can only be restored on a server that has the bz2 extension.@runtime or outside of the web root (default: @runtime/backups). Directories that are linked into the web root (for example the uploads directory, which is a symlink in the official Docker image) count as part of the web root and are rejected..gitignore in a root owned directory) are no problem.All module directories configured in moduleAutoloadPaths are backed up, except the modules shipped with HumHub (@humhub/modules) and directories that contain no modules (a directory without any sub directory, for example one that only holds a .gitignore). By default that is @app/modules.
In the official Docker image (humhub/humhub) moduleAutoloadPaths contains @app/modules (/opt/humhub/protected/modules: owned by root, only a .gitignore), /data/modules-custom, /data/modules and @humhub/modules. @app/modules is skipped because it contains no modules, so the modules of /data/modules and /data/modules-custom are backed up. A backup can only be restored on an installation that has the same module directories configured.
Every backup is signed with an installation specific secret that is created automatically in @runtime/gm-backup/signing.key (permissions 0600). If @runtime is not persistent (for example in containers that are re-created), set a fixed key in protected/config/common.php, otherwise backups made before the re-creation can only be restored after an extra confirmation:
return [
'params' => [
'gmBackupSigningKey' => 'at-least-32-random-characters',
],
];
Keep the key secret and do not store it in the backup directory. Use a different key for each installation.
Install a MySQL/MariaDB client package in the container (for example mariadb-client) if it is not included in your image, and mount the backup directory on a volume if backups should survive container re-creation.
php yii gm-backup/backup/create # queue a backup with the current settings
php yii gm-backup/backup/auto # queue a backup if an automatic backup is due
All actions (settings, backup, download, delete, restore) require a system administrator. The ManageModules permission is not sufficient.
Disabling or uninstalling the module does not delete existing backups. They stay in the backup directory (default @runtime/backups) and contain personal data and credentials, so remove them manually when they are no longer needed.