Created
January 3, 2022 13:50
-
-
Save paulmwatson/5e2ab24665815f67fcd8541cabfecc81 to your computer and use it in GitHub Desktop.
Using PgBouncer with Django and Docker Compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
app: | |
build: . | |
image: app | |
depends_on: | |
- db | |
environment: | |
- DATABASE_URL=postgresql://db:db@pgbouncer/db | |
- DATABASE_NAME=db | |
ports: | |
- "8000:8000" | |
command: bin/wait-for-deps.sh python manage.py runserver 0.0.0.0:8000 | |
db: | |
build: | |
context: docker/db | |
image: postgres-9.6-postgis-2.3 | |
environment: | |
- POSTGRES_USER=db | |
- POSTGRES_PASSWORD=db | |
- POSTGRES_DB=db | |
pgbouncer: | |
image: edoburu/pgbouncer | |
environment: | |
- DB_USER=db | |
- DB_PASSWORD=db | |
- DB_HOST=db | |
- DB_NAME=db | |
- POOL_MODE=transaction | |
- ADMIN_USERS=postgres,dbuser | |
ports: | |
- "5432:5432" | |
depends_on: | |
- db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment