Created
September 23, 2020 02:01
-
-
Save gcavalcante8808/7a60997ed8ce13e937377df29eb0abfd to your computer and use it in GitHub Desktop.
Depends on based on healthchecks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.4' | |
volumes: | |
db-data: | |
services: | |
db: | |
image: postgres:11-alpine | |
environment: | |
POSTGRES_USER: nats | |
POSTGRES_PASSWORD: nats | |
POSTGRES_DB: nats | |
healthcheck: | |
test: ["CMD","pg_isready"] | |
start_period: 10s | |
interval: 10s | |
timeout: 5s | |
retries: 2 | |
volumes: | |
- db-data:/var/lib/postgresql/data | |
- ./nats/postgres.db.sql:/docker-entrypoint-initdb.d/postgres.db.sql | |
ports: | |
- 5432:5432 | |
nats: | |
image: nats-streaming:0.18-alpine | |
command: '-m 8222 --store sql --sql_driver postgres --sql_source "dbname=nats user=nats password=nats host=db port=5432 sslmode=disable readTimeout=5s writeTimeout=5s"' | |
ports: | |
- 8222:8222 | |
depends_on: | |
db: | |
condition: service_healthy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment