Compare commits

...

1 Commits

Author SHA1 Message Date
Pepe Fagoaga
9b0487eb9a chore(postgres): use pgbouncer 2025-06-09 13:08:57 +02:00
2 changed files with 22 additions and 3 deletions

2
.env
View File

@@ -16,7 +16,7 @@ AUTH_SECRET="N/c6mnaS5+SWq81+819OrzQZlmx1Vxtp/orjttJSmw8="
PROWLER_API_VERSION="stable"
# PostgreSQL settings
# If running Django and celery on host, use 'localhost', else use 'postgres-db'
POSTGRES_HOST=postgres-db
POSTGRES_HOST=postgres-db-proxy
POSTGRES_PORT=5432
POSTGRES_ADMIN_USER=prowler_admin
POSTGRES_ADMIN_PASSWORD=postgres

View File

@@ -26,6 +26,25 @@ services:
ports:
- ${UI_PORT:-3000}:${UI_PORT:-3000}
postgres-proxy:
image: edoburu/pgbouncer:latest
hostname: "postgres-db-proxy"
environment:
- DB_HOST=postgres-db
- DB_PORT=5432
- DB_USER=${POSTGRES_ADMIN_USER}
- DB_PASSWORD=${POSTGRES_ADMIN_PASSWORD}
- ADMIN_USERS=prowler_admin
- AUTH_TYPE=scram-sha-256
env_file:
- path: ./.env
required: false
ports:
- "5432:5432"
depends_on:
postgres:
condition: service_healthy
postgres:
image: postgres:16.3-alpine3.20
hostname: "postgres-db"
@@ -38,8 +57,8 @@ services:
env_file:
- path: .env
required: false
ports:
- "${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}"
# ports:
# - "${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}"
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRES_ADMIN_USER} -d ${POSTGRES_DB}'"]
interval: 5s