---
title: "Deploy Grafana Mimir | (Just Updated) Prometheus Long-Term Storage with Login On, Data Survives Redeploys"
description: "Grafana Mimir: Prometheus remote_write + PromQL metrics store, login on"
category: "Observability"
url: https://railway.com/deploy/grafana-mimir-or-just-updated-prometheus
---

# Deploy Grafana Mimir | (Just Updated) Prometheus Long-Term Storage with Login On, Data Survives Redeploys

Grafana Mimir: Prometheus remote_write + PromQL metrics store, login on

**[Deploy Grafana Mimir | (Just Updated) Prometheus Long-Term Storage with Login On, Data Survives Redeploys on Railway](https://railway.com/template/grafana-mimir-or-just-updated-prometheus)**

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

- **Creator:** SuperSlowSloth
- **Category:** Observability

## Template content

### mimir

- **Image:** ghcr.io/bon5co/grafana-mimir:3.2.4@sha256:8981a4e07121f3bc0e821ae8ffb3aa6e9f4004a02f6a35853c0369a5925ebdf7
- **Health check:** /ready
- **Public domain:** Yes

## Documentation

# Deploy and Host Grafana Mimir on Railway

**Built for an LLM agent to deploy and use.** There is no setup step and nothing to fill in: a 32-character password is generated at deploy time, anonymous requests are refused, and the contract below lists every address, variable name and the one script that proves it works.

Grafana Mimir is an open-source, horizontally scalable long-term store for Prometheus metrics from Grafana Labs. It accepts Prometheus remote write and OpenTelemetry metrics, answers PromQL queries over the Prometheus HTTP API, and is used as the backend for Grafana dashboards and alerting.

## About Hosting Grafana Mimir

This template runs one service, `mimir`, built from the official `grafana/mimir` 3.2.4 image, pinned by digest. Mimir runs in monolithic mode (every component in one process) with block storage on the attached volume, mounted at `/data`, so metrics survive redeploys. A Caddy gateway in the same container listens on the public port and requires HTTP basic auth on every path except `/ready`. Mimir itself listens only on loopback. The entrypoint runs as root only long enough to fix the ownership of the root-owned volume, then starts Mimir and Caddy as unprivileged users. Metrics are kept for 30 days by default; set `MIMIR_RETENTION` (for example `90d`, or `0` to keep forever) and redeploy to change that. Multi-tenancy is off, so no tenant header is needed.

Filesystem storage suits one node and moderate ingest. For a clustered setup, use the object-storage mode from the upstream documentation.

### Agent contract

- Public URL: `MIMIR_PUBLIC_URL` (`https://` plus the service's `RAILWAY_PUBLIC_DOMAIN`).
- Private URL: `http://mimir.railway.internal:8080`, exposed as `MIMIR_PRIVATE_URL`.
- Credentials: user `admin` (set in the image; add a `MIMIR_USERNAME` variable to the service to use another name), password in the `MIMIR_PASSWORD` variable.
- Auth: HTTP basic auth on every path except `/ready`. Anonymous requests and wrong passwords get `401`.
- Health: `GET /ready` returns 200 once the ingester is ready (about 15 seconds after start).
- API: write with Prometheus remote write at `/api/v1/push` or OTLP at `/otlp/v1/metrics`; read with the Prometheus API under `/prometheus/api/v1/` (`query`, `query_range`, `label/__name__/values`).

```bash
# run with MIMIR_PUBLIC_URL and MIMIR_PASSWORD set (MIMIR_USERNAME optional, default admin)
U="${MIMIR_USERNAME:-admin}"
curl -s -o /dev/null -w "anonymous: %{http_code}\n" "$MIMIR_PUBLIC_URL/prometheus/api/v1/query?query=up"
curl -s -o /dev/null -w "bad login: %{http_code}\n" -u "$U:nope" "$MIMIR_PUBLIC_URL/prometheus/api/v1/query?query=up"
NOW=$(date +%s)000000000
curl -s -o /dev/null -w "push: %{http_code}\n" -u "$U:$MIMIR_PASSWORD" -H "Content-Type: application/json" \
  "$MIMIR_PUBLIC_URL/otlp/v1/metrics" \
  -d '{"resourceMetrics":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"agent"}}]},"scopeMetrics":[{"metrics":[{"name":"agent_ping","gauge":{"dataPoints":[{"asDouble":1,"timeUnixNano":"'"$NOW"'"}]}}]}]}]}'
sleep 3
curl -s -u "$U:$MIMIR_PASSWORD" "$MIMIR_PUBLIC_URL/prometheus/api/v1/query?query=agent_ping"
```

A fresh deploy prints `anonymous: 401`, `bad login: 401`, `push: 200`, then a JSON answer with `"status":"success"` whose result holds `agent_ping` with value `1`.

## Why Deploy Grafana Mimir 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 Mimir 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.

- **Agent-ready** - generated password, contract block and one working script; no setup step.
- **Closed by default** - the metrics API is behind basic auth, so an exposed store does not accept or reveal data to strangers.
- **Prometheus and OpenTelemetry in** - remote write and OTLP on the same address, PromQL out.
- **State survives redeploys** - blocks and the write-ahead log live on the attached volume.
- **Light when idle** - about 50 MiB resident with no traffic.

## Common Use Cases

- **Long-term storage for Prometheus** - point `remote_write` at the service and keep metrics beyond local retention.
- **Metrics backend for Grafana** - add it as a Prometheus data source with basic auth.
- **Telemetry sink for apps and agents** - send OpenTelemetry metrics and query them with PromQL.

## Dependencies for Grafana Mimir Hosting

- One Railway volume for metric blocks (created by the template).

### Deployment Dependencies

- [Grafana Mimir documentation](https://grafana.com/docs/mimir/latest/)
- [Official image](https://hub.docker.com/r/grafana/mimir)
- [grafana/mimir](https://github.com/grafana/mimir) - upstream project
- [Caddy](https://caddyserver.com/docs/) - authentication gateway

### Implementation Details

| Variable | Purpose |
| --- | --- |
| `MIMIR_PASSWORD` | Basic-auth password, generated per deploy. |
| `MIMIR_PUBLIC_URL` | HTTPS address for clients outside Railway. |
| `MIMIR_PRIVATE_URL` | Address on the private network, for services in the same project. |

The user is `admin`. To change it, add a `MIMIR_USERNAME` variable to the service (letters, digits, dot, underscore, hyphen) and redeploy. Reference the password from another service with `${{mimir.MIMIR_PASSWORD}}`.


## 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-mimir-or-just-updated-prometheus
