Skip to content
Snippets Groups Projects
Commit b3745a20 authored by wu-lee's avatar wu-lee Committed by root
Browse files

backups/mastodon_db_backup.sh - modify to work with docker-compose

And on runko.social.coop.  Used as a stopgap backup solution there.
parent a148228a
No related branches found
No related tags found
No related merge requests found
......@@ -2,8 +2,8 @@
# A script which backs up the mastodon database(s)
container=mastodon_db
backupdir=/var/vol2/postgres
container=db
backupdir=/opt/backups/postgres
# This performs a cyclic dump to files with the container and date in the name
# It also creates a link to a file containing the backup sequence number 0 or 1
......@@ -21,7 +21,7 @@ backup() {
rm -f $(readlink -f "$backupdir/$link")
# create new backup file
docker exec -it "$cname" pg_dumpall -U postgres -c -v | gzip >"$backupdir/$file"
docker-compose -f /opt/social.coop/sauce/docker/docker-compose.yml exec "$cname" pg_dumpall -U postgres -c -v | gzip >"$backupdir/$file"
status=$?
# link the sequence number to it
......@@ -30,7 +30,7 @@ backup() {
}
# Iterate over all matching container names
for cname in $(docker container ls -f name=$container --format '{{.Names}}')
do
backup $cname
done
#for cname in $(docker container ls -f name=$container --format '{{.Names}}')
#do
backup $container
#done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment