Skip to content
Merged
52 changes: 50 additions & 2 deletions docs/howto/manage-web-app-charms/integrate-web-app-charm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ After the integration has been established, the connection string and other
configuration options will be available as environment variables that you may
use to configure your 12-factor application.

For example, if you wish to integrate your 12-factor application with PostgreSQL
.. seealso::

:external+ops:doc:`Ops | How to manage relations <howto/manage-relations>`

Integrate with a database
-------------------------

If you wish to integrate your 12-factor web app with PostgreSQL
(`machine <https://charmhub.io/postgresql>`_ or
`k8s <https://charmhub.io/postgresql-k8s>`_
charm), add the following endpoint definition to your project file:
Expand Down Expand Up @@ -65,4 +72,45 @@ configure your 12-factor application.
- ``POSTGRESQL_DB_HOSTNAME``
- ``POSTGRESQL_DB_PORT``

See also: :external+ops:doc:`Ops | How to manage relations <howto/manage-relations>`
Integrate with ingress
----------------------

If you wish to integrate your 12-factor web app with an ingress,
for instance
`Nginx Ingress Integrator <https://charmhub.io/nginx-ingress-integrator>`_,
provide the integration to your deployed app with:

.. code-block:: bash

juju integrate <app charm> nginx-ingress-integrator

You don't need to add an endpoint definition to your charm's
project file.

Integrate with observability
----------------------------

You must prepare an ingress if you wish to integrate your 12-factor web app
with the `Canonical Observability Stack
(COS) <https://charmhub.io/topics/canonical-observability-stack>`_.
COS relies on the Traefik ingress to expose, for example, Grafana.
On MicroK8s, Traefik requires the MetalLB loadbalancer to be enabled which
requires an IP range. Provide the IP range and enable the addon with:

.. code-block:: bash

IPADDR=$(ip -4 -j route get 2.2.2.2 | jq -r '.[] | .prefsrc')
microk8s enable metallb:$IPADDR-$IPADDR


Deploy and integrate observability to the 12-factor app with:

.. code-block:: bash

juju deploy cos-lite --trust
juju integrate <app charm> grafana
juju integrate <app charm> prometheus
juju integrate <app charm> loki

You don't need to add endpoint definitions to your charm's
project file.