Skip to content

Commit

Permalink
docs: update container names for db backup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jan 30, 2024
1 parent 814db0d commit 63e697f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/dev/Database-Tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Access a PostgreSQL shell inside the fmtm-db container:
```bash
GIT_BRANCH=development

docker exec -it fmtm-db-${GIT_BRANCH} psql -U fmtm fmtm
docker exec -it fmtm-${GIT_BRANCH}-fmtm-db-1 psql -U fmtm fmtm
```

And then connect to the database using this command:
Expand Down
12 changes: 6 additions & 6 deletions docs/dev/Production.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ backup_filename="fmtm-db-${GIT_BRANCH}-$(date +'%Y-%m-%d').sql.gz"
echo $backup_filename

docker exec -i -e PGPASSWORD=PASSWORD_HERE \
fmtm-db-${GIT_BRANCH} \
fmtm-${GIT_BRANCH}-fmtm-db-1 \
pg_dump --verbose --format c -U fmtm fmtm \
| gzip -9 > "$backup_filename"

# For ODK
docker exec -i -e PGPASSWORD=PASSWORD_HERE \
fmtm-central-db-${GIT_BRANCH} \
fmtm-${GIT_BRANCH}-central-db-1 \
pg_dump --verbose --format c -U odk odk | \
gzip -9 > "$backup_filename"
```
Expand All @@ -130,13 +130,13 @@ backup_filename=fmtm-db-${GIT_BRANCH}-XXXX-XX-XX-sql.gz

cat "$backup_filename" | gunzip | \
docker exec -i -e PGPASSWORD=NEW_PASSWORD_HERE \
fmtm-db-${GIT_BRANCH} \
fmtm-${GIT_BRANCH}-fmtm-db-1 \
pg_restore --verbose -U fmtm -d fmtm

# For ODK
cat "$backup_filename" | gunzip | \
docker exec -i -e PGPASSWORD=NEW_PASSWORD_HERE \
fmtm-central-db-${GIT_BRANCH} \
fmtm-${GIT_BRANCH}-central-db-1 \
pg_restore --verbose -U odk -d odk
```

Expand All @@ -162,15 +162,15 @@ backup_filename=fmtm-central-db-${GIT_BRANCH}-XXXX-XX-XX-sql.gz

cat "$backup_filename" | gunzip | \
docker exec -i \
fmtm-central-db-${GIT_BRANCH} \
fmtm-${GIT_BRANCH}-central-db-1 \
pg_restore --verbose -U odk -d odk

# Restore fmtm from the backup
backup_filename=fmtm-db-${GIT_BRANCH}-XXXX-XX-XX-sql.gz

cat "$backup_filename" | gunzip | \
docker exec -i \
fmtm-db-${GIT_BRANCH} \
fmtm-${GIT_BRANCH}-fmtm-db-1 \
pg_restore --verbose -U fmtm -d fmtm

# Run the entire docker compose stack
Expand Down

0 comments on commit 63e697f

Please sign in to comment.