diff --git a/docker-compose.yaml b/docker-compose.yaml index 0f5340bf..ca0f818b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -19,11 +19,18 @@ services: # Possible values: amd64 or arm64 # - ARCH=amd64 - REDIS_URL=redis://redis:6379/0 + # Allow custom PostgreSQL connection string + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=postgres + - POSTGRES_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@write-postgres:5432/${POSTGRES_DB} + write-postgres: image: postgres:latest environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=postgres healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s @@ -34,11 +41,13 @@ services: environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=postgres # Ensure consistency healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 5s retries: 5 + redis: image: redis:latest healthcheck: @@ -46,6 +55,7 @@ services: interval: 5s timeout: 5s retries: 5 + gatewayd: image: gatewaydio/gatewayd:latest command: @@ -65,6 +75,8 @@ services: # https://docs.gatewayd.io/using-gatewayd/configuration#environment-variables - GATEWAYD_CLIENTS_DEFAULT_WRITES_ADDRESS=write-postgres:5432 - GATEWAYD_CLIENTS_DEFAULT_READS_ADDRESS=read-postgres:5432 + # Use the connection string set in install_plugins + - POSTGRES_URL=${POSTGRES_URL} # - GATEWAYD_LOGGERS_DEFAULT_LEVEL=debug ports: # GatewayD server for PostgreSQL clients to connect to diff --git a/gatewayd_plugins.yaml b/gatewayd_plugins.yaml index dce0b285..73a418bd 100644 --- a/gatewayd_plugins.yaml +++ b/gatewayd_plugins.yaml @@ -43,7 +43,7 @@ actionRedis: enabled: false # if enabled, the url and channel are used to connect to the Redis server. - address: localhost:6379 + address: ${REDIS_URL} # Use environment variable for Redis URL channel: gatewayd-actions # The policy is a list of policies to apply to the signals received from the plugins. @@ -72,7 +72,7 @@ plugins: env: - MAGIC_COOKIE_KEY=GATEWAYD_PLUGIN - MAGIC_COOKIE_VALUE=5712b87aa5d7e9f9e9ab643e6603181c5b796015cb1c09d6f5ada882bf2a1872 - - REDIS_URL=redis://localhost:6379/0 + - REDIS_URL=${REDIS_URL} # Use environment variable for Redis URL - EXPIRY=1h # - DEFAULT_DB_NAME=postgres - METRICS_ENABLED=True