Maintenance and Backups
When PathcoreFlow is deployed to an on-premise server or virtual machine (VM), there is the option to use the systemd service manager to schedule a daily maintenance script. This script performs several tasks, including managing backups.
The systemd timer unit is named pathcoreflow-maintenance.timer, and defaults to running the maintenance script daily at 04:00 am (server or VM time). Your server administrator can add another timer if you wish to run the maintenance tasks more or less frequently, though creating a systemd timer is beyond the scope of this document.
Backup Tasks
The maintenance script manages daily backups automatically, according to the configuration settings set in the .env file. For example, PCW_BACKUP_DIR defines where backups are stored. For more details about environment variables, see Configuration.
The following items are backed up:
PathcoreFlow database - this holds all of PathcoreFlow's hierarchical data, metadata, and user information. This does not include image data
Docker Compose configuration - the configuration files describing how to retrieve and run the container images for PathcoreFlow components. This includes any customizations you may have added
Image Indexing Service database - this is used by IIS for managing which items it has already detected and processed. This is only relevant if you have the Image Indexing Service add-on
Backup Rotation
One of the maintenance tasks is to clean up old backups, to free up disk space. This task removes backups older than PCW_BACKUP_DAYS days old. By default this will keep 30 days of backups.
Running a Manual Backup
Sometimes it is desirable to run a backup outside of its regular schedule, for example before installing an update.
To backup PathcoreFlow
Log in to the server or VM hosting PathcoreFlow
Run the maintenance script as root (administrator) to perform all backup steps:
sudo /opt/pathcore/compose/scripts/maintenance.sh
/opt/pathcore.Restoring from a Backup
At times, it may be necessary to restore your PathcoreFlow service to an earlier time.
To restore the PathcoreFlow database from a backup
Log in to the server or VM hosting PathcoreFlow
Change to the directory containing the PathcoreFlow Docker Compose configuration and stop the PathcoreFlow services. e.g., for the default install location of
/opt/pathcore/compose:cd /opt/pathcore/composesudo docker compose downMove the directory pointed to by
PCW_DB_DIR(to preserve it in case a problem occurs when restoring) and create a new, empty directory to replace it with the same owner and permissions.Start the
postgrescontainer on its own:cd /opt/pathcore/composesudo docker compose up -d postgresImport the data from the backup, replacing the path to the backup file as appropriate:
cd /opt/pathcore/composesudo gunzip -c /path/to/database-backup.sql.gz \| sudo docker compose exec -T postgres sh -c \'PGPASSWORD="${POSTGRES_PASSWORD}" psql -n -U "${POSTGRES_USER}" "${POSTGRES_DB}"'When complete, start the rest of the PathcoreFlow services:
cd /opt/pathcore/composesudo docker compose up -d
Certbot
If you have configured HTTPS via Let's Encrypt, then this task will ensure your certificate is renewed automatically before it expires.