<a id="reference-integrations"></a>

# Integrations

<!-- vale Canonical.007-Headings-sentence-case = NO -->
<!-- The headings are relation endpoints, makes sense they are lowercase as in metadata.yaml-->

## db

*Interface*: `pgsql`

*Supported charms*: [`postgresql-k8s`](https://charmhub.io/postgresql-k8s),
[PostgreSQL](https://charmhub.io/postgresql)

Database integration is a required relation for the Discourse charm to supply
structured data storage for Discourse.

Database integrate command:

```default
juju integrate discourse-k8s postgresql-k8s
```

## grafana-dashboard

*Interface*: `grafana-dashboard`

*Supported charms*: [grafana-k8s](https://charmhub.io/grafana-k8s)

Grafana-dashboard relation enables quick dashboard access already tailored to
fit the needs of operators to monitor the charm. The template for the Grafana
dashboard for Discourse charm can be found at `/src/grafana_dashboards/discourse.json`.
In Grafana UI, it can be found as “Discourse Operator” under the General section of the dashboard browser
(`/dashboards`). Modifications to the dashboard can be made but will not be
persisted upon restart/redeployment of the charm.

Grafana-Prometheus integrate command:

```default
juju integrate grafana-k8s:grafana-source prometheus-k8s:grafana-source
```

Grafana-dashboard integrate command:

```default
juju integrate discourse-k8s grafana-dashboard`
```

## ingress

*Interface*: `ingress`

*Supported charms*: [nginx-ingress-integrator](https://charmhub.io/nginx-ingress-integrator),
[traefik](https://charmhub.io/traefik-k8s)

Ingress manages external http/https access to services in a kubernetes cluster.
Note that the kubernetes cluster must already have an nginx ingress controller
already deployed. Documentation to enable ingress in MicroK8s can be found in
[Add-on: Ingress](https://microk8s.io/docs/addon-ingress).

Ingress integrate command:

```default
juju integrate discourse-k8s nginx-ingress-integrator
```

## metrics-endpoint

<!-- vale Canonical.000-US-spellcheck = NO -->
<!-- prometheus_scrape is the name of the interface>
\_Interface_: [prometheus_scrape](https://charmhub.io/interfaces/prometheus_scrape)
<!-- vale Canonical.000-US-spellcheck = YES -->

*Supported charms*: [prometheus-k8s](https://charmhub.io/prometheus-k8s)

Metrics-endpoint relation allows scraping the `/metrics` endpoint provided by Discourse.
The metrics are exposed in the [open metrics format](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#data-model) and will only be scraped by Prometheus once the
relation becomes active. For more information about the metrics exposed, refer to [“How to monitor Discourse metrics using Prometheus”](https://meta.discourse.org/t/discourse-prometheus/72666).

Metrics-endpoint integrate command:

```default
juju integrate discourse-k8s prometheus-k8s
```

## oauth

*Interface*: `oauth`

*Supported charms*: [Hydra](https://charmhub.io/hydra)

OAuth relation allows Discourse to integrate with an OAuth provider for authentication and authorization. This enables users to log in to Discourse using their existing credentials from the provider. The easiest way to use the [Hydra](https://charmhub.io/hydra) is to deploy [Canonical Identity Platform](https://canonical-identity.readthedocs-hosted.com/tutorial/canonical-identity-platform/).

OAuth integrate command:

```default
juju integrate discourse-k8s hydra
```

## redis

<!-- vale Canonical.007-Headings-sentence-case = YES -->

*Interface*: `redis`

*Supported charms*: [redis-k8s](https://charmhub.io/redis-k8s)

Discourse uses Redis to run background tasks (with Sidekiq) and keep the application fast and responsive. It enables real-time updates on the pages and helps in managing data efficiently. Redis also helps Discourse in balancing loads by managing rate limits, making it a crucial part of its system.

Redis integrate commands:

```default
juju integrate discourse-k8s redis-k8s
```
