Skip to content

Commit 10516d9

Browse files
committed
Add named pgdata volume that persists on down/up
This allows to restore after `docker-compose down` without reuploading database and rerunning migrations. Need to explicitly remove the volume to recreate DB from scratch `docker volume rm warehouse_pgdata`.
1 parent 21071ab commit 10516d9

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ endif
155155

156156
resetdb:
157157
docker-compose rm --stop --force db
158+
docker volume rm warehouse_pgdata
158159
docker-compose up -d db
159160

160161
initdb:

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: '3'
22

33
volumes:
44
packages:
5+
pgdata:
56
sponsorlogos:
67
vault:
78

@@ -32,6 +33,7 @@ services:
3233
POSTGRES_DB: warehouse
3334
POSTGRES_PASSWORD: password
3435
volumes:
36+
- pgdata:/var/lib/postgresql/data
3537
- ./dev/example.sql.xz:/docker-entrypoint-initdb.d/example.sql.xz:ro
3638

3739
redis:

0 commit comments

Comments
 (0)