Skip to content

Instantly share code, notes, and snippets.

@Meldiron
Last active November 10, 2025 19:20
Show Gist options
  • Save Meldiron/47b5851663668102a676aff43c6341f7 to your computer and use it in GitHub Desktop.
Save Meldiron/47b5851663668102a676aff43c6341f7 to your computer and use it in GitHub Desktop.
Backup and Restore Appwrite, the lazy way 🐌
# Make sure to stop Appwrite before this backup,
# and make sure you have enough space on the machine.
# After backing up, make sure there is a file in 'backups/backup-___.tar.gz'.
# Also please check size of this file, it should be at least 5kb, even for small instances.
docker run --rm \
-v appwrite_appwrite-mariadb:/backup/appwrite-mariadb \
-v appwrite_appwrite-redis:/backup/appwrite-redis \
-v appwrite_appwrite-cache:/backup/appwrite-cache \
-v appwrite_appwrite-uploads:/backup/appwrite-uploads \
-v appwrite_appwrite-certificates:/backup/appwrite-certificates \
-v appwrite_appwrite-functions:/backup/appwrite-functions \
-v appwrite_appwrite-influxdb:/backup/appwrite-influxdb \
-v appwrite_appwrite-config:/backup/appwrite-config \
-v appwrite_appwrite-builds:/backup/appwrite-builds \
-v appwrite_appwrite-executor:/backup/appwrite-executor \
-v $(pwd)/.env:/backup/appwrite/.env \
-v $(pwd)/docker-compose.yml:/backup/appwrite/docker-compose.yml \
-v $(pwd)/backups:/archive \
--env BACKUP_FILENAME="backup-%Y-%m-%dT%H-%M-%S.tar.gz" \
--entrypoint backup \
offen/docker-volume-backup:latest
# Contributors:
# - Matej Bačo (Meldiron): https://github.com/meldiron
# - AidsMcGhee: https://github.com/JakeAi
# Make sure the Appwrite did NOT run on this server previously,
# and make sure to stop it before this restore.
# If appwrite ran here already, make sure to
# stop Appwrite with 'docker-compose down -v', and ideally
# also remove appwrite folder.
# Before running, be in any directory,
# but make sure 'backup.tar.gz' file with your backup is in there.
# Whichever directory you are in, this script will create 'appwrite'
# folder in here, with a configuration from backup.
# Backup script puts date in the file name, make sure to
# rename file to exactly 'backup.tar.gz'.
# After restore, you can enter appwite folder 'cd appwrite'
# and start Appwrite with 'docker-compose up -d'.
# Untar backup
tar -C /tmp -xvf backup.tar.gz
# Restore volumes and configuration
docker run -d --name temp_restore_container \
-v appwrite_appwrite-mariadb:/backup_restore/appwrite-mariadb \
-v appwrite_appwrite-redis:/backup_restore/appwrite-redis \
-v appwrite_appwrite-cache:/backup_restore/appwrite-cache \
-v appwrite_appwrite-uploads:/backup_restore/appwrite-uploads \
-v appwrite_appwrite-certificates:/backup_restore/appwrite-certificates \
-v appwrite_appwrite-functions:/backup_restore/appwrite-functions \
-v appwrite_appwrite-influxdb:/backup_restore/appwrite-influxdb \
-v appwrite_appwrite-config:/backup_restore/appwrite-config \
-v appwrite_appwrite-builds:/backup_restore/appwrite-builds \
-v appwrite_appwrite-executor:/backup_restore/appwrite-executor \
-v $(pwd)/appwrite:/backup_restore/appwrite \
alpine tail -f /dev/null
docker cp /tmp/backup/. temp_restore_container:/backup_restore
docker stop temp_restore_container
docker rm temp_restore_container
# Remove temporary files
rm -rf /tmp/backup
@a-l-e-c
Copy link

a-l-e-c commented Nov 10, 2025

Can confirm that restore procedure worked after updating the following lines in my docker-compose.yml:

traefik-volumes:

      - appwrite_appwrite-config:/storage/config:ro
      - appwrite_appwrite-certificates:/storage/certificates:ro

appwrite-volumes:

      - appwrite_appwrite-uploads:/storage/uploads:rw
      - appwrite_appwrite-cache:/storage/cache:rw
      - appwrite_appwrite-config:/storage/config:rw
      - appwrite_appwrite-certificates:/storage/certificates:rw
      - appwrite_appwrite-functions:/storage/functions:rw

appwrite-worker-deletes-volumes:

      - appwrite_appwrite-uploads:/storage/uploads:rw
      - appwrite_appwrite-cache:/storage/cache:rw
      - appwrite_appwrite-functions:/storage/functions:rw
      - appwrite_appwrite-builds:/storage/builds:rw
      - appwrite_appwrite-certificates:/storage/certificates:rw

appwrite-worker-builds-volumes:

      - appwrite_appwrite-functions:/storage/functions:rw
      - appwrite_appwrite-builds:/storage/builds:rw

appwrite-worker-certificates-volumes:

      - appwrite_appwrite-config:/storage/config:rw
      - appwrite_appwrite-certificates:/storage/certificates:rw

appwrite-worker-messaging-volumes:

      - appwrite_appwrite-uploads:/storage/uploads:rw

openruntimes-executor-volumes:

      - appwrite_appwrite-builds:/storage/builds:rw
      - appwrite_appwrite-functions:/storage/functions:rw

mariadb-volumes:

      - appwrite_appwrite-mariadb:/var/lib/mysql:rw

redis-volumes:

      - appwrite_appwrite-redis:/data:rw

Finally, at the very end of the docker-compose file I just added exteral-true to all:

volumes:
  appwrite_appwrite-mariadb:
    external: true
  appwrite_appwrite-redis:
    external: true
  appwrite_appwrite-cache:
    external: true
  appwrite_appwrite-uploads:
    external: true
  appwrite_appwrite-certificates:
    external: true
  appwrite_appwrite-functions:
    external: true
  appwrite_appwrite-builds:
    external: true
  appwrite_appwrite-config:
    external: true

What I haven't done yet is upgrade my version (1.6.x) to check if I can rename those volumes again. But the restore worked and was able to recover my data. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment