Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

A docker container, containing the pgbouncer connection pooler. Built for use in the pgbouncer k8s charm: https://github.com/canonical/pgbouncer-k8s-operator

License

Notifications You must be signed in to change notification settings

canonical/pgbouncer-container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PgBouncer Container

This docker image defines and configures the PgBouncer connection pooler for PostgreSQL, with a set of sensible defaults. These defaults are insecure and should be modified to suit your needs, specifically in pgbouncer.ini and userlist.txt.

Built for use in the pgbouncer k8s charm.

Usage, and connecting to a postgres container

  1. in one terminal, run the following:
    1. docker pull postgres/postgres
    2. docker run --rm -P -e POSTGRES_PASSWORD=pw --name pg --hostname pg-host postgres
  2. in another terminal:
    1. docker build -t pgbouncer:local .
    2. docker run -it --rm --env-file <your_env_file> --name pgbouncer pgbouncer:local

Environment variables

Pgbouncer won't run without the following environment variables passed in:

  • $PGB_DATABASES
  • $PGB_LISTEN_PORT
    • Port on which PgBouncer listens for traffic.
    • Default = 6432
  • $PGB_LISTEN_ADDR
    • Address at which PgBouncer listens for traffic.
    • Default = 0.0.0.0
  • $PGB_ADMIN_USERS
    • Comma-separated list of admin users.
    • Default = "admin"
  • $PGB_ADMIN_PASSWORDS
    • Comma-separated list of admin passwords, corresponding to $PGB_ADMIN_USERS
    • These will be encrypted in future.
    • A default "pw" is provided if the default $PGB_ADMIN_USERS value is used, but otherwise no default is provided.