Compare commits

...

3 Commits

Author SHA1 Message Date
80d21a411b new backup scripts 2025-04-09 15:13:16 -04:00
6485852ae0 fix typo 2025-03-26 18:11:20 -04:00
5f6b845212 initial 2025-03-26 18:09:15 -04:00
3 changed files with 36 additions and 2 deletions

16
backup-mattermost.sh Normal file
View File

@ -0,0 +1,16 @@
if [ "$1" == "pre-backup" ]; then
exit
fi
if [ "$1" == "pre-backup" ]; then
exit
fi
if [ "$1" == "pre-restore" ]; then
# kill the running plugins that need to be overwritten
pkill plugins
fi
if [ "$1" == "post-restore" ]; then
mmctl config reload --local
fi

15
backup-postgres.sh Normal file
View File

@ -0,0 +1,15 @@
if [ "$1" == "pre-backup" ]; then
exit
fi
if [ "$1" == "post-backup" ]; then
exit
fi
if [ "$1" == "pre-restore" ]; then
exit
fi
if [ "$1" == "post-restore" ]; then
pg_restore -U $POSTGRES_USER -d $POSTGRES_DB -c /var/lib/postgresql/data/postgres-backup
fi

View File

@ -32,6 +32,8 @@ services:
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
- "backupbot.backup=true"
- "backupbot.backup.path=/mattermost,/etc/ssl"
- "backupbot.restore.pre-hook=/restore.sh pre"
- "backupbot.restore.post-hook=/restore.sh post"
configs:
- source: abra_mattermost_entrypoint
target: /abra-mattermost-entrypoint.sh
@ -56,9 +58,10 @@ services:
deploy:
labels:
backupbot.backup: "true"
backupbot.backup.pre-hook: "PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /var/lib/postgresql/data/postgres-backup.sql"
backupbot.backup.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup.sql"
backupbot.backup.pre-hook: "PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} --format=directory -f /var/lib/postgresql/data/postgres-backup"
backupbot.backup.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup"
backupbot.backup.path: "/var/lib/postgresql/data/"
backupbot.restore.post-hook: "/backup-postgres.sh post"
secrets:
postgres_password: