17 lines
805 B
Bash
17 lines
805 B
Bash
#!/bin/bash
|
|
|
|
FILE_NAME=dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql.br
|
|
# Wir exportieren die Datenbank und komprimieren sie.
|
|
docker exec -t online-energieausweis-database-1 pg_dumpall -c -U main | brotli --best > $FILE_NAME
|
|
|
|
# Das wird benötigt für AWS Ionos Kompatibilität.
|
|
export AWS_REQUEST_CHECKSUM_CALCULATION=when_required
|
|
export AWS_RESPONSE_CHECKSUM_VALIDATION=when_required
|
|
|
|
# IMPORTANT: Dieser Befehl benötigt das `ionos` Profil, sonst wird er nicht funktionieren.
|
|
# Das Profil kann mit `aws configure --profile ionos` erstellt werden.
|
|
# Den Key dafür findet man auf https://dcd.ionos.com/latest/?lang=en#/key-management
|
|
aws s3 cp $FILE_NAME s3://ibc-db-backup/ --profile ionos --endpoint-url https://s3-eu-central-1.ionoscloud.com --storage-class STANDARD
|
|
|
|
# Wir entfernen das Backup
|
|
rm $FILE_NAME |