Deploy Grafana LGTM

OpenTelemetry backend: Grafana, Loki, Tempo, Prometheus in one service

Deploy Grafana LGTM

Just deployed

Deploy and Host Grafana LGTM on Railway

Deploy on Railway

Grafana LGTM is a complete OpenTelemetry backend in one service: Loki for logs, Grafana for dashboards and exploring, Tempo for traces and Metrics in Prometheus, plus Pyroscope for profiles and an OpenTelemetry Collector in front of them all. Point any OpenTelemetry SDK at it and your traces, logs and metrics show up in Grafana, already linked to each other. This template runs Grafana Labs' official grafana/otel-lgtm image on Railway with a login, an ingest token and a volume.

This is a community template, not made or supported by Grafana Labs.

About Hosting Grafana LGTM

The upstream image is built for laptops: Grafana opens without a password and anyone who can reach the OpenTelemetry ports can write into it. On a public Railway address that won't do, so this template adds:

  • A Grafana login with a generated admin password (GF_SECURITY_ADMIN_PASSWORD); anonymous access and sign-up are off
  • A token for OTLP over the public URL: senders add Authorization: Bearer ‹OTLP_TOKEN›; anything without it gets 401
  • Everything on one volume at /data: dashboards, users, metrics, logs, traces and profiles survive redeploys and upgrades
  • Retention: metrics, logs and traces older than RETENTION_DAYS (7) are deleted, so the volume doesn't fill up
  • A notice page instead of a crash loop when the service has less than 1 GB of memory or a required variable is empty

Send telemetry from anywhere (OTLP over HTTP, which every OpenTelemetry SDK and the Collector speak):

OTEL_EXPORTER_OTLP_ENDPOINT=https://‹your-domain›.up.railway.app
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20‹OTLP_TOKEN›
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_SERVICE_NAME=my-app

From services in the same Railway project, use the private network instead; it needs no token and costs no egress (the address follows the service name; this one is for a service called "Grafana LGTM"):

OTEL_EXPORTER_OTLP_ENDPOINT=http://grafana-lgtm.railway.internal:4318

OTLP over gRPC (port 4317) works on the private network too. It isn't offered on the public address: Railway's public domains carry HTTP, and a TCP proxy would send the token unencrypted.

Then open your Railway URL, sign in as admin with the GF_SECURITY_ADMIN_PASSWORD variable, and use Drilldown (Metrics, Logs, Traces, Profiles) or Explore.

Common Use Cases

  • Traces, logs and metrics for the apps already running in your Railway project, sent over the private network
  • A self-hosted alternative to Grafana Cloud, Datadog or New Relic for a side project or a small team
  • Trying OpenTelemetry instrumentation end to end before choosing a vendor
  • A staging or demo observability stack that matches what production runs

Dependencies for Grafana LGTM Hosting

  • An app instrumented with OpenTelemetry (any language SDK, auto-instrumentation, or an OpenTelemetry Collector)

Deployment Dependencies

Implementation Details

  • Tested on Railway: signing in to Grafana in a browser and through its API; a wrong password, an anonymous visit and a sign-up all refused; OTLP traces, logs and metrics sent with the token over the public URL and read back through Grafana from Tempo, Loki and Prometheus; the same requests without the token or with a wrong one refused with 401; OTLP from another service over the private network with no token; dashboards and telemetry kept across redeploys and an image upgrade; a changed admin password variable applied on redeploy; an empty password or token showing the notice page; 47,600 spans and 47,600 log lines in three minutes at a 1 GB limit with no errors or restarts.
  • Memory: it needs 1 GB. Six servers run in this one container; at rest it uses about 0.7 GB, and under the test load 0.75–0.9 GB. At 0.5 GB (the Free plan's limit) Grafana is killed for memory every half minute, so below about 900 MB the service shows a page saying so instead of starting. On Railway, 1 GB of memory running all month costs about $10. Grafana's other bundled datasources (PostgreSQL, MySQL, Elasticsearch, CloudWatch and others) each start their own process, so they are off by default to save about 250 MB; set GF_PLUGINS_DISABLE_PLUGINS=none to turn them back on.
  • Storage: Railway volumes are 0.5 GB on Free and Trial, 5 GB on Hobby and 50 GB on Pro (Hobby and Pro can grow them). With 7-day retention a small app fits in a few hundred MB. A Railway volume's file cache counts as memory, so the template drops it every 15 minutes.
  • Admin password: GF_SECURITY_ADMIN_PASSWORD is the way in. Changing the variable and redeploying sets the new password; a password you change inside Grafana stays until you change the variable.
  • Variables: any of Grafana's GF_* settings can be added as service variables, for example SMTP for alert emails (GF_SMTP_ENABLED, GF_SMTP_HOST, …).
  • Scale: this is one container with local storage, which Grafana Labs describes as meant for development, demo and testing. It suits small apps and teams; a large production fleet wants Loki, Tempo and Mimir as separate, scaled services.
  • Image: ghcr.io/two-workspaces/grafana-lgtm, built from this repository's Dockerfile on grafana/otel-lgtm:0.41.2 (Grafana 13.3.1, Prometheus 3.16.0, Loki 3.7.10, Tempo 3.1.1, Pyroscope 2.4.4, OpenTelemetry Collector 0.165.0), with Caddy in front.

Why Deploy Grafana LGTM on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Grafana LGTM on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Rootprint
Open-source logs and traces with full-text search on object-storage.

Rootprint
1
View Template
Pyroscope profiling
Protected continuous profiling with durable Pyroscope storage.

Anton Orel
1
View Template
SigOnly
Deploy SigNoz with a working demo app & config in one click

zoeyjones
21