How can I apply connection pooling with pgbouncer in my docker-compose
file. I don't know if the ConnectionString
of my containers are correct or not.
postgredb:
image: postgres
environment:
- POSTGRES_USER=dbuser
- POSTGRES_PASSWORD=dbpassword
- POSTGRES_DB=postgres
restart: always
volumes:
- pg-data:/var/lib/postgresql/data/
pgbouncer:
image: edoburu/pgbouncer
environment:
- DB_HOST=postgredb
- DB_PORT=5432
- DB_USER=dbuser
- DB_PASSWORD=dbpassword
- ADMIN_USERS=postgres,admin
ports:
- "5432:5432"
commenting.api:
environment:
- ConnectionString=Server=pgbouncer;Port=5432;Database=commentDb;UId=dbuser;Password=dbpassword;Pooling=true;
ports:
- "5051:80"
posting.api:
environment:
- ConnectionString=Server=pgbouncer;Port=5432;Database=postDb;UId=dbuser;Password=dbpassword;Pooling=true;
ports:
- "5052:80"
I get this error Npgsql.PostgresException: '08P01: server login failed: wrong password type'
.
So far the closest configuration I found was in this repository edoburu/docker-pgbouncer