Data Backup/Restore and Maintenance

About how to backup/restore your data, as well as scheduled daily/weekly maintenance tasks.

Backup

Automatic backup

The automatic backup system is integrated into the CDM-Server. It does not function when the CDM server is down.

Every night at 2:00 AM, a daily compressed backup file in the .tar.gz format is created in the .backups folder. This file, in turn, contains a highly compressed file named db.tar.gz, which holds all the database files required for restoring a database. Additionally, the backup file in the uploads folder contains binary blob files that belong to the CDM server’s data model but are stored outside the database for performance reasons. The name of the backup file is generated according to the following pattern:

cdm_backup_<database-version>_<date>.tar.gz

The date follows the format %Y%m%d%H%M%S and is based on the host system’s time zone. Here is an example of a backup file name created on December 12, 2024, starting at 2:00 AM, with the database version 16:

cdm_backup_16_20241212020000.tar.gz

Backup files older than 30 days are automatically deleted. The backup files are created without significantly affecting the database operations.

Preserving backup files for longer than 30 days is your task. Please make sure you copy the backup files to a save place before they get deleted.

Manual Backup Execution

Backups can also be manually initiated if needed (e.g., before deploying a new CDM server version). To do so, simply run the shell script:

./backup

The CDM-Server needs to be active for the backup to work. The backup is created without significantly affecting database operations. A manual backup must not be started while an automatic backup is running. The backup file is generated using the same pattern as the automatically created backup files and is located in the same folder. It is also named according to the same format and is also automatically deleted after 30 days.

Restore

To do this, run the script

./restore

Then, the instructions of the script must be followed. The script instructions are only available in English. The script stops the CDM-Server. If the script runs successfully, start the CDM-Server again using

./start

Maintenance

We automatically run some maintenance tasks on the data and database every week on Sunday at 00:00 and 04:00 (Server time).

Examples runs of ./backup and ./restore

Execute manual backup

./backup
pg_basebackup: initiating base backup, waiting for checkpoint to complete   
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/E6000028 on timeline 1
pg_basebackup: starting background WAL receiver
pg_basebackup: created temporary replication slot "pg_basebackup_292042"
pg_basebackup: write-ahead log end point: 0/E6000100
pg_basebackup: waiting for background process to finish streaming ...
pg_basebackup: syncing data to disk ...
pg_basebackup: renaming backup_manifest.tmp to backup_manifest
pg_basebackup: base backup completed
Database and files backup completed.
Backup of database and files completed.

Execute restore

./restore
Page: 1 of 4

1. cdm_backup_16_20250221080438.tar.gz
2. cdm_backup_16_20250221075006.tar.gz
3. cdm_backup_16_20250221020000.tar.gz
4. cdm_backup_16_20250220020000.tar.gz
5. cdm_backup_16_20250219020000.tar.gz
6. cdm_backup_16_20250218020000.tar.gz  
7. cdm_backup_16_20250217020000.tar.gz
8. cdm_backup_16_20250216020000.tar.gz
9. cdm_backup_16_20250215020000.tar.gz
10. cdm_backup_16_20250214020000.tar.gz

Enter the number to select a backup, 'n' for next page, 'q' to quit.
Choose an option: 1
Selected backup: cdm_backup_16_20250221080438.tar.gz
Are you sure you want to restore this backup? (y/n): y
Validating the backup file...
Backup file validated successfully.
Stopping the app and database container...
Stopping the server with Docker Compose...
[+] Running 7/7
✔ Container main-proxy-1   Removed                                                                                                                                                          0.9s
✔ Container pfx-converter  Removed                                                                                                                                                          0.0s
✔ Container cdm-web-1     Removed                                                                                                                                                          0.2s
✔ Container cdm-app-1     Removed                                                                                                                                                          2.3s
✔ Container main-db-1      Removed                                                                                                                                                          0.4s
✔ Network main_default     Removed                                                                                                                                                          0.2s
✔ Network main_common-net  Removed                                                                                                                                                          0.3s
Server stopped successfully!
Server stopped successfully!
Restoring the backup...
Database and file restoration process completed.

./start
Last modified March 13, 2025: 542c9b9