"Makes sense, thanks for the..." <- OK, so I got my backup/restore process working. Below is a summary of my process/scripts that I'd love for an expert to sanity check if they have time. For context, I'm deploying FarmOS to a Kubernetes cluster with a Helm chart. I'm doing the backup and restoring all from inside the FarmOS container. For restoring the site dir, I just `rm -rf /opt/drupal/web/sites/*` and then extract the backed-up version. Are there any issues with doing this while FarmOS is running? I'm only backing up `/opt/drupal/web/sites`. My modified version of symbioquine 's script that I mount to `/etc/cron.daily/farmos-backup`: ``` #!/bin/bash set -euxo pipefail PG_VERSION="16" # Install correct version of postgresql-client if pg_dump --version | grep -q "pg_dump (PostgreSQL) ${PG_VERSION}"; then echo "pg_dump version is correct" else echo "pg_dump version is incorrect. Installing correct version (${PG_VERSION})..." apt-get update && apt-get install -y lsb-release wget gnupg2 && apt-get clean all wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/postgres.list apt-get remove -y postgresql-client apt-get update && apt-get install -y "postgresql-client-${PG_VERSION}" && apt-get clean all fi rm -rf /tmp/staging-backup/* DATE_SUFFIX=$(date -u +"%Y-%m-%dT%H-%M-%S") echo "Creating a new backup: MyFarm-$DATE_SUFFIX" BACKUP_PATH=/tmp/staging-backup/MyFarm-$DATE_SUFFIX mkdir -p $BACKUP_PATH DB_BACKUP_FILENAME=$BACKUP_PATH/database.sql drush --root=/opt/drupal sql:dump --result-file=$DB_BACKUP_FILENAME DOCROOT_BACKUP_DIR=$BACKUP_PATH/docroot mkdir -p $DOCROOT_BACKUP_DIR cp -r /opt/drupal/web/sites* $DOCROOT_BACKUP_DIR/ cd /tmp/staging-backup BACKUP_ARCHIVE_NAME=MyFarm-$DATE_SUFFIX.sitearchive.tar.gz tar -czf $BACKUP_ARCHIVE_NAME MyFarm-$DATE_SUFFIX FINAL_BACKUP_ROOT="/backups" mkdir -p $FINAL_BACKUP_ROOT FINAL_BACKUP_PATH="${FINAL_BACKUP_ROOT}/${BACKUP_ARCHIVE_NAME}" mv $(pwd)/$BACKUP_ARCHIVE_NAME $FINAL_BACKUP_PATH echo "done" > $FINAL_BACKUP_PATH.done echo "Backup file copied to $FINAL_BACKUP_PATH" # Clean up after ourselves rm -rf /tmp/staging-backup/* ``` and my modified restore script that I mount to `/usr/local/bin/restore-farmOS-backup.sh`: ``` #!/bin/bash set -euxo pipefail backup_name="$(ls /backups/*.sitearchive.tar.gz | tail -n 1)" echo "Recreating from $backup_name" # Extract the database dump and site directory mkdir -p /db-init rm -rf /opt/drupal/web/sites/* tar --extract --file="$backup_name" --strip-components=1 --directory=/db-init --wildcards '*/database.sql' tar --extract --file="$backup_name" --strip-components=2 --directory=/opt/drupal/web --wildcards '*/docroot/*' # Fix the permissions chown -R www-data:www-data /opt/drupal/web/sites chmod -R 777 /opt/drupal/web/sites # Drop the existing database and import the backup drush sql-drop -y drush sql-cli < /db-init/database.sql ```