https://github.com/supabase/grafana-agent-fly-example
Deploy a Grafana Agent on Fly to scrape Prometheus metrics from Supabase and send them to Grafana Cloud
https://github.com/supabase/grafana-agent-fly-example
Last synced: 10 months ago
JSON representation
Deploy a Grafana Agent on Fly to scrape Prometheus metrics from Supabase and send them to Grafana Cloud
- Host: GitHub
- URL: https://github.com/supabase/grafana-agent-fly-example
- Owner: supabase
- Archived: true
- Created: 2022-04-06T22:43:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-07T09:18:30.000Z (over 2 years ago)
- Last Synced: 2025-01-14T16:21:43.287Z (over 1 year ago)
- Language: Shell
- Size: 1.1 MB
- Stars: 36
- Watchers: 26
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ⚠️ This repository has been deprecated and it is no longer maintained ⚠️
## Please use the resources located at [supabase/supabase-grafana](https://github.com/supabase/supabase-grafana) instead.
---
# Supabase Prometheus Metrics & Grafana

## 1. Setup Accounts
1. Create an account on Grafana (https://grafana.com)
2. Create an account on Fly.io (https://fly.io)
3. You should already have a Supabase account and a Supabase project
## 2. Deploy the Grafana Agent on Fly.io
### 2A. Create the app
1. Change the `app` name in the `fly.toml`
2. Install the `flyctl` command-line tool: [flyctl installation instructions](https://fly.io/docs/hands-on/install-flyctl)
3. Log into fly: `flyctl auth login`
4. Create your fly app: `flyctl apps create`
4.1 use the app name you added to `fly.toml`
### 2B. Gather the necessary secrets
1. `SUPABASESERVICEROLESECRET`
* Supabase service role secret
* found here: [https://supabase.com/dashboard/project/_/settings/api](https://supabase.com/dashboard/project/_/settings/api)
2. `SUPABASEPROJECTURL`
* Supabase project url
* found here: [https://supabase.com/dashboard/project/_/settings/api](https://supabase.com/dashboard/project/_/settings/api)
* exclude the `https://` part, for example: `zzzzzzzzzzzzzzzzzzzz.supabase.co`
3. `REMOTEWRITEENDPOINT`
* Grafana prometheus remote write endpoint
* [Grafana Cloud](https://grafana.com) / My Account / Prometheus Details / (Remote Write Endpoint)
4. `REMOTEUSERNAME`
* Grafana prometheus Username
* [Grafana Cloud](https://grafana.com) / My Account / Prometheus Details / (Username / Instance ID)
5. `REMOTEWRITEPASSWORD`
* Grafana prometheus remote write password
* [Grafana Cloud](https://grafana.com) / My Account / Prometheus Details / (Password / API Key) / Generate now
### 2C. Save the gathered secrets
1. Set your `fly.io` secrets in the script: [set_secrets.sh](./set_secrets.sh)
> **Warning**
> If you skip this step, you'll likely see errors later on such as `error loading config file /etc/agent/agent.yaml: url for remote_write is empty` and `Error: smoke checks for 01234567890 failed: the app appears to be crashing`
### 2D. Deploy the `Grafana Agent App` on `fly.io`
This app will gather data from your Supabase project once per minute and ingest it into Grafana Cloud.
* Deploy your fly app: `fly deploy --config fly.toml`
## 3. Create the Grafana Dashboard
1. [Grafana Cloud](https://grafana.com) / My Account / Grafana / Launch
2. Menu / Dashboards / New / Import
3. Upload JSON file: [panels-full.json](./panels-full.json)
### Useful Links
[https://grafana.com/docs/agent/latest/getting-started/create-config-file/](https://grafana.com/docs/agent/latest/getting-started/create-config-file/)
### Exported metrics:
A list of exported metrics can be found [here](./metrics.md)