Charmed PostgreSQL VM

Channel Revision Published Runs on
latest/stable 345 09 Nov 2023
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 239 09 Feb 2022
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
latest/stable 226 01 Apr 2021
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04 Ubuntu 14.04
14/stable 468 11 Sep 2024
Ubuntu 22.04
14/stable 467 11 Sep 2024
Ubuntu 22.04
14/candidate 468 02 Sep 2024
Ubuntu 22.04
14/candidate 467 02 Sep 2024
Ubuntu 22.04
14/beta 502 23 Oct 2024
Ubuntu 22.04
14/beta 503 23 Oct 2024
Ubuntu 22.04
14/edge 516 12 Nov 2024
Ubuntu 22.04
14/edge 515 12 Nov 2024
Ubuntu 22.04
juju deploy postgresql --channel 14/stable
Show information

Platform:

Ubuntu
22.04 20.04 18.04 16.04 14.04

Note: All commands are written for juju >= v.3.0

If you are using an earlier version, check the Juju 3.0 Release Notes.

How to integrate with another application

Integrations (formerly “relations”) are connections between two applications with compatible endpoints. These connections simplify the creation and management of users, passwords, and other shared data.

This guide shows how to integrate Charmed PostgreSQL with both charmed and non-charmed applications.

For developer information about how to integrate your own charmed application with PostgreSQL, see Development > How to integrate with your charm.

Summary


Integrate with a charmed application

Integrations with charmed applications are supported via the modern postgresql_client interface, and the legacy psql interface from the original version of the charm.

You can see which existing charms are compatible with PostgreSQL in the Integrations tab.

Modern postgresql_client interface

To integrate with a charmed application that supports the postgresql_client interface, run

juju integrate postgresql:database <charm>

To remove the integration, run

juju remove-relation postgresql <charm>

Legacy pgsql interface

Note that this interface is deprecated. See more information in Explanation > Legacy charm.

To integrate via the legacy interface, run

juju integrate postgresql:db <charm>

Extended permissions can be requested using the db-admin endpoint:

juju integrate postgresql:db-admin <charm>

Integrate with a non-charmed application

To integrate with an application outside of Juju, you must use the data-integrator charm to create the required credentials and endpoints.

Deploy data-integrator:

juju deploy data-integrator --config database-name=<name>

Integrate with PostgreSQL:

juju integrate data-integrator postgresql

Use the get-credentials action to retrieve credentials from data-integrator:

juju run data-integrator/leader get-credentials

Rotate application passwords

To rotate the passwords of users created for integrated applications, the integration should be removed and integrated again. This process will generate a new user and password for the application.

juju remove-relation <charm> postgresql
juju integrate <charm> postgresql

<charm> can be data-integrator in the case of connecting with a non-charmed application.

Internal operator user

The operator user is used internally by the Charmed PostgreSQL application. The set-password action can be used to rotate its password.

To set a specific password for the operator user, run

juju run postgresql/leader set-password password=<password>

To randomly generate a password for the operator user, run

juju run postgresql/leader set-password