Notes »

Running Grafana behind Caddy reverse proxy

I'm using this caddy docker proxy container on the home server to reverse proxy other containers (Jellyfin, Nextcloud, etc) and have Caddy serve and deal with cert renewals.

I had trouble with Grafana and it took me some time to debug the issue, I would get 503 error and "no upstream available", until I changed the default 3000:3000 to simply 3000 after reading these docs.

the compose file that worked looks like this (I don't know if I need extra_hosts, but I put that in while trying to figure it out, and DOMAIN_NAME is the domain of course):

services:
  grafana:
    image: grafana/grafana-oss
    container_name: grafana
    restart: unless-stopped
    networks:
      - caddy
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
     - GF_INSTALL_PLUGINS=grafana-mqtt-datasource
    ports:
      - '3000'
    volumes:
      - grafana-storage:/var/lib/grafana
    labels:
      caddy: DOMAIN_NAME
      caddy.reverse_proxy: "{{upstreams 3000}}"
volumes:
  grafana-storage: {}
networks:
  caddy:
    external: true

edit SideBar

Page last modified on August 29, 2024, at 10:57 pm

^