Skip to content

Commit

Permalink
Merge branch 'rhenanbartels-fix/depends_on-postgres-service'
Browse files Browse the repository at this point in the history
* rhenanbartels-fix/depends_on-postgres-service:
  fixed ident yaml
  Waits for postgres service to be healthy
  • Loading branch information
avelino committed May 2, 2021
2 parents b720ecd + f66ee76 commit 28660e2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 55 deletions.
61 changes: 33 additions & 28 deletions docker-compose-prod.yml
@@ -1,30 +1,35 @@
version: "3"
services:
postgres:
image: postgres
volumes:
- "./data/postgres:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=prest
- POSTGRES_DB=prest
- POSTGRES_PASSWORD=prest
ports:
- "5432:5432"
prest:
# use latest build - analyze the risk of using this version in production
image: prest/prest
links:
- "postgres:postgres"
environment:
- PREST_DEBUG=false
- PREST_AUTH_ENABLED=true
- PREST_PG_HOST=postgres
- PREST_PG_USER=prest
- PREST_PG_PASS=prest
- PREST_PG_DATABASE=prest
- PREST_PG_PORT=5432
- PREST_SSL_MODE=disable
depends_on:
- postgres
ports:
- "3000:3000"
postgres:
image: postgres
volumes:
- "./data/postgres:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=prest
- POSTGRES_DB=prest
- POSTGRES_PASSWORD=prest
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U", "prest"]
interval: 30s
retries: 3
prest:
# use latest build - analyze the risk of using this version in production
image: prest/prest
links:
- "postgres:postgres"
environment:
- PREST_DEBUG=false
- PREST_AUTH_ENABLED=true
- PREST_PG_HOST=postgres
- PREST_PG_USER=prest
- PREST_PG_PASS=prest
- PREST_PG_DATABASE=prest
- PREST_PG_PORT=5432
- PREST_SSL_MODE=disable
depends_on:
postgres:
condition: service_healthy
ports:
- "3000:3000"
59 changes: 32 additions & 27 deletions docker-compose.yml
@@ -1,29 +1,34 @@
version: "3"
services:
postgres:
image: postgres
volumes:
- "./data/postgres:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=prest
- POSTGRES_DB=prest
- POSTGRES_PASSWORD=prest
ports:
- "5432:5432"
prest:
build: .
links:
- "postgres:postgres"
environment:
- PREST_DEBUG=true # remove comment for enable DEBUG mode (disable JWT)
- PREST_PG_HOST=postgres
- PREST_PG_USER=prest
- PREST_PG_PASS=prest
- PREST_PG_DATABASE=prest
- PREST_PG_PORT=5432
- PREST_JWT_DEFAULT=false # remove if need jwt
- PREST_SSL_MODE=disable
depends_on:
- postgres
ports:
- "3000:3000"
postgres:
image: postgres
volumes:
- "./data/postgres:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=prest
- POSTGRES_DB=prest
- POSTGRES_PASSWORD=prest
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U", "prest"]
interval: 30s
retries: 3
prest:
build: .
links:
- "postgres:postgres"
environment:
- PREST_DEBUG=true # remove comment for enable DEBUG mode (disable JWT)
- PREST_PG_HOST=postgres
- PREST_PG_USER=prest
- PREST_PG_PASS=prest
- PREST_PG_DATABASE=prest
- PREST_PG_PORT=5432
- PREST_JWT_DEFAULT=false # remove if need jwt
- PREST_SSL_MODE=disable
depends_on:
postgres:
condition: service_healthy
ports:
- "3000:3000"

0 comments on commit 28660e2

Please sign in to comment.