Backup

The following commands should be valid for every setup if you did not changed default configuration.

Be careful

Backup are critical, make sure to test your backup and restore process before relying on it.

  1. Move to gancio path
    cd /opt/gancio/ # or where your installation is
    
  2. Backup PostgreSQL (only required for non-docker PostgreSQL installation)
    sudo -u postgres pg_dump -Fc gancio > gancio.dump
    
  3. Backup MariaDB (only required for non-docker MariaDB installation)
    sudo mariadb-dump -u root -p gancio > gancio.dump
    
  4. Archive database, configuration, custom user locales, logs, custom plugins, images and thumbnails
    sudo tar -czf gancio-$(date +%Y-%m-%d-%H%M%S)-backup.tgz  \
      $(ls -d config.json uploads user_locale gancio.sqlite db.sqlite gancio.dump postgres data db logs 2> /dev/null)
    

Automatic backup

To periodically backup your data you should probably use something like restic or borg

Restore

  1. Install a clean gancio
  2. Move to gancio path
    cd /opt/gancio/ # or where your installation is
    
  3. Extract your backup
    tar xvf gancio-*-backup.tgz
    
  4. Restore PostgreSQL database (only required for non-docker PostgreSQL installation)
    sudo -u postgres createdb gancio
    sudo -u postgres pg_restore -d gancio gancio.dump
    
  5. Restore MariaDB database (only required for non-docker MariaDB installation)
    sudo mariadb -u root -p -e "CREATE DATABASE gancio"
    sudo mariadb -u root -p gancio < gancio.dump