-
-
Save Meldiron/47b5851663668102a676aff43c6341f7 to your computer and use it in GitHub Desktop.
# 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 |
@joeyouss hey, it's not the case. The script will restore the volumes that's why we see that message.
@luokelong so, the service is looking for a volume named as appwrite-builds
but the script creates it as appwrite_appwrite-builds
that's why it fails.
I had to remove the appwrite_
prefix from the script to make it work.
In fact, if you look at your current server, you'll see the volumes were created there with that prefix so I have no idea why it works in my old server, even though it has a prefix there, but does not work after the restoration (I am using the same docker-compose.yml from the production server)
Hey,
I just wanted to give you quick feedback that it worked 100% perfectly for me.
thanks great!
Make sure to stop Appwrite before this backup
^^ by this you mean stop all containers? or just appwrite container?
@barart I think it's only the appwrite containers
Does it work for https://appwrite.io/docs/advanced/self-hosting#manual, I use docker-compose.yml and .env. And I also have updated some configurations on .env
file.
Hi there ππ»
Please make sure that Appwrite did NOT run on this server previously. The error says it was found which implies Appwrite did run there.