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
- Which flutter SDK version for Self Hoste...
Hi all, Is there a good way to figure out which version of flutter SDK and Dart SDK is current for latest available self-hosted 1.8.0 ? I know new features are...
- Bug Report: Crash when trying to createR...
https://github.com/appwrite/sdk-for-android/issues/96 I think the bug is related with this one https://discord.com/channels/564160730845151244/1443887021314539...
- Dokploy docker compose
Hey guys hope y'all doing well, I was wondering if anyone could share a working 1.8.0 docker-compose that works with Dokploy I tried making it but it just does...