Deploy Grafana Loki

Grafana Loki 3.7 log aggregation with volume storage and auth gateway.

Deploy Grafana Loki

Just deployed

Just deployed

/loki

Deploy and Host Grafana Loki on Railway

Grafana Loki is a horizontally scalable, cost-efficient log aggregation system inspired by Prometheus. It indexes only labels, not full text, and stores compressed log chunks, so it is cheap to run. Logs are pushed by Grafana Alloy, Promtail, Fluent Bit, Vector or OpenTelemetry and queried with LogQL in Grafana.

About Hosting Grafana Loki

This template deploys Loki v3.7.8 in single-binary mode with filesystem storage on a Railway volume, plus a Caddy gateway that is the only public entry point. The gateway has two logins: push for shipping logs and admin for queries from Grafana; each works only on its own routes. Logs are kept for 14 days by the compactor, and usage reporting is off. Loki itself stays private and runs as root so it can write to the volume. Watch the volume size on the Hobby plan, since storage grows with log volume.

Common Use Cases

  • Centralized logs for apps and services running on Railway and elsewhere
  • LogQL queries and alerts in Grafana next to metrics and traces
  • A low-cost self-hosted alternative to hosted log platforms

Dependencies for Grafana Loki Hosting

  • grafana/loki:3.7.8 (official image) with a volume at /loki
  • caddy:2.11.4-alpine (official image) as the authenticated gateway

Deployment Dependencies

Implementation Details

ServiceImageNetworkingStorage
lokigrafana/loki:3.7.8private only, port 3100volume at /loki
gatewaycaddy:2.11.4-alpinepublic domain on 8080none

Push (Alloy / Promtail / Fluent Bit) to https:///loki/api/v1/push with basic auth push:; OTLP logs go to /otlp/v1/logs. In Grafana, add a Loki data source with URL https:// and basic auth admin:, or ${{loki.LOKI_PRIVATE_URL}} from inside the project.

VariableServiceDefaultPurpose
LOKI_PUSH_USERNAME / _PASSWORDgatewaypush / generatedLog shipping credentials
LOKI_QUERY_USERNAME / _PASSWORDgatewayadmin / generatedQuery credentials
CADDYFILEgatewaygateway configRouting and auth

Notes:

  • Retention (-store.retention=14d) and compaction are set in the Loki start command; change the value there.
  • Loki has no authentication of its own, which is why it stays private behind the gateway.

This is a community-maintained deployment package and does not imply affiliation with or endorsement by the Grafana Loki project or its maintainers.

Why Deploy Grafana Loki 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 Loki 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
NEW
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
22