Skip to content

Commit

Permalink
chore: spin up another postgres instance in compose
Browse files Browse the repository at this point in the history
  • Loading branch information
bmstefanski committed Jan 17, 2025
1 parent 9cac6df commit be7b780
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
ports:
- 8080:8080
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/postgres?schema=public&connection_limit=5&pool_timeout=0&connect_timeout=300&sslmode=prefer"
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres-gateway:5432/postgres?schema=public&connection_limit=5&pool_timeout=0&connect_timeout=300&sslmode=prefer"
CONTEXT_PATH: "/"
PORT: "8080"
deploy:
Expand All @@ -57,7 +57,33 @@ services:
max_attempts: 3
window: 120s

postgres:
product-service:
networks:
- app-network
image: ghcr.io/cavaliercommerce/product-service:latest
ports:
- 8081:8081
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres-product:5433/postgres?schema=public&connection_limit=5&pool_timeout=0&connect_timeout=300&sslmode=prefer"
CONTEXT_PATH: "/"
PORT: "8081"
deploy:
replicas: 2
update_config:
parallelism: 2
order: start-first
failure_action: rollback
delay: 20s
rollback_config:
parallelism: 2
order: stop-first
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s

postgres-gateway:
networks:
- app-network
image: postgres
Expand All @@ -79,6 +105,28 @@ services:
constraints:
- node.role == manager

postgres-product:
networks:
- app-network
image: postgres
ports:
- 5433:5432
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- local_pgdata:/var/lib/postgresql/data
deploy:
replicas: 1
restart_policy:
condition: any
delay: 5s
max_attempts: 3
window: 120s
placement:
constraints:
- node.role == manager

rabbitmq:
image: rabbitmq:4-management
ports:
Expand Down

0 comments on commit be7b780

Please sign in to comment.