Backup for Docker installation
Configuration file, embedded SQLite database, log files are all saved into CTFreak config folder /data
.
CTFreak offers 2 methods for backing up/restoring his data.
Cold backup
The cold backup allows you, with a momentary service shutdown, to perform a complete backup of CTFreak.
Backup
Shut down the CTFreak service/container.
docker compose stop
Make a backup of the CTFreak config folder.
Make a backup of the PostgreSQL backend database (only if you have chosen this type of backend rather than the default embedded SQLite database).
Start the service/container.
docker compose up -d
Restoration
Stop CTFreak service/container.
Replace the CTFreak config folder with the backed up one.
Restore the backup of the PostgreSQL backend database (only if you have chosen this type of backend rather than the default embedded SQLite database).
Start CTFreak service/container.
Hot backup
Hot backup is a partial backup, which means that the log and data files of your executions and the configuration file are not taken into account (in fact, only the backend database is backed up).
However, it has the advantage of not requiring a service shutdown.
If you cannot find a time window where no task is being executed in CTFreak, then a hot backup can be a good compromise.
For embedded SQLite backend database
Backup
When a hot backup is launched (either on demand or via a cron schedule), a ctfreak.backup
file is created (or overwritten) in your backup folder.
To enable hot backup, log in to the UI as an administrator, go to Settings → Backup → Edit and complete the form.
Backup folder
Folder location for your backup files
Timestamp
By default, the backup file is named ctfreak.backup
and overwritten on each backup.
However, you can choose to suffix the file with the current date in RFC3339 format (backup file will then be named ctfreak-2006-01-02T15:04:05Z07:00.backup
), and define a maximum number of backups to keep.
Scheduling
Just like with tasks, hot backup can be scheduled using a cron expression that follows this format.
Restoration
From a fresh installation of CTFreak:
Stop CTFreak service/container.
In the CTFreak config folder:
- Delete all
db.sqlite*
files. - Copy the file
ctfreak.backup
and rename it todb.sqlite
.
Start CTFreak service/container.
For PostgreSQL backend database
…