Add a lot more information to docs/services/traefik.md

This commit is contained in:
Slavi Pantaleev 2023-11-09 13:59:55 +02:00
parent da364e2da7
commit 1b02f109dc

View file

@ -36,3 +36,49 @@ devture_traefik_config_certificatesResolvers_acme_email: your-email@example.com
```
Enabling the Traefik service, as shown above, automatically installs a [tecnativa/docker-socket-proxy](https://github.com/Tecnativa/docker-socket-proxy) service/container (powered by the [com.devture.ansible.role.container_socket_proxy](https://github.com/devture/com.devture.ansible.role.container_socket_proxy) Ansible role) to improve security by not mounting a Docker socket into the Traefik container.
This [Ansible role we use for Traefik](https://github.com/devture/com.devture.ansible.role.traefik) supports various configuration options. Feel free to consult [its `default/main.yml` variables file](https://github.com/devture/com.devture.ansible.role.traefik/blob/main/defaults/main.yml).
Below, you can find some guidance about common tweaks you may wish to do.
## Increase logging verbosity
```yaml
devture_traefik_config_log_level: DEBUG
```
## Disable access logs
This will disable access logging.
```yaml
devture_traefik_config_accessLog_enabled: false
```
## Enable Traefik Dashboard
This will enable a Traefik [Dashboard](https://doc.traefik.io/traefik/operations/dashboard/) UI at `https://traefik.mash.example.com/dashboard/` (note the trailing `/`).
```yaml
devture_traefik_dashboard_enabled: true
devture_traefik_dashboard_hostname: traefik.mash.example.com
devture_traefik_dashboard_basicauth_enabled: true
devture_traefik_dashboard_basicauth_user: YOUR_USERNAME_HERE
devture_traefik_dashboard_basicauth_password: YOUR_PASSWORD_HERE
```
**WARNING**: enabling the dashboard on a hostname you use for something else (like `mash.example.com` in the configuration above) may cause conflicts. Enabling the Traefik Dashboard makes Traefik capture all `/dashboard` and `/api` requests and forward them to itself. If any of the services hosted on the same hostname requires any of these 2 URL prefixes, you will experience problems.
## Additional configuration
Use the `devture_traefik_configuration_extension_yaml` variable provided by the Traefik Ansible role to override or inject additional settings, even when no dedicated variable exists.
```yaml
# This is a contrived example.
# You can enable and secure the Dashboard using dedicated variables. See above.
devture_traefik_configuration_extension_yaml: |
api:
dashboard: true
```