
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
Just deployed
/data
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'sRAILWAY_PUBLIC_DOMAIN). - Private URL:
http://mimir.railway.internal:8080, exposed asMIMIR_PRIVATE_URL. - Credentials: user
admin(set in the image; add aMIMIR_USERNAMEvariable to the service to use another name), password in theMIMIR_PASSWORDvariable. - Auth: HTTP basic auth on every path except
/ready. Anonymous requests and wrong passwords get401. - Health:
GET /readyreturns 200 once the ingester is ready (about 15 seconds after start). - API: write with Prometheus remote write at
/api/v1/pushor OTLP at/otlp/v1/metrics; read with the Prometheus API under/prometheus/api/v1/(query,query_range,label/__name__/values).
# 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_writeat 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
- Official image
- grafana/mimir - upstream project
- Caddy - 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}}.
Template Content

