Render your InfluxDB v2 UI behind a Traefik Reverse-Proxy
InfluxDBv2 does not provide any configuration flags / environment variables
that can help render the UI as paths e.g. /influxdb
. However, there is a
potential way to circumvent this problem but using Host
in Traefik.
NOTE: PLEASE DO NOT DEPLOY THIS STACK IN PRODUCTION.
The UI will be available on http://influxdb.localhost
instead of
http://localhost/influxdb
You can configure Traefik to store its metrics via its Static Configuration file
(traefik.toml
) however you will need to add the information like:
- Bucket
- OrgName
- Token
as hard-coded credentials because [Traefik Static Configuration DO NOT support Go Templating] (https://doc.traefik.io/traefik/providers/file/#go-templating)
A good possibility is to use placeholders and substitute them via envsubstr
in a separate
bash file, before bringing the stack up
within the docker-compose.yml
file
x-common-env-variables: &common-env
DOCKER_INFLUXDB_INIT_ORG: LocalHost
DOCKER_INFLUXDB_INIT_BUCKET: data
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: customAdminToken
can be used to configure both, InfluxDB and Telegraf for and out-of-the-box stack. However,
additional required Environment Variables for InfluxDB are introduced via influxdb.env
not the best thing to let Traefik use /var/run/docker.sock
, however setting it to read-only,
avoiding extra privilege escalations and using a namespace should make this example a bit more secure.
Use the integrated compose
CLI from docker to verify if everything looks okay or not!
docker compose config
Published under MIT License