Skip to content

Commit

Permalink
feat: Add multi-proxy support to docker-compose (gatewayd-io#589)
Browse files Browse the repository at this point in the history
* Renamed the `postgres` service to `write-postgres` and added configuration for the write database.
* Added a new `read-postgres` service to handle read database operations.
* Updated `gatewayd` environment variables to support separate read and write addresses.
* Updated `gatewayd` links and dependencies to include `write-postgres` and `read-postgres`.
  • Loading branch information
sinadarbouy authored Aug 6, 2024
1 parent bb1889b commit 2788266
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ services:
# Possible values: amd64 or arm64
# - ARCH=amd64
- REDIS_URL=redis://redis:6379/0
postgres:
write-postgres:
image: postgres:latest
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
read-postgres:
image: postgres:latest
environment:
- POSTGRES_USER=postgres
Expand All @@ -42,7 +52,8 @@ services:
environment:
# For more information about the environment variables, see:
# https://docs.gatewayd.io/using-gatewayd/configuration#environment-variables
- GATEWAYD_CLIENTS_DEFAULT_ADDRESS=postgres:5432
- GATEWAYD_CLIENTS_DEFAULT_WRITES_ADDRESS=write-postgres:5432
- GATEWAYD_CLIENTS_DEFAULT_READS_ADDRESS=read-postgres:5432
# - GATEWAYD_LOGGERS_DEFAULT_LEVEL=debug
ports:
# GatewayD server for PostgreSQL clients to connect to
Expand All @@ -60,15 +71,18 @@ services:
volumes:
- ./gatewayd-files:/gatewayd-files:ro
links:
- postgres
- write-postgres
- read-postgres
- redis
healthcheck:
test: ["CMD", "curl", "-f", "http://gatewayd:18080/healthz"]
interval: 5s
timeout: 5s
retries: 5
depends_on:
postgres:
write-postgres:
condition: service_healthy
read-postgres:
condition: service_healthy
redis:
condition: service_healthy
Expand Down

0 comments on commit 2788266

Please sign in to comment.