# Backup and Restore Procedures _Last updated: 2025-12-13_ This document outlines the procedures for backing up and restoring services and their data. ## Service Directory Backups The primary method for backing up a service's configuration and data is by using the `archiveme.sh` script. This script creates a compressed `tar.gz` archive of a service's directory from `/mnt/docker-storage/appdata` and moves it to `/volume1/docker/Archived configuration`. ### How to Back Up a Service 1. **Navigate to the `appdata` directory:** ```bash cd /mnt/docker-storage/appdata ``` 2. **Run the `archiveme.sh` script:** ```bash ./archiveme.sh ``` For example, to back up the `emby` service: ```bash ./archiveme.sh emby ``` 3. **Follow the prompts:** The script will compress the directory and then ask if you want to delete the source folder. It is recommended to keep the source folder unless you are decommissioning the service. ### How to Restore a Service 1. **Locate the backup file:** The backup files are located in `/volume1/docker/Archived configuration`. 2. **Extract the backup:** ```bash tar -xzf /volume1/docker/Archived\ configuration/.tar.gz -C /mnt/docker-storage/appdata/ ``` This will extract the service's directory into the `appdata` directory. 3. **Start the service:** ```bash cd /mnt/docker-storage/appdata/ docker-compose up -d ``` ## Database Backups ### MariaDB/MySQL The central MariaDB server on `192.168.1.251` should have its own backup strategy. However, you can also create a manual backup of a specific database using `mysqldump`. **Backup:** ```bash mysqldump -h 192.168.1.251 -u -p > .sql ``` **Restore:** ```bash mysql -h 192.168.1.251 -u -p < .sql ``` ### PostgreSQL (Docker Containers) For PostgreSQL databases running in Docker containers, you can use `pg_dump` to create a backup. **Backup:** ```bash docker-compose exec -T pg_dumpall -c -U > dump.sql ``` For example, to back up the `mealie` database: ```bash docker-compose -f /mnt/docker-storage/appdata/mealie/docker-compose.yaml exec -T mealie_postgres pg_dumpall -c -U mealie > mealie_dump.sql ``` **Restore:** ```bash cat mealie_dump.sql | docker-compose -f /mnt/docker-storage/appdata/mealie/docker-compose.yaml exec -T mealie_postgres psql -U mealie ``` ### SQLite SQLite databases are single files. The `archiveme.sh` script automatically backs up these files as part of the service directory backup. To restore a SQLite database, you just need to restore the service directory. ## Automated Backups The `archiveme.sh` script is a manual process. For automated backups, consider using a tool like [ArchiveForge](https://github.com/pirate/ArchiveForge), which is already running on this system. ArchiveForge can be configured to automatically back up service directories on a schedule. Refer to the ArchiveForge documentation for more details on its configuration.