use volumes with postgres to prevent copying data
This commit is contained in:
parent
e6d9e96026
commit
f6dc4b4d8c
3 changed files with 4 additions and 3 deletions
|
|
@ -298,9 +298,8 @@ function postgres_vacuum_self {
|
|||
# reusable step to backup databases - postgres_backup [postgres-db-1] [user_and_db_name] [output_name] [$backup_working_directory]
|
||||
function postgres_backup {
|
||||
# for some reason, doing a dump *doesn't* require a password apparently. huh
|
||||
docker exec "$1" /bin/bash -c "pg_dump "$2" --username "$2" > /"$3".sql"
|
||||
docker cp "$1":/$3.sql $4/$3/$3.sql
|
||||
docker exec "$1" /bin/bash -c "rm "$3".sql"
|
||||
docker exec "$1" /bin/bash -c "pg_dump "$2" --username "$2" > /exp/"$3".sql"
|
||||
mv /srv/postgres/exp/$3.sql $4/$3/$3.sql # hardcoded value should be fine but maybe make this dynamic?
|
||||
}
|
||||
|
||||
# redis snapshot
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ services:
|
|||
shm_size: 4GB
|
||||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
- ./exp:/exp
|
||||
networks:
|
||||
- postgres_db
|
||||
env_file:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ services:
|
|||
shm_size: 6GB
|
||||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
- ./exp:/exp
|
||||
networks:
|
||||
- postgres_db
|
||||
env_file:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue