Backups
Regular backups protect your data from hardware failures, accidental deletions, and other disasters. This guide covers what to backup and how to restore your Erugo installation.
Without backups, a disk failure or accidental deletion means permanent data loss. Set up automated backups and test restores regularly.
What to Backup
Erugo stores all persistent data in a single directory mounted as a Docker volume. This includes:
- Database — User accounts, shares, settings, and metadata
- Uploaded files — All files that have been shared
- Configuration — Application settings and customizations
- Custom assets — Logos, backgrounds, and custom themes
Storage Directory Structure
If you followed the Quick Start guide, your storage directory looks like this:
erugo-storage/
├── app/
│ ├── database/ # SQLite database
│ ├── uploads/ # Uploaded files
│ └── ...
├── framework/
│ └── cache/ # Application cache
└── logs/ # Application logs
The beauty of Erugo's architecture is that backing up the entire erugo-storage
directory captures everything you need to restore your installation.
Backup Methods
Method 1: Simple Archive
The simplest approach is to create a compressed archive of the storage directory:
# Stop Erugo to ensure data consistency
docker compose down
# Create backup archive
tar -czvf erugo-backup-$(date +%Y%m%d).tar.gz erugo-storage/
# Start Erugo again
docker compose up -d For data consistency, stop the containers before backing up. This prevents files from being modified during the backup process.
Method 2: Rsync
For incremental backups to a remote server, use rsync:
# Sync to remote server
rsync -avz --delete erugo-storage/ user@backup-server:/backups/erugo/
# Or sync to local backup drive
rsync -avz --delete erugo-storage/ /mnt/backup-drive/erugo/ Method 3: Automated with Cron
Set up automated daily backups with a cron job:
#!/bin/bash
BACKUP_DIR="/backups/erugo"
ERUGO_DIR="/home/erugo/erugo"
DATE=$(date +%Y%m%d_%H%M%S)
# Create backup directory if it doesn't exist
mkdir -p $BACKUP_DIR
# Stop Erugo
cd $ERUGO_DIR
docker compose down
# Create backup
tar -czvf $BACKUP_DIR/erugo-$DATE.tar.gz erugo-storage/
# Start Erugo
docker compose up -d
# Keep only last 7 backups
ls -t $BACKUP_DIR/erugo-*.tar.gz | tail -n +8 | xargs -r rm Add to crontab to run daily at 3 AM:
# Edit crontab
crontab -e
# Add this line for daily 3 AM backups
0 3 * * * /home/erugo/backup-erugo.sh >> /var/log/erugo-backup.log 2>&1 Method 4: Cloud Storage
For offsite backups, sync to cloud storage using tools like:
- rclone — Supports S3, Google Drive, Dropbox, and many more
- AWS CLI — For Amazon S3
- gsutil — For Google Cloud Storage
# Configure rclone first: rclone config
# Then sync to cloud storage
rclone sync erugo-storage/ remote:erugo-backups/ Restoring from Backup
To restore Erugo from a backup:
Step 1: Stop Erugo
cd /home/erugo/erugo
docker compose down Step 2: Remove or Rename Existing Data
# Rename existing data (just in case)
mv erugo-storage erugo-storage-old Step 3: Extract Backup
# Extract the backup
tar -xzvf /path/to/erugo-backup-20241207.tar.gz Step 4: Start Erugo
docker compose up -d Step 5: Verify
Log in to Erugo and verify:
- User accounts are intact
- Shares are accessible
- Settings are correct
- Uploaded files are present
Periodically test your backup and restore process to ensure it works when you need it. A backup you can't restore from is worthless.
Backup Best Practices
- Automate backups — Don't rely on remembering to backup manually
- Use the 3-2-1 rule — Keep 3 copies, on 2 different media, with 1 offsite
- Test restores regularly — Verify backups actually work
- Monitor backup jobs — Set up alerts for failed backups
- Encrypt sensitive backups — Especially for offsite/cloud storage
- Document your process — So anyone can restore in an emergency
Disaster Recovery
If you need to restore to a completely new server:
- Set up a new server with Docker (see Prerequisites)
- Create the Erugo directory and docker-compose.yml
- Restore the storage directory from backup
- Start Erugo with
docker compose up -d - Update DNS to point to the new server
- Reconfigure your reverse proxy if needed