Skip to content

Simple Configuration for how to render InfluxDB v2 behind Traefik Proxy using docker-compose

License

Notifications You must be signed in to change notification settings

InfluxCommunity/influxdb2-traefik

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

influxdb2-traefik

Simple Configuration for how to render InfluxDB v2 behind Traefik Proxy using Docker Compose

Situation

InfluxDBv2 does not provide any configuration flags / environment variables that can help render the UI as paths e.g. /influxdb.

An Open Issue since InfluxDB2.0-alpha has yet to find a solution.

However, there is a potential way to circumvent this problem but using Host in Traefik.

NOTE: PLEASE DO NOT DEPLOY THIS STACK IN PRODUCTION.

Usage

Create a docker network called proxy-network

docker network create proxy-network

Bring the stack up using:

docker compose -p influxdb2-traefik up

Results / Caveats / Design

The UI will be available on http://influxdb.localhost instead of http://localhost/influxdb

Metrics

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

Common Variables Usage

within the docker-compose.yml file

x-common-env-variables: &common-env
  DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_INIT_ORG}
  DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_INIT_BUCKET}
  DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_INIT_ADMIT_TOKEN}

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.

The values are filled by .env which docker compose automatically uses during stack up.

Security

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.

Configuration Checks

Use the integrated compose CLI from docker to verify if everything looks okay or not!

docker compose config

LICENSE

Published under MIT License

Maintainer

Shan Desai

About

Simple Configuration for how to render InfluxDB v2 behind Traefik Proxy using docker-compose

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages