InfluxDB1.8 - via Traefik TLS

I am trying to send and query data to influxdb1.8 via nodered but getting a 404 error.
I have traefik setup using docker using labels. Traefik shares a docker network with influxdb (i have added it outside the compose) and has grabbed a letsencrypt cert for it. I have added 8086 as an entry point. I can ping influx.${DOCKER_NAMESPACE}.${DOMAIN} from my nodered with no issues.

I came across this post with a similar problem but am not sure how it applies to me. I commented out && PathPrefix(/api)


traefik:
    image: "traefik"
    container_name: traefik
    command:
      # Traefik config
      - '--log.level=INFO'
      - "--providers.docker=true"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--entrypoints.influxdb.address=:8086" # influx
      - "--entrypoints.flowfuseagent.address=:1880" # flowfuse nodered agent
      - "--api.insecure=false" #  insecure API
      - "--providers.file.filename=config.yaml"
      - "--serverstransport.insecureskipverify=true"
       # Cert resolvers
      - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
      - "--certificatesresolvers.letsencrypt.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory" # Uncomment to test using  Lets Encrypt staging, remember to access using https://submains.domain.xx
      - "--certificatesresolvers.letsencrypt.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"

    ports:
      - "80:80"  # Web
      - "443:443"  # Websecure
      - "8080:8080" # Traefik Dashboard
      - "8086:8086" # InfluxDB port
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /root/ServerSetup/traefik/letsencrypt:/letsencrypt
      - /etc/localtime:/etc/localtime:ro
      - /root/ServerSetup/traefik/config.yaml:/config.yaml
    
    networks:
      - traefik

    labels:
      - "traefik.http.routers.dashboard.rule=Host(`traefik.${DOMAIN}`)"
      - "traefik.http.routers.dashboard.service=dashboard@internal"
      - "traefik.http.routers.api.rule=Host(`traefik.${DOMAIN}`) # && PathPrefix(`/api`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.dashboard.tls=true"
      - "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
      - "traefik.http.routers.api.tls=true"
      - "traefik.http.routers.api.tls.certresolver=letsencrypt"
      - "traefik.http.routers.dashboard.middlewares=dashboard"
      - "traefik.http.middlewares.dashboard.basicauth.users=###:####

influxdb:
    image: influxdb:${INFLUXDB_VERSION}
    restart: unless-stopped
    labels:
     - "traefik.enable=true"
     - "traefik.http.routers.${DOCKER_NAMESPACE}_influxdb.rule=Host(`influx.${DOCKER_NAMESPACE}.${DOMAIN}`)"
     - "traefik.http.routers.${DOCKER_NAMESPACE}_influxdb.entrypoints=web, websecure, influxdb"
     - "traefik.http.routers.${DOCKER_NAMESPACE}_influxdb.tls.certresolver=letsencrypt"
    volumes:
      - influxdb_data:/var/lib/influxdb:rw
      - "${DOCKER_NAMESPACE}/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf"
    networks:
      - customBridge

Thanks

It seems Traefik and InfluxDB do not share the same Docker network.

Why does InfluxDB has multiple entrypoints assigned?

It probably only needs the influx (8086) entrypoint but I was just trying to cover all bases until I got it working. I probably don't need to expose kapacitor via traefik either in the long run. They are in the same network. I've added traefik to the network manually after starting the docker compose. Here's the result of docker network inspect on the docker network:

docker network inspect ####_customBridge
[
    {
        "Name": "####_customBridge",
        "Id": "1ba058733bb3e9f023cdfd94ff8d34af3d1e52a2898d686aa73e662d3b6b1033",
        "Created": "2023-10-27T10:56:31.561374732Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.27.0.0/16",
                    "Gateway": "172.27.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "2e90ebcbc712b3bbc829fa1ec29c80b9978518f029dc1395324ba9237d69dc64": {
                "Name": "####-flowfuseagent-1",
                "EndpointID": "72bf8fda6e024bfdf1ea19a151dfd0eda37a5ad39a1a6c35df120200e751dad9",
                "MacAddress": "02:42:ac:1b:00:02",
                "IPv4Address": "172.27.0.2/16",
                "IPv6Address": ""
            },
            "4f0388dbffa2661e3c036e6ac429b93e61cda6726d9e8258b564de2c3805484c": {
                "Name": "traefik",
                "EndpointID": "6cf9ceb5db712b4c52ba3e695e7d52294049f19c1230633dc0ba3cbffd54d42b",
                "MacAddress": "02:42:ac:1b:00:08",
                "IPv4Address": "172.27.0.8/16",
                "IPv6Address": ""
            },
            "695bd7d87d2b3c4ac249effd6cd292e5baf6f0121b948e8ef3f7d720460df178": {
                "Name": "####-chronograf-1",
                "EndpointID": "f83d5fb42eb26680fb13049c21284d09cc781ac04c0501254253291c84ea405a",
                "MacAddress": "02:42:ac:1b:00:06",
                "IPv4Address": "172.27.0.6/16",
                "IPv6Address": ""
            },
            "6a8d837647675d39bca309e52c47cd2fdcd2db7f3a8134a6b8ee27a0f651de1e": {
                "Name": "####-influxdb-1",
                "EndpointID": "4aad40cd7746fd687289b133260e15d467f7643b774451dd900721df2b6f93c2",
                "MacAddress": "02:42:ac:1b:00:03",
                "IPv4Address": "172.27.0.3/16",
                "IPv6Address": ""
            },
            "e6ab3a258bbcbeeea8fb95f31cbb9c34c743d4330cfc9320440cf86dcf803018": {
                "Name": "####-grafana-1",
                "EndpointID": "9e4b15868b7121b53f67cc1a7275e27b6da433e3c25ad01101302ce103a3b37e",
                "MacAddress": "02:42:ac:1b:00:04",
                "IPv4Address": "172.27.0.4/16",
                "IPv6Address": ""
            },
            "ec549a9b42293b1105561d882b346bda3e1509497729a66567e3270f66912c87": {
                "Name": "####-kapacitor-1",
                "EndpointID": "4dce5fd7d795d161f0c34308f330be5bfce3ac14bcb5d6ae0a114464a38ca04a",
                "MacAddress": "02:42:ac:1b:00:07",
                "IPv4Address": "172.27.0.7/16",
                "IPv6Address": ""
            },
            "fa835a6c8b4ec4c39c56f7e3af8d94f88480cff1603c1b0b3b26a3cdca7fde9a": {
                "Name": "####-mosquitto-1",
                "EndpointID": "89da46d8fad8e1c9aa4f0274a47265a3e6e76d8bc8f01273cc54c5528e39b65a",
                "MacAddress": "02:42:ac:1b:00:05",
                "IPv4Address": "172.27.0.5/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {
            "com.docker.compose.network": "customBridge",
            "com.docker.compose.project": "####",
            "com.docker.compose.version": "2.23.0"
        }
    }
]

I would recommend agains such manual actions. It makes it hard to reproduce, try a clean setup.

Note that compose will adapt network names to project if you don’t define name: or external: true.

Check simple Traefik example.

Thanks, it's not really a manual action as I'm deploying all this via ansible hence why they are in separate compose files. My Traefik compose will only get deployed once but the compose with influxdb will get deployed multiple times. Once influxdb compose is up and with ansible knowing the project name it adds traefik to the network created by the influxdb compose.