Hi, I recently setup self hosted appwrite on docker desktop and i really like it (Thanks for the hard work devs
). now the only thing that is concerning me is that i couldn't find any built in backup tool. Is there any easy or straightforward way to backup data? i might be needing to backup 2-3 times a day and be able to backup/restore specific project/database
#[SOLVED] How to backup/restore Self Hosted on windows?
7 messages · Page 1 of 1 (latest)
Does this help?
https://www.youtube.com/watch?v=lM5yZEPtlvg
Appwrite is a self-hosted backend-as-a-service platform that provides developers with all the core APIs required to build any application.
It's a good practice to backup your Appwrite server data regularly if you need to restore it later.
Backup/Restore scripts: https://gist.github.com/stnguyen90/fee636ff652b8ecbf761935b2aa254fb
Backup Notes...
Is there any Windows solution?
docker commands should be the same
i don't have a windows setup unfortunately, but you should be able to translate the backup script to powershell
wsl is also a thing - https://learn.microsoft.com/en-us/windows/wsl/install
I managed to do it with powershell. Thanks for the help 
Backup.ps1
docker compose stop traefik
mkdir 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'
foreach ( $volume in $appwrite_volumes )
{
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 ."
}
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 (Test-Path -Path docker-compose.override.yml) {
cp docker-compose.override.yml backup
}
docker compose start traefik```
# Restore.ps1
```#requires -PSEdition Desktop
Get-Content backup/dump.sql | docker compose exec -T mariadb sh -c 'exec mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"'
$appwrite_volumes = 'uploads','cache','config','certificates','functions'
foreach ( $volume in $appwrite_volumes )
{
if (Test-Path -Path backup/$volume.tar) {
continue
}
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"
}
if (Test-Path -Path backup/builds.tar) {
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"
}
else {
exit 0
}```
# Archive.ps1
```#requires -PSEdition Desktop
$ErrorActionPreference = "Stop"
$Time = Get-Date -Format "[yyyy-MM-dd]-[HH-mm-ss]"
tar -cvzf backup-$Time.tar.gz backup
rm backup -r```