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
  1. Log in to the server or VM hosting PathcoreFlow

  2. Run the maintenance script as root (administrator) to perform all backup steps:

    sudo /opt/pathcore/compose/scripts/maintenance.sh
This example assumes you have installed PathcoreFlow in the default directory: /opt/pathcore.

Restoring from a Backup

At times, it may be necessary to restore your PathcoreFlow service to an earlier time.

After you restore, any work done or changes made since the time of the backup will be lost.
To restore the PathcoreFlow database from a backup
If you encounter a problem while restoring, or don't feel confident performing these tasks on your own, please contact Pathcore Support for options.
  1. Log in to the server or VM hosting PathcoreFlow

  2. 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/compose
    sudo docker compose down
  3. Move 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.

  4. Start the postgres container on its own:

    cd /opt/pathcore/compose
    sudo docker compose up -d postgres
  5. Import the data from the backup, replacing the path to the backup file as appropriate:

    cd /opt/pathcore/compose
    sudo 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}"'
  6. When complete, start the rest of the PathcoreFlow services:

    cd /opt/pathcore/compose
    sudo 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.