Skip to content

Database

Backup generation

On tethysdash2, full database backups are regularly generated under /home/tethysadmin/TethysDash/DB_backups/.

This is done by a cronjob for tethysadmin@tethysdash2:

0 2 * * * /home/tethysadmin/TethysDash/DB_backup_cronjob.sh >> /home/tethysadmin/TethysDash/DB_backups/cron.log 2>&1

Backup restoration

We have never needed to restore from backup, but there's also a script, DB_import_backup.sh, intended to facilitate things in case the need arises.1

WARNING

DB_import_backup.sh will perform a DESTRUCTIVE operation: The current 'tethysdash' database will be dropped and replaced with the given dump file contents.

In case of having to restore a DB backup, the steps would be:

cd ~/TethysDash/
source setenv.sh   # if not using .env

# Stop TethysDash container to avoid other clients interacting with the database:
docker compose stop tethysdash   

# Perform the import (indicate the appropriate dump file):
./DB_import_backup.sh DB_backups/tethysdash_YYYYMMDD_hhmmss.dump
# (... it will take several minutes ...)

# Restart TethysDash container:
docker compose up -d tethysdash


  1. Actually, the DB_import_backup.sh script has been useful when updating the database for other staging/testing TethysDash instances (e.g., at tethystest) to reflect the same contents as the production database.