Skip to content

Commit

Permalink
docker-compose: add healthcheck for postgres
Browse files Browse the repository at this point in the history
This makes "docker compose up --wait" return
when the database can be connected to through
the hostname.
  • Loading branch information
pjonsson committed Dec 2, 2023
1 parent d7fa351 commit 5eca904
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ services:

postgres:
image: postgis/postgis:13-3.1
hostname: postgres
environment:
- POSTGRES_DB=opendatacube
- POSTGRES_PASSWORD=opendatacubepassword
- POSTGRES_USER=opendatacube
ports:
- 5432:5432
restart: always
healthcheck:
test: ["CMD", "pg_isready", "-h", "postgres", "-q", "-d", "opendatacube", "-U", "opendatacube"]
timeout: 45s
interval: 10s
retries: 10

# Needed for testing HTTPS
# nginx-proxy:
Expand Down

0 comments on commit 5eca904

Please sign in to comment.