Skip to content

Commit 2788266

Browse files
authored
feat: Add multi-proxy support to docker-compose (#589)
* 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`.
1 parent bb1889b commit 2788266

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

docker-compose.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ services:
1919
# Possible values: amd64 or arm64
2020
# - ARCH=amd64
2121
- REDIS_URL=redis://redis:6379/0
22-
postgres:
22+
write-postgres:
23+
image: postgres:latest
24+
environment:
25+
- POSTGRES_USER=postgres
26+
- POSTGRES_PASSWORD=postgres
27+
healthcheck:
28+
test: ["CMD-SHELL", "pg_isready -U postgres"]
29+
interval: 5s
30+
timeout: 5s
31+
retries: 5
32+
read-postgres:
2333
image: postgres:latest
2434
environment:
2535
- POSTGRES_USER=postgres
@@ -42,7 +52,8 @@ services:
4252
environment:
4353
# For more information about the environment variables, see:
4454
# https://docs.gatewayd.io/using-gatewayd/configuration#environment-variables
45-
- GATEWAYD_CLIENTS_DEFAULT_ADDRESS=postgres:5432
55+
- GATEWAYD_CLIENTS_DEFAULT_WRITES_ADDRESS=write-postgres:5432
56+
- GATEWAYD_CLIENTS_DEFAULT_READS_ADDRESS=read-postgres:5432
4657
# - GATEWAYD_LOGGERS_DEFAULT_LEVEL=debug
4758
ports:
4859
# GatewayD server for PostgreSQL clients to connect to
@@ -60,15 +71,18 @@ services:
6071
volumes:
6172
- ./gatewayd-files:/gatewayd-files:ro
6273
links:
63-
- postgres
74+
- write-postgres
75+
- read-postgres
6476
- redis
6577
healthcheck:
6678
test: ["CMD", "curl", "-f", "http://gatewayd:18080/healthz"]
6779
interval: 5s
6880
timeout: 5s
6981
retries: 5
7082
depends_on:
71-
postgres:
83+
write-postgres:
84+
condition: service_healthy
85+
read-postgres:
7286
condition: service_healthy
7387
redis:
7488
condition: service_healthy

0 commit comments

Comments
 (0)