Xylok Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Backups

As always, please contact us if you need assistance setting up backups or restoring data.

Default Backups

Xylok backs up the current database prior to any update. These backups are located in /opt/xylok/backups/ by default.

Manual Backups

Manual backups may be created by running /opt/xylok/backup-db.sh <backupfile>. Backups can be restored using /opt/xylok/restore-db.sh <backupfile>. The generated file is created using pgdump and can be restored with pgrestore if a more manual approach is needed.

Automated Periodic Backups

The periodic-backup.sh script can be used for simple automated local backups. For example, the following crontab entry will back up the Xylok database once a week at midnight:

0 * * * 1 /opt/xylok/periodic-backup.sh

This cron job must be run by a user with access to Docker–root or xylok are recommended choices, but any user in the “docker” group may be used. If using Podman, it should generally be run by xylok, the user who started the Xylok server.

This script uses the underlying backup-db.sh script and accounts for the pass-through directory.

Restoring Backups

This script can restore a Postgres database dump (created with backup-db.sh) over top of existing data.

Running this script will wipe out all existing data. Make sure to take a backup before restoring, just in case!
cd /opt/xylok/backups
/opt/xylok/restore-db.sh important_backup.dump

This script accounts for the pass-through directory by copying the supplied file to /opt/xylok/_passthrough, correcting permissions, then restoring the database using the internal pass-through directory.