A charm that connects a Juju model to an external PostgreSQL database
Warning: prototype software
This charm is a prototype only. It is designed for testing the possibility of
interacting with software deployed outside of Juju only.
This charm provides the pgsql:db
interface, without installing the database.
It’s useful for connecting your model to a PostgreSQL database created outside of
Juju’s control.
This charm is an example of the Envoy pattern. An envoy charm does little work on its
own. Its role is to connect a Juju model to infrastructure that exists outside of Juju.
Envoy charms are also known as proxy charms and integration charms.
Unlike regular charms, postgresql-envoy
relies on system administrators to perform
several setup tasks.
host
and port
connection parameters.Ensure that a user account (a “role” in PostgreSQL terminology) exists that has the
ability to create users and databases. This account becomes the username
andpassword
credential pair used within the configuration steps later.
An example of a SQL command that creates such a user is:
CREATE USER postgresql_envoy_charm
WITH
PASSWORD 'pass123'
CREATEDB
CREATEROLE;
(Optional) Add a small machine to the model. The default machine size is not required,
as this charm does little work.
juju add-machine --constraints 'mem=512M cores=1 root-disk=10G'
When deploying decoy-postgresql
, you should use a placement directive (--to
) to point
to a machine that already exists.
juju deploy cs:tim-clicks/postgresql-envoy [--to <machine-id>] --config username=<admin-username> --config password=<admin-password>
postgresql-envoy
applicationIf you omitted the --config
parameters during juju deploy
, you can add them now:
juju config postgresql-envoy username=<admin-user> password=<password>
Other charms should be able to interact with this charm as they are with cs:postgresql
.
When a relation is broken, the user account is removed.
This charm is not suitable for production
Clean up:
Blockers for recommended usage
Security:
Relations:
postgresql-envoy
does not understand the pgsql:db-admin
relation endpoint.