How to host Grafana with persistent storage?

I have an application that uses a Postgres DB with the timescale extension and is storing measures from a weather workstation, as per this book Build a Weather Station with Elixir and Nerves: Visualize Your Sensor Data with Phoenix and Grafana by Alexander Koutmos, Bruce A. Tate, Frank Hunleth

Now I need to set up Grafana to visualize the stored data. I don’t want to visualize performance data, I want to visualize the stored data.

I found this example app but it’s now outdated:

Anyone has a more up-to-date example?

Hey @jaimeiniesta

Sure you can use this! (You just may want to replace (in fly.toml) the image grafana/grafana:8.0.0 by something more recent like grafana/grafana:9.2.15)

Thanks Guillaume!

I’m a bit lost, I cloned that repo (and updated the image to 9.2.15), then I run fly launch to create the app, it goes OK, but when I run fly deploy I get this error:

Error: failed to fetch an image or build from source: app does not have a Dockerfile or buildpacks configured. See https://fly.io/docs/reference/configuration/#the-build-section

I also tried with the Dockerfile in GitHub - cschmatzler/grafana: Run Grafana on Fly

But then I get an error, Error: Mounts source volume "grafana_storage" does not exist.

Sorry but I’m completely lost here.

Try running fly launch - it should detect the volume in fly.toml and create it for you. When I run it, it prints out:

Creating 1GB volume 'grafana_storage' for process group 'app'. See `fly vol extend` to increase its size

If that doesn’t work for you, you can also create a volume yourself with fly vol create grafana_storage, and then fly deploy should mount it.

You can read more about volumes here: Add Volume Storage · Fly Docs

Thanks Ben and Guillaume!

I got this working finally :slight_smile:

2 Likes

From How To to Questions / Help

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.