Skip to content
SIHub Guides
Select language
Guides/Database backups and retention
SIHub · Guides

Automatic database backups

The normal Apache/systemd deploy installs and enables sihub-backup.timer. The daily run is scheduled for 03:30 in Europe/Vienna with a random delay of up to 15 minutes. A missed run will be made up for at the next timer start. Build-only and --no-start install the changes, but do not start a new backup run.

The backup uses the same lock as the normal deploy. This deploy therefore does not start any SIHub schema update during the dump. The lock is opened with root privileges; Python and mariadb-dump run under the service account sihub. The existing database credentials are read from the protected operator environment. They appear neither in process arguments nor in backup logs.

Scope and retention

The managed backups are stored exclusively under /var/lib/sihub/backups/managed:

Backup Directory Retention
One successful database backup per calendar day daily/sihub-JJJJ-MM-TT Two calendar months from the backup date
The first successful daily backup of a quarter quarterly/sihub-JJJJ-QN Seven calendar years from the backup date

When the month changes, a missing calendar day is capped at the last day of the target month, for example December 31 to February 28 or 29. A backup from February 29 reaches its seven-year deadline on February 28 of the target year. Expired backups are removed on the next successful run; if the backup service fails, they are kept until the error has been fixed.

A repeat run on the same day checks and reuses the existing daily backup. It does not overwrite it. Quarterly copies that have already been created also remain unchanged. The SQL dump, the Web Push key file if present, and a manifest with file sizes and SHA-256 checksums are published together. Directories are private (0700), files are private (0600). These file permissions do not encrypt the backup.

Deletion only begins once the daily and quarterly copies have been successfully created or verified. All of the system's own backups are checked for manifest, checksums, permissions and unexpected files before deletion. Errors stop the run with a visible error status. Symlinks, unrelated files and files without a matching manifest are not deleted as backups.

Existing backups and deploy rollback dumps outside the subdirectory managed are neither changed nor removed. Their previous retention is not changed retroactively by this new process. The automatic backup includes MariaDB and the Web Push identity belonging to the dump. It does not include media and knowledge files, browser profiles, the operator environment or other data encryption keys. These files must be available in the protected recovery inventory; an SQL dump alone is not a complete server backup. In particular, encrypted customer data remains unreadable without the original data key.

Backup retention does not replace deletion rules for the active database. After a restore, deletions and privilege revocations performed since the backup must be reconsidered before the restored service is released.

Monitoring and recovery

The usual deploy action enables the backup automatically. For operational checks, use systemctl list-timers sihub-backup.timer and journalctl -u sihub-backup.service; a successful deploy does not yet prove that a database dump subsequently ran successfully.

Each complete archive contains database.sql and, if set up, database.sql.web-push-keys.json. For restoring, the following apply: the MariaDB recovery steps and the separate backup of the original operator and data keys. A failed dump, full disk, or checksum mismatch must be resolved before the next successful backup run.