canonical / pgbouncer-operator

A charmed operator for running PgBouncer on virtual machines.
https://charmhub.io/pgbouncer?channel=1/stable
Apache License 2.0
4 stars 4 forks source link
data-platform pgbouncer

Charmed PgBouncer Operator

Charmhub Release Tests codecov

Description

The PgBouncer Operator deploys and operates the PgBouncer lightweight connection pooler for PostgreSQL. This charm is only compatible with the data platform postgresql-operator charm.

Usage

To deploy pgbouncer in front of three units of postgres:

juju deploy pgbouncer --channel=edge
juju deploy postgresql --channel=edge -n 3
juju add-relation pgbouncer:backend-database postgresql:database

To deploy and relate your application to the above cluster, using the updated data platform relation (recommended):

juju deploy my-app
juju add-relation pgbouncer:database my-app:pg-backend

To deploy and relate an application to the above cluster, using the legacy pgsql relation (not recommended - this will be deprecated in future):

juju deploy my-app
juju add-relation pgbouncer:db my-app:db

Or, if my-app needs admin permissions:

juju add-relation pgbouncer:db-admin my-app:db

Configuration Options

Set these using the command juju config <option>=<value>.

From these values and the current deployment, the following pgbouncer.ini config values are calculated proportional to max_db_connections:

If max_db_connections is set to 0, the derivatives are set as below, based on pgbouncer defaults. It's advised to avoid this and instead set max_db_connections to an amount you're expecting to use, as it will set the following values to better suit your use case.

The following config values are set as constants in the charm:

Relations

The expected data presented in a relation interface is provided in the docstring at the top of the source files for each relation.

Legacy Relations

The following relations are legacy, and will be deprecated in a future release in favour of relations using the data platform provides library. For future compatibility, build relations with the data platform requires library.

License

The Charmed PgBouncer Operator is free software, distributed under the Apache Software License, version 2.0. See LICENSE for more information.

Security

Security issues in the Charmed PgBouncer Operator can be reported through LaunchPad. Please do not file GitHub issues about security issues.

Contributing

Please see the Juju SDK docs for guidelines on enhancements to this charm following best practice guidelines, and CONTRIBUTING.md for developer guidance. For more information, get in touch on the Charmhub Mattermost server.