<a id="reference-relation-endpoints"></a>

# Relation endpoints

See [Integrations](https://charmhub.io/wordpress-k8s/integrations).

## Database

*Interface*: mysql_client<br />
\\\\
*Supported charms*: [Charmed MySQL](https://charmhub.io/mysql), [Charmed MySQL-K8s](https://charmhub.io/mysql-k8s)

The `database` endpoint can be integrated with MySQL based charms, providing long term storage for WordPress.
The database relation connects wordpress-k8s with charms that support the `mysql_client` interface on port 3306
in the database side.

Example database integrate command:

```default
juju integrate wordpress-k8s:database mysql-k8s:database
```

## Grafana dashboard

*Interface*: grafana-dashboard<br />
\\\\
*Supported charms*: [grafana-k8s](https://charmhub.io/grafana-k8s)

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

The `wordpress-k8s` charm
satisfies the `grafana_dashboard` interface by providing the pre-made dashboard template to the
Grafana relation data bag under the “dashboards” key. Requires Prometheus datasource to be already
integrated with Grafana.

Grafana-Prometheus integrate command:

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

Grafana-dashboard integrate command:

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

## Ingress

*Interface*: ingress<br />
\\\\
*Supported charms*: [nginx-ingress-integrator](https://charmhub.io/nginx-ingress-integrator)

Ingress manages external http/https access to services in a Kubernetes cluster.
The `ingress` relation through [nginx-ingress-integrator](https://charmhub.io/nginx-ingress-integrator)
charm enables additional `blog_hostname` and `use_nginx_ingress_modesec` configurations that
provide capabilities such as ModSecurity enabled
Web Application Firewall ([WAF](https://docs.nginx.com/waf/)).

Note that the
Kubernetes cluster must already have an nginx ingress controller deployed. Documentation to
enable ingress in MicroK8s can be found [here](https://canonical.com/microk8s/docs/addon-ingress).

Example ingress integrate command:

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

## Logging

*Interface*: loki_push_api<br />
\\\\
*Supported charms*: [loki-k8s](https://charmhub.io/loki-k8s)

The `logging` relation is a part of the COS relation to enhance logging observability.
Logging relation through the `loki_push_api` interface installs and runs promtail which ships the
contents of local logs found at `/var/log/apache2/access.log` and `/var/log/apache2/error.log` to Loki.
This can then be queried through the Loki API or easily visualized through Grafana. Learn more about COS
[here](https://charmhub.io/topics/canonical-observability-stack).

Logging-endpoint integrate command:

```default
juju integrate wordpress-k8s loki-k8s
```

## Metrics endpoint

*Interface*: [prometheus_scrape](https://charmhub.io/interfaces/prometheus_scrape)<br />
\\\\
*Supported charms*: [prometheus-k8s](https://charmhub.io/prometheus-k8s)

The `metrics-endpoint` relation allows scraping the `/metrics` endpoint provided by `apache-exporter` sidecar
on port 9117, which provides Apache metrics from the `/server-status` route. This internal
Apache route is not exposed and can only be accessed from within the same
Kubernetes pod. 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, please refer to the [apache-exporter documentation](https://github.com/Lusitaniae/apache_exporter#collectors).

Metrics-endpoint integrate command:

```default
juju integrate wordpress-k8s prometheus-k8s
```
