new backup scripts
This commit is contained in:
parent
6485852ae0
commit
80d21a411b
16
backup-mattermost.sh
Normal file
16
backup-mattermost.sh
Normal 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
15
backup-postgres.sh
Normal 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
|
@ -59,8 +59,9 @@ services:
|
|||||||
labels:
|
labels:
|
||||||
backupbot.backup: "true"
|
backupbot.backup: "true"
|
||||||
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.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.sql"
|
backupbot.backup.post-hook: "rm -rf /var/lib/postgresql/data/postgres-backup"
|
||||||
backupbot.backup.path: "/var/lib/postgresql/data/"
|
backupbot.backup.path: "/var/lib/postgresql/data/"
|
||||||
|
backupbot.restore.post-hook: "/backup-postgres.sh post"
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
postgres_password:
|
postgres_password:
|
||||||
|
12
restore.sh
12
restore.sh
@ -1,12 +0,0 @@
|
|||||||
if [ "$1" == "pre" ]; then
|
|
||||||
mmctl
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" == "post" ]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
reset_config() {
|
|
||||||
cp /config-to-copy.json /mattermost/config/config.json && touch /mattermost/config/CoopCloudManaged
|
|
||||||
mmctl config reload --local
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user