Grafana cannot load application files

Hello,

i somehow have the issue that i cannot access grafana webinterface through nginx reverse proxy and neither directly.
Strange is, it does work in a browser where i initially had set up grafana, there is a session cookie “grafana_session”, when i copy this cookie to a browser where it does not work, it works.

  • What Grafana version and what operating system are you using?
    – Current docker image (grafana/grafana:latest)

– Docker Compose:

  grafana-1:
    container_name: grafana-1
    hostname: grafana-1
    image: grafana/grafana:latest
    restart: unless-stopped
    networks:
      - grafana_internal
    ports:
      - "3000:3000"
      - "9094:9094"
    volumes:
      - "/mnt/data/grafana/grafana.ini:/etc/grafana/grafana.ini:ro"
      - "/mnt/data/grafana/ldap-domain.toml:/etc/grafana/ldap-domain.toml:ro"
      - "/mnt/data/grafana/plugins:/var/lib/grafana/plugins"
    environment:
      GF_LOG_LEVEL: debug
  • What are you trying to achieve?
    – Connect through nginx / connect directly to [IP-Address:3000]

  • What happened?
    – Switched to another browser

  • What did you expect to happen?
    – GUI to load

  • Can you copy/paste the configuration(s) that you are having problems with?
    – Currently “domain”,“enforce_domain”, “root_url” are disabled for testing without reverse proxy

app_mode = production
instance_name = ${HOSTNAME}

[server]
enable_gzip = true
protocol = http
http_port = 3000
;domain = grafana.domain.local
;enforce_domain = true
;root_url = https://grafana.domain.local/
router_logging = true

[database]
type = postgres
host = grafana-db:5432
name = grafana
user = grafana
password = password
ssl_mode = disable

[analytics]
reporting_enabled = false
enable_feedback_links = false

[security]
admin_user = grafadmin
admin_email = grafana@domain.com
cookie_secure = false
disable_gravatar = true

[users]
allow_sign_up = true
allow_org_create = false
default_theme = light
hidden_users = grafadmin
login_hint = e-mail or upn

[auth.basic]
enabled = true

[smtp]
enabled = true
host = smtp.domain.local:25
skip_verify = true
from_address = grafana@domain.com
from_name = Grafana
ehlo_identity = grafana.domain.local
startTLS_policy = NoStartTLS

[auth.ldap]
enabled = true
config_file = /etc/grafana/ldap-domain.toml
allow_sign_up = true
skip_org_role_sync = false

[unified_alerting]
enabled = true
ha_peers = grafana-1:9094, grafana-2:9094

[help]
enabled = false

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    – No error logs - i enabled debug and routing logs and i only get this every time i try to access the page
logger=infra.kvstore.sql t=2022-11-15T16:26:08.549870228Z level=debug msg="kvstore value not found" orgId=0 namespace=serviceaccounts key=hideApiKeys
logger=context userId=0 orgId=0 uname= t=2022-11-15T16:26:08.55345748Z level=info msg="Request Completed" method=GET path=/login status=200 remote_addr=172.16.40.167 time_ms=7 duration=7.433125ms size=6004 referer= handler=/login

I followed those instructions but it also does not work when i access it without reverse peoxyi - so direct grafana:3000 does also bring up the error.

OK, don’t use proxy at all. Remove all your custom configs - first you need to solve access and then you can add it back (start minimal working setup and then add more complex config later). Increase log level → check logs. Check browser console - there are probably wrong generated URLs, errors, … Use explicit docker tag (not latest, where is not clear which version are you using). Clear browser cache/use incognito windows for testing, so no browser cache will be used.

I tried now with a fresh config an docker image “grafana/grafana-enterprise:9.2.4” and this works, even with proxy.

I originally followed GitHub - codesenju/grafana-HA and Configure Grafana | Grafana documentation

My docker config for postgres:

  grafana-db:
    container_name: grafana-db
    hostname: grafana-db
    image: postgres:12-alpine
    restart: unless-stopped
    networks:
      - grafana_internal
    expose:
      - "5432:5432"
    volumes:
      - "/mnt/data/grafana-db:/var/lib/postgresql/data"
    environment:
      POSTGRES_PASSWORD: RI828m35GS3qtzklilttzL
      POSTGRES_USER: grafana
      POSTGRES_DB: grafana
      PGDATA: /var/lib/postgresql/data/pgdata

And grafana.ini settings:

[database]
type = postgres
host = grafana-db:5432
name = grafana
user = grafana
password = RI828m35GS3qtzklilttzL
ssl_mode = disable

Any ideas?

I found the issue - the problem seems to be this option in the grafana.ini

[help]
enabled = false

If this is set to false i get the error as in my original post, removing this value or setting it to true will work.