I have two scripts I used before for backing up and restoring the database/volumes back when I moved my selfhosted instance from GCP to a home server. This was a few years ago though so I'm not sure if the scripts still apply today:
BACKUP:
#!/bin/bash
mkdir -p backup
docker compose exec mariadb sh -c 'exec mysqldump --all-databases --add-drop-database -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"' > ./backup/dump.sql
appwrite_volumes=(uploads cache config certificates functions)
for volume in ${appwrite_volumes[@]}; do
mkdir -p backup && docker run --rm --volumes-from "$(docker compose ps -q appwrite)" -v $PWD/backup:/backup ubuntu bash -c "cd /storage/$volume && tar cvf /backup/$volume.tar ."
done
docker run --rm --volumes-from "$(docker compose ps -q appwrite-worker-deletes)" -v $PWD/backup:/backup ubuntu bash -c "cd /storage/builds && tar cvf /backup/builds.tar ."
cp docker-compose.yml backup
cp .env backup
if [ -f docker-compose.override.yml ]; then
cp docker-compose.override.yml backup
fi
RESTORE:
#!/bin/bash
docker compose exec -T mariadb sh -c 'exec mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"' < ./backup/dump.sql
appwrite_volumes=(uploads cache config certificates functions)
for volume in ${appwrite_volumes[@]}; do
if [ ! -f "./backup/$volume.tar" ]; then
continue
fi
docker run --rm --volumes-from "$(docker compose ps -q appwrite)" -v $PWD/backup:/restore ubuntu bash -c "cd /storage/$volume && tar xvf /restore/$volume.tar --strip 1"
done
if [ ! -f "./backup/builds.tar" ]; then
exit 0
fi
docker run --rm --volumes-from "$(docker compose ps -q appwrite-worker-deletes)" -v $PWD/backup:/restore ubuntu bash -c "cd /storage/builds && tar xvf /restore/builds.tar --strip 1"
Is there a more official way of doing this? I was hoping through the console and it will just let me download the backup package.
read the docs, understand what's needed, understand what the script does, then apply it to whatever version you're on
Recommended threads
- Realtime for files() works almost well, ...
I have been trying to make use of realtime, today (14.03.26) I have pulled all the latest versions of docker images, and sdk available. Whats working: - Conn...
- Download appwrite Docs
Is there is a way to download appwrite Docs ? Because appwrite skill isn't enough to give the agent full understanding about how appwrite works (I noticed this ...
- How do you contact support to cancel a s...
My nephew signed up with my CC without my permission and has forgotten the password to the account. I can't for the life of me get a hold of anyone at appwrite....