Backup docker-compose deployments and restore prod data into canary
This MR closes most of #676:
-
creates backup of the non-canary systems (configurable via CI variable in deployment step)
- SQL Dump and upload to storage box
- tar storage files and upload to storage box
-
restores latest backup into non-canary systems from their prod instance right before deploying
-
keeps any backup, both created before deployment as well as from cron jobs (need to clean up manually for now, amount of data is still tiny so this shouldn't be an issue)
-
Neues Pendant für
cap production postgres:replicate
:- Read-only Storage Box Login (SSH Public Key des Entwicklers muss dort hinterlegt werden)
- ssh-config muss wie im storage-box abschnitt konfiguriert werden
- restore-script braucht noch ein bisschen Finetuning für lokalen Betrieb (rechte in Non-Docker etc) → followup ticket
- Zum Ziehen des aktuellsten Alpha-Backups:
./docker/operations/backups.sh restore samarbeid-alpha
- Zum Ziehen des aktuellsten Claudia-Backups:
./docker/operations/backups.sh restore samarbeid.claudia-maicher.de
Storage box config
- Read-only user:
******
- Read-Write user:
******
# samarbeid@dawn:~$ cat .ssh/config
# Host samarbeid-storagebox
# User ******
# HostName ******.your-storagebox.de
# Port 23
# IdentityFile /home/samarbeid/.ssh/id_ed25519
###
Crontab
user samarbeid on dawn
12 0 * * * cd /home/samarbeid/apps/samarbeid.****** && output=$(./backups.sh create) && curl -fsS -m 10 --retry 5 -o /dev/null --data-raw "$output" https://hc-ping.com/******
17 0 * * * cd /home/samarbeid/apps/samarbeid-****** && output=$(./backups.sh create) && curl -fsS -m 10 --retry 5 -o /dev/null --data-raw "$output" https://hc-ping.com/******
Health Checks
Cron + 30m grace time, Pushover + Mail an Benjamin
Edited by Michael Prilop