Backups_
Learn how to set up and manage backups for your self-hosted Appwrite instance to ensure data safety and disaster recovery.
3 min read
Appwrite Cloud offers automated Backups as a Service with scheduling and one-click restore.
For self-hosted instances, you'll need to implement manual backup procedures as outlined on this page.
Self-hosted Appwrite requires manual backup procedures to protect your data.
What to back up
Your Appwrite installation has several components that need backing up:
- Database - User data, documents, and configuration
- Storage volumes - Uploaded files and function code
- Environment variables - Configuration in
.env - System snapshots - Complete server state (alternative approach)
Database backups
Appwrite supports MariaDB and MongoDB as database backends. Use the backup method that matches your installation.
MariaDB backups
Use mysqldump for MariaDB installations:
# Create database backup (all databases)docker compose exec mariadb sh -c 'exec mysqldump --all-databases --add-drop-database --single-transaction --routines --triggers -uroot -p"$MYSQL_ROOT_PASSWORD"' > ./dump.sql
# Restore (fresh installation only)docker compose exec -T mariadb sh -c 'exec mysql -uroot -p"$MYSQL_ROOT_PASSWORD"' < dump.sqlFor large databases, consider mariabackup for physical backups.
MongoDB backups
Use mongodump for MongoDB installations:
# Create database backupdocker compose exec mongodb sh -c 'exec mongodump --username=root --password="$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase=admin --archive' > ./dump.archive
# Restore (fresh installation only)docker compose exec -T mongodb sh -c 'exec mongorestore --username=root --password="$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase=admin --archive' < dump.archiveOnly restore to fresh Appwrite installations to avoid data corruption.
Storage volume backups
Shut down Appwrite before backing up volumes to avoid data inconsistency.
Appwrite uses these Docker volumes:
appwrite-uploads- User filesappwrite-functions- Function codeappwrite-builds- Build artifactsappwrite-sites- Static sitesappwrite-certificates- SSL certificatesappwrite-config- Configurationappwrite-cacheandappwrite-redis- Cache dataappwrite-mariadb- Database files (MariaDB installations)appwrite-mongodb- Database files (MongoDB installations)
Backup methods
Docker volume backup:
# Backup volumedocker run --rm -v volume_name:/data -v $(pwd)/backup:/backup ubuntu tar czf "/backup/volume_name.tar.gz" -C /data .
# Restore volumedocker run --rm -v volume_name:/data -v $(pwd)/backup:/backup ubuntu tar xzf "/backup/volume_name.tar.gz" -C /dataDirect copy:
docker volume inspect volume_namesudo cp -a /var/lib/docker/volumes/volume_name/_data /backup/volume_name_backupFor S3/GCS/Azure storage, use your provider's native backup tools.
Environment variables
Back up your .env file containing configuration and secrets:
cp .env .env.backup.$(date +"%Y%m%d")The _APP_OPENSSL_KEY_V1 encrypts your data. Copy this exact value when restoring, or encrypted data becomes inaccessible.
Store .env backups securely due to sensitive data.
System snapshots
As an alternative to individual backups, snapshot your entire server:
- AWS EC2: Actions > Image > Create Image
- GCP/Azure/DigitalOcean: Use provider snapshot features
System snapshots capture complete server state and enable fast recovery, but use more storage than selective backups.
Best practices
Automation
Schedule backups with cron jobs or cloud automation:
# Daily database backup at 2 AM0 2 * * * /path/to/backup-script.shFollow 3-2-1 rule: 3 copies, 2 different media, 1 offsite.
Monitor backup jobs and set alerts for failures.
Third-party tools
For production environments:
- Restic - Cross-platform backup with encryption
- Borg - Deduplicating backup program
- Cloud provider tools - AWS/Azure/GCP backup services
- Third-party backup services - Automated backup solutions
Disaster recovery
Define your requirements:
- RPO (Recovery Point Objective) - Acceptable data loss window
- RTO (Recovery Time Objective) - Acceptable downtime window
Test restores quarterly to verify backup integrity.
Keep backups offsite and encrypted. Document recovery procedures and update contact information.
Security
- Encrypt backup files
- Restrict backup storage access
- Audit backup systems regularly
- Meet compliance requirements for your industry
Was this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.