From d547f0aab5ec0ea0a3514d695bf02e5afea79c7c Mon Sep 17 00:00:00 2001 From: Max Wofford Date: Mon, 28 Apr 2025 11:01:47 -0400 Subject: [PATCH] Add pgbouncer config --- .env.example | 1 + docker-compose.pgbouncer.yml | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 docker-compose.pgbouncer.yml diff --git a/.env.example b/.env.example index 62c9f8e..a8d4be0 100644 --- a/.env.example +++ b/.env.example @@ -19,6 +19,7 @@ WAREHOUSE_DATABASE_URL=your_warehouse_database_url_here # You can leave this alone if you're using the provided docker setup! DATABASE_URL=your_database_url_here +POOL_DATABASE_URL=pg_bouncer_url_here # Secret key base SECRET_KEY_BASE=your_secret_key_base_here diff --git a/docker-compose.pgbouncer.yml b/docker-compose.pgbouncer.yml new file mode 100644 index 0000000..ef47d89 --- /dev/null +++ b/docker-compose.pgbouncer.yml @@ -0,0 +1,25 @@ +version: '3.8' +# This is run on coolify under a seperate service so we don't restart it on +# every git push! +services: + pgbouncer: + image: edoburu/pgbouncer:v1.24.0-p1 + environment: + - DB_USER=${DB_USER:-postgres} + - DB_PASSWORD=${DB_PASSWORD} + - DB_HOST=${DB_HOST} + - DB_PORT=${DB_PORT:-6382} + - DB_NAME=${DB_NAME:-postgres} + - POOL_MODE=transaction + - MAX_CLIENT_CONN=1000 + - DEFAULT_POOL_SIZE=20 + - MIN_POOL_SIZE=5 + - AUTH_TYPE=scram-sha-256 + - ADMIN_USERS=${DB_USER:-postgres} + ports: + - "6432:6432" + healthcheck: + test: ["CMD", "pg_isready", "-h", "localhost"] + interval: 10s + timeout: 5s + retries: 5 \ No newline at end of file