Hi!
I’ve deployed a Grafana instance (I know fly.io offers it, I just can’t add any other data sources and I prefer syncing my dashboards with code):
app = 'grafana'
primary_region = 'cdg'
[build]
dockerfile = 'Dockerfile'
[env]
ENV = 'dev'
# GF_SERVER_HTTP_ADDR = '0.0.0.0' # I've tried to uncomment but this has no effect
# GF_SERVER_HTTP_PORT = 3000 # Same here
GF_AUTH_ANONYMOUS_ENABLED = 'true'
GF_AUTH_ANONYMOUS_ORG_ROLE = 'Admin'
GF_AUTH_BASIC_ENABLED = 'false'
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 1
[[http_service.checks]]
interval = '30s'
timeout = '60s'
grace_period = '10s'
method = 'GET'
path = '/api/health'
[[vm]]
memory = '512mb'
cpu_kind = 'shared'
cpus = 1
Here’s the Dockerfile:
FROM grafana/grafana:11.5.2
# From https://grafana.com/docs/grafana/latest/administration/provisioning/#data-sources
COPY datasources.yaml /etc/grafana/provisioning/datasources/datasources.yaml
# I've tried with/without these lines below
USER root
ENTRYPOINT ["/run.sh"]
When I deploy it to fly.io, the app cannot be reachable but the health check if fine:
WARNING The app is not listening on the expected address and will not be reachable by fly-proxy.
You can fix this by configuring your app to listen on the following addresses:
- 0.0.0.0:3000
Found these processes inside the machine with open listening sockets:
PROCESS | ADDRESSES
-----------------*----------------------------------------
/.fly/hallpass | [fdaa:10:4adf:a7b:39e:9c84:72ac:2]:22
Here’s a sample of the logs that seems to show that Grafana is indeed working:
2025-03-08T22:52:37.476 app[148e39e6b71408] cdg [info] logger=ngalert.state.manager t=2025-03-08T22:52:37.476132156Z level=info msg="Warming state cache for startup"
2025-03-08T22:52:37.476 app[148e39e6b71408] cdg [info] logger=ngalert.state.manager t=2025-03-08T22:52:37.476517083Z level=info msg="State cache has been initialized" states=0 duration=384.336µs
2025-03-08T22:52:37.478 app[148e39e6b71408] cdg [info] logger=provisioning.dashboard t=2025-03-08T22:52:37.478477596Z level=info msg="starting to provision dashboards"
2025-03-08T22:52:37.478 app[148e39e6b71408] cdg [info] logger=provisioning.dashboard t=2025-03-08T22:52:37.478513414Z level=info msg="finished to provision dashboards"
2025-03-08T22:52:37.480 app[148e39e6b71408] cdg [info] logger=grafanaStorageLogger t=2025-03-08T22:52:37.480851921Z level=info msg="Storage starting"
2025-03-08T22:52:37.501 app[148e39e6b71408] cdg [info] logger=plugin.backgroundinstaller t=2025-03-08T22:52:37.501293339Z level=info msg="Installing plugin" pluginId=grafana-lokiexplore-app version=
2025-03-08T22:52:37.501 app[148e39e6b71408] cdg [info] logger=ngalert.multiorg.alertmanager t=2025-03-08T22:52:37.501526325Z level=info msg="Starting MultiOrg Alertmanager"
2025-03-08T22:52:37.501 app[148e39e6b71408] cdg [info] logger=ngalert.scheduler t=2025-03-08T22:52:37.501592851Z level=info msg="Starting scheduler" tickInterval=10s maxAttempts=3
2025-03-08T22:52:37.502 app[148e39e6b71408] cdg [info] logger=ticker t=2025-03-08T22:52:37.502084003Z level=info msg=starting first_tick=2025-03-08T22:52:40Z
2025-03-08T22:52:37.504 app[148e39e6b71408] cdg [info] logger=http.server t=2025-03-08T22:52:37.504553504Z level=info msg="HTTP Server Listen" address=[::]:3000 protocol=http subUrl= socket=
2025-03-08T22:52:37.677 app[148e39e6b71408] cdg [info] logger=plugin.angulardetectorsprovider.dynamic t=2025-03-08T22:52:37.677641064Z level=info msg="Patterns update finished" duration=171.197628ms
2025-03-08T22:52:37.692 app[148e39e6b71408] cdg [info] logger=plugins.update.checker t=2025-03-08T22:52:37.692491397Z level=info msg="Update check succeeded" duration=212.452849ms
2025-03-08T22:52:37.692 app[148e39e6b71408] cdg [info] logger=grafana.update.checker t=2025-03-08T22:52:37.692804003Z level=info msg="Update check succeeded" duration=213.949647ms
2025-03-08T22:52:37.900 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.900714156Z level=info msg="Adding GroupVersion userstorage.grafana.app v0alpha1 to ResourceManager"
2025-03-08T22:52:37.901 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.901313644Z level=info msg="Adding GroupVersion playlist.grafana.app v0alpha1 to ResourceManager"
2025-03-08T22:52:37.901 app[148e39e6b71408] cdg [info] logger=resource-server t=2025-03-08T22:52:37.901542217Z level=warn msg="failed to register storage metrics" error="duplicate metrics collector registration attempted"
2025-03-08T22:52:37.902 app[148e39e6b71408] cdg [info] logger=resource-server t=2025-03-08T22:52:37.901977774Z level=warn msg="failed to register storage metrics" error="duplicate metrics collector registration attempted"
2025-03-08T22:52:37.902 app[148e39e6b71408] cdg [info] logger=resource-server t=2025-03-08T22:52:37.902056735Z level=warn msg="failed to register storage metrics" error="duplicate metrics collector registration attempted"
2025-03-08T22:52:37.903 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.90339788Z level=info msg="Adding GroupVersion dashboard.grafana.app v0alpha1 to ResourceManager"
2025-03-08T22:52:37.904 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.904259477Z level=info msg="Adding GroupVersion dashboard.grafana.app v1alpha1 to ResourceManager"
2025-03-08T22:52:37.904 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.904815903Z level=info msg="Adding GroupVersion dashboard.grafana.app v2alpha1 to ResourceManager"
2025-03-08T22:52:37.905 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.905329141Z level=info msg="Adding GroupVersion featuretoggle.grafana.app v0alpha1 to ResourceManager"
2025-03-08T22:52:37.906 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.90669257Z level=info msg="Adding GroupVersion iam.grafana.app v0alpha1 to ResourceManager"
2025-03-08T22:52:37.908 app[148e39e6b71408] cdg [info] logger=grafana-apiserver t=2025-03-08T22:52:37.908389442Z level=info msg="Adding GroupVersion notifications.alerting.grafana.app v0alpha1 to ResourceManager"
2025-03-08T22:52:37.976 app[148e39e6b71408] cdg [info] logger=app-registry t=2025-03-08T22:52:37.97640178Z level=info msg="app registry initialized"
2025-03-08T22:52:38.030 app[148e39e6b71408] cdg [info] logger=plugin.installer t=2025-03-08T22:52:38.029210874Z level=info msg="Installing plugin" pluginId=grafana-lokiexplore-app version=
2025-03-08T22:52:38.166 app[148e39e6b71408] cdg [info] logger=installer.fs t=2025-03-08T22:52:38.165980671Z level=info msg="Downloaded and extracted grafana-lokiexplore-app v1.0.8 zip successfully to /var/lib/grafana/plugins/grafana-lokiexplore-app"
2025-03-08T22:52:38.214 app[148e39e6b71408] cdg [info] logger=plugins.registration t=2025-03-08T22:52:38.21395909Z level=info msg="Plugin registered" pluginId=grafana-lokiexplore-app
2025-03-08T22:52:38.214 app[148e39e6b71408] cdg [info] logger=plugin.backgroundinstaller t=2025-03-08T22:52:38.214085976Z level=info msg="Plugin successfully installed" pluginId=grafana-lokiexplore-app version= duration=712.733659ms
2025-03-08T22:52:38.214 app[148e39e6b71408] cdg [info] logger=plugin.backgroundinstaller t=2025-03-08T22:52:38.214143952Z level=info msg="Installing plugin" pluginId=grafana-pyroscope-app version=
2025-03-08T22:52:38.282 app[148e39e6b71408] cdg [info] logger=plugin.installer t=2025-03-08T22:52:38.281989438Z level=info msg="Installing plugin" pluginId=grafana-pyroscope-app version=
2025-03-08T22:52:38.337 app[148e39e6b71408] cdg [info] logger=installer.fs t=2025-03-08T22:52:38.336348496Z level=info msg="Downloaded and extracted grafana-pyroscope-app v1.1.0 zip successfully to /var/lib/grafana/plugins/grafana-pyroscope-app"
2025-03-08T22:52:38.402 app[148e39e6b71408] cdg [info] logger=plugins.registration t=2025-03-08T22:52:38.40270693Z level=info msg="Plugin registered" pluginId=grafana-pyroscope-app
2025-03-08T22:52:38.402 app[148e39e6b71408] cdg [info] logger=plugin.backgroundinstaller t=2025-03-08T22:52:38.402797155Z level=info msg="Plugin successfully installed" pluginId=grafana-pyroscope-app version= duration=188.634758ms
2025-03-08T22:52:58.135 health[148e39e6b71408] cdg [info] Health check on port 3000 is now passing.
When I try to access the dashboard from the fly.io URL, it’s not accessible.
What I really don’t understand is that when I use that exact same Dockerfile to build the image locally, it works fine and I can access Grafana from localhost:3000
. Any idea why this happens with this particular setup but not my other apps?