Mattermost Documentation Database Relations

The charm will not function without a database, so you will need to deploy the PostgreSQL charm somewhere.

Deploying PostgreSQL to the same model on Kubernetes

To deploy PostgreSQL to the same kubernetes model as Mattermost:

juju deploy cs:~postgresql-charmers/postgresql-k8s postgresql

Then simply use juju relate mattermost postgresql:db. This deployment style is recommended for testing purposes only.

Deploying PostgreSQL to another Juju model on IaaS

Cross-model relations are also supported. Create a suitable model on a different cloud, for example, LXD or OpenStack.

juju switch database
juju deploy cs:postgresql
juju offer postgresql:db

In most k8s deployments, traffic to external services from worker pods will be SNATed by some part of the infrastructure. You will need to know what the source addresses or address range is for the next step.

juju switch mattermost-test
juju find-offers  # note down offer URL; example used below:
juju relate mattermost admin/database.postgresql --via 10.9.8.0/24

(In the case of postgresql, --via is needed so that the charm can configure pga_hba.conf to let the k8s pods connect to the database.)