---
title: "Deploy Grafana"
description: "Self-hosted Grafana dashboards & alerts for Prometheus, Loki, InfluxDB, SQL"
category: "Observability"
url: https://railway.com/deploy/grafana
---

# Deploy Grafana

Self-hosted Grafana dashboards & alerts for Prometheus, Loki, InfluxDB, SQL

**[Deploy Grafana on Railway](https://railway.com/template/grafana)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/grafana/manifest.json

- **Creator:** André Lademann's Projects
- **Category:** Observability
- **Total deploys:** 344

## Template content

### grafana https://raw.githubusercontent.com/vergissberlin/railwayapp-grafana/main/logo-grafana.png

- **Source:** vergissberlin/railwayapp-grafana
- **Health check:** /api/health
- **Public domain:** Yes

## Documentation

# Grafana for railway.app

![Template Header](https://raw.githubusercontent.com/vergissberlin/railwayapp-grafana/main/template-header.svg)


Deploy Grafana  Community Edition on railway with one click.
Grafana is a multi-platform, feature rich metrics dashboard and graph editor for Graphite, InfluxDB &amp; Prometheus. It is most commonly used for visualizing time series data.

[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/grafana?referralCode=2_sIT9&amp;utm_medium=integration&amp;utm_source=template&amp;utm_campaign=generic)

## ✨ Features

* Grafana with automated setup
* Grafana UI
* Password Authentication (Set username &amp; password in environment variables)
* Railway config as code via `railway.toml`

## 🏗️ Architecture

```mermaid
flowchart LR
    Client(["🌐 Client"]) --&gt;|HTTPS| Domain["Railway Public Domain"]
    Domain --&gt;|"$PORT → GF_SERVER_HTTP_PORT"| App["Container\ngrafana/grafana-oss"]
    App --&gt; Volume[("Volume\n/var/lib/grafana")]
```

## Production recommendations (Railway)

* Set strong `GF_SECURITY_ADMIN_PASSWORD` in Railway Variables
* Persist `/var/lib/grafana` with a Railway volume
* Keep healthcheck path at `/api/health`
* Restrict plugin list in `GF_PLUGINS_PREINSTALL` to required plugins only

## 📏 Resource requirements

Measured on a fresh deploy of Grafana 13.0.2:

* **RAM:** ~0.3 GB peak on first boot, ~0.27 GB idle
* **Volume:** ~0.25 GB right after first boot; grows with dashboards, alert state and plugin updates. Plan for **≥ 0.5 GB**
* **Plan:** Hobby or higher recommended. Free and Trial cap RAM (0.5 GB / 1 GB) and volumes (0.5 GB); a full volume or memory spike crashes Grafana

## 📜 Logging

The first boot runs ~700 database migrations. The image sets `GF_LOG_FILTERS=migrator:warn` so they don't trip Railway's log rate limit; warnings and errors stay visible. Override it in Railway Variables, e.g. `GF_LOG_FILTERS=migrator:info` for full migration logs.

## 💾 Volume permissions

Railway mounts volumes as `root:root`, while the upstream Grafana image runs as
UID 472. A plain `grafana/grafana-oss` deployment therefore fails on first boot
with:

```log
mkdir: can't create directory '/var/lib/grafana/plugins': Permission denied
GF_PATHS_DATA='/var/lib/grafana' is not writable.
```

This template handles it in [`docker-entrypoint.sh`](https://github.com/vergissberlin/railwayapp-grafana/blob/main/docker-entrypoint.sh): the
container starts as root, takes ownership of the mount, and then `exec`s into
UID 472. Since it is an `exec` rather than a fork, no root process survives into
runtime — the Grafana process itself stays unprivileged.

You do **not** need `RAILWAY_RUN_UID=0`, which would keep Grafana running as
root. The recursive `chown` only runs while the mount root is misowned, i.e. once
after attaching a volume.

## 🖼️ Image rendering (`grafana-image-renderer`)

Adding `grafana-image-renderer` to `GF_PLUGINS_PREINSTALL` does **not** work on the
default image and fails at startup with `exit status 127`:

```log
Error: ✗ *rendering.RenderingService run error: Unrecognized remote plugin message
```

The plugin binary is linked against glibc, while `grafana/grafana-oss` is
Alpine-based and ships musl. Grafana closed the corresponding upstream report
([grafana-image-renderer#475](https://github.com/grafana/grafana-image-renderer/issues/475))
as *not planned*, so there is no fix to wait for. Two options work:

| Option | How | Trade-off |
| --- | --- | --- |
| Ubuntu image variant | Set `VERSION=13.0.2-ubuntu` (matching the pinned version) (build arg / Railway variable) | glibc-compatible, single service — but a noticeably larger image and rendering competes with Grafana for the same CPU/memory |
| Separate renderer service | Deploy `grafana/grafana-image-renderer` as its own Railway service, then point Grafana at it via `GF_RENDERING_SERVER_URL=http://SERVICE_NAME:8081/render` and `GF_RENDERING_CALLBACK_URL=http://GRAFANA_SERVICE_NAME:3000/` | Scales independently and keeps Chromium out of the Grafana container — but a second service to run and pay for |

For anything beyond occasional PDF or panel exports, the separate service is the
better fit: rendering is CPU- and memory-spiky, and isolating it keeps those
spikes away from the dashboards themselves.

## 🐍 How to Deploy

1. Click Deploy on Railway and setup your credentials in the environment variables

```bash
GF_DEFAULT_INSTANCE_NAME=my-instance
GF_SECURITY_ADMIN_USER=yourusername
GF_SECURITY_ADMIN_PASSWORD=yourpassword
GF_PLUGINS_PREINSTALL=grafana-clock-panel
GF_LOG_MODE=console
PORT=3000
```

2. Wait for Build &amp; Deployment to Finish
3. Open the custom URL an enter your credentials

## 👩‍💻 How to Use

1. Log in with `GF_SECURITY_ADMIN_USER` / `GF_SECURITY_ADMIN_PASSWORD`
2. Add a data source (Prometheus, Loki, InfluxDB, PostgreSQL, …) via its Railway private domain
3. Build dashboards and alerts; everything is persisted on the volume

## 🪲 Bug Reporting

If you find a bug in the template for railway, you can [submit an issue](https://github.com/vergissberlin/railwayapp-grafana/issues/new) to the GitHub Repository. Even better you can submit a Pull Request with a fix.

## 🐳  Local Development

```bash
docker compose build
docker compose up -d
```

Connect to http://localhost:3000 use setup username &amp; password from docker-compose file to login to grafana.

## 💬 Support

Questions or feedback? Visit the [template forum on Railway Central Station](https://station.railway.com/templates/grafana-c0196bc3).


---

[![Airbyte](https://img.shields.io/badge/Airbyte-615EFF?style=for-the-badge&amp;logo=airbyte&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-airbyte) [![Apache Airflow](https://img.shields.io/badge/Apache%20Airflow-017CEE?style=for-the-badge&amp;logo=apacheairflow&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-airflow) [![CloudBeaver](https://img.shields.io/badge/CloudBeaver-382923?style=for-the-badge&amp;logo=dbeaver&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-cloudbeaver-ce) [![CodiMD](https://img.shields.io/badge/CodiMD-0F766E?style=for-the-badge&amp;logo=markdown&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-codimd) [![Django](https://img.shields.io/badge/Django-092E20?style=for-the-badge&amp;logo=django&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-django) [![Email Service](https://img.shields.io/badge/Email%20Service-2563EB?style=for-the-badge&amp;logo=maildotru&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-email) [![FastAPI](https://img.shields.io/badge/FastAPI-009688?style=for-the-badge&amp;logo=fastapi&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-fastapi) [![Flask](https://img.shields.io/badge/Flask-3fad48?style=for-the-badge&amp;logo=flask&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-flask) [![Flowise](https://img.shields.io/badge/Flowise-4F46E5?style=for-the-badge&amp;logo=nodedotjs&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-flowise) [![GitLab CE](https://img.shields.io/badge/GitLab%20CE-FC6D26?style=for-the-badge&amp;logo=gitlab&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-gitlab) [![Grafana](https://img.shields.io/badge/Grafana-F46800?style=for-the-badge&amp;logo=grafana&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-grafana) [![Home Assistant](https://img.shields.io/badge/Home%20Assistant-18BCF2?style=for-the-badge&amp;logo=homeassistant&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-homeassistant) [![InfluxDB](https://img.shields.io/badge/InfluxDB-22ADF6?style=for-the-badge&amp;logo=influxdb&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-influxdb) [![MJML](https://img.shields.io/badge/MJML-F45E43?style=for-the-badge&amp;logo=mjml&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-mjml) [![MongoDB](https://img.shields.io/badge/MongoDB-47A248?style=for-the-badge&amp;logo=mongodb&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-mongodb) [![Mosquitto MQTT](https://img.shields.io/badge/Mosquitto%20MQTT-3C5280?style=for-the-badge&amp;logo=eclipsemosquitto&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-mqtt) [![MySQL](https://img.shields.io/badge/MySQL-4479A1?style=for-the-badge&amp;logo=mysql&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-mysql) [![n8n](https://img.shields.io/badge/n8n-EA4B71?style=for-the-badge&amp;logo=n8n&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-n8n) [![Node.js](https://img.shields.io/badge/Node.js-339933?style=for-the-badge&amp;logo=nodedotjs&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-nodejs) [![Node-RED](https://img.shields.io/badge/Node-RED-8F0000?style=for-the-badge&amp;logo=nodered&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-nodered) [![OpenSearch](https://img.shields.io/badge/OpenSearch-005EB8?style=for-the-badge&amp;logo=opensearch&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-opensearch) [![Open WebUI](https://img.shields.io/badge/Open%20WebUI-D68E42?style=for-the-badge&amp;logo=ollama&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-openwebui) [![Operately](https://img.shields.io/badge/Operately-3185FF?style=for-the-badge&amp;logo=operately&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-operately) [![Outerbase Studio](https://img.shields.io/badge/Outerbase%20Studio-000000?style=for-the-badge&amp;logo=outerbase&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-outerbase-studio) [![PostgreSQL](https://img.shields.io/badge/PostgreSQL-4169E1?style=for-the-badge&amp;logo=postgresql&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-postgresql) [![Redis](https://img.shields.io/badge/Redis-DC382D?style=for-the-badge&amp;logo=redis&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-redis) [![TYPO3 CMS](https://img.shields.io/badge/TYPO3%20CMS-FF8700?style=for-the-badge&amp;logo=typo3&amp;logoColor=white)](https://github.com/vergissberlin/railwayapp-typo3)


## Similar templates

- [Rootprint](https://railway.com/deploy/rootprint-1) — Open-source logs and traces with full-text search on object-storage.
- [VPS Fleet Watch Hub with Beszel](https://railway.com/deploy/vps-fleet-watch-hub-with-beszel) — A persistent Beszel hub for external VPS agents and fleet alerts.
- [Pyroscope profiling](https://railway.com/deploy/pyroscope-profiling) — Protected continuous profiling with durable Pyroscope storage.

Open this page in a browser: https://railway.com/deploy/grafana
