Backup and restore
We recommend updating your database and uploaded files regularly. It is also highly recommended to do a database backup before you upgrade to a newer Corteza version.
| You can define a cron job that backups your data to some external storage. | 
Backup the database
We recommend the use of mysqldump tool.
It’s builtin to the db container (percona:8.0 image).
| If you want to use a different tool to create your backup, you will need to connect to the container or publish MySQL ports. | 
| By default,  | 
| Do not try to copy raw database files to perform a backup. It might lead to corrupted data. | 
# This will dump the entire database and place it in the dump.sql file.
docker-compose exec -T \
    --env MYSQL_PWD=your-password db \
    mysqldump your-db-name --add-drop-database -u your-username > dump.sql| You can backup your data without shutting down Corteza server. | 
Restore the database
# This will restore the database based on the dump.sql file
docker-compose exec -T \
    --env MYSQL_PWD=your-password db \
    mysql your-db-name -u your-username < dump.sql| We recommend that Corteza server is shut-down until the restore procedure finishes. | 
Backup uploaded files
Without object storage service like Min.io, uploaded files are stored directly on the filesystem.
Corteza server is storing data to the /data directory (if not configured differently with *_STORAGE_PATH environmental variables).
You can use any one of the standard file management tools to make a backup copy of the files.
# This will compress all your uploaded files into the backup.tar.bz2 archive
tar -cjf backup.tar.bz2 data/server/