
Deploy VictoriaMetrics | (Just Updated) Prometheus Alternative, Login From Boot, Scrape From Env
VictoriaMetrics behind a login. Writes stop before the disk fills
victoriametrics
Just deployed
/victoria-metrics-data
Deploy and Host VictoriaMetrics on Railway
VictoriaMetrics is a fast, resource-light time-series database that speaks the Prometheus query language (PromQL/MetricsQL) and accepts Prometheus remote write, InfluxDB, Graphite and OpenTelemetry data. Grafana, vmagent and most Prometheus tooling talk to it directly.
This template runs single-node VictoriaMetrics 1.153 from a thin wrapper around the official image:
the HTTP API and built-in UI on a Railway public domain, a Railway volume holding the data, and a
generated password in front of every route except /health.
About Hosting VictoriaMetrics
- It is behind a login from the first request. A password is generated per deploy
(
VM_PASSWORD) and passed to VictoriaMetrics' own basic auth, so the query, import and admin APIs answer401without it. The container refuses to start if the password is missing. - Writes stop before the volume fills. The entrypoint reads the real size of the volume at boot
and sets
-storage.minFreeDiskSpaceBytesto 10% of it, so a runaway ingest turns the database read-only instead of filling the disk to zero. - Scrape targets come from variables. Set
SCRAPE_TARGETSto a comma-separated list such asapi.railway.internal:3000,worker.railway.internal:9100and redeploy; no config file to edit. For anything more elaborate, put a full scrape config inVM_SCRAPE_CONFIG. - Data survives redeploys. The volume at
/victoria-metrics-datais chowned at boot and the database runs as the unprivilegednobodyuser; samples written before a redeploy were read back after it. - Healthcheck on.
/healthis the one open route, so Railway can tell a started container from a working one.
Common Use Cases
- Long-term, low-memory storage for the metrics of the other services in your Railway project
- A Prometheus remote-write target (
/api/v1/write) for Prometheus, Grafana Alloy or vmagent - A Grafana data source (use
VM_PRIVATE_URLwith basic auth) - A cheaper home for high-cardinality metrics than a Prometheus with a large RAM footprint
Dependencies for VictoriaMetrics Hosting
- One Railway volume for the time-series data (created by the template)
Deployment Dependencies
- VictoriaMetrics documentation: https://docs.victoriametrics.com
- Single-node flags: https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/
- Official image: https://hub.docker.com/r/victoriametrics/victoria-metrics
- Wrapper source: https://github.com/bon5co/victoriametrics-railway
Implementation Details
| Variable | Purpose |
|---|---|
VM_PASSWORD | Password for the UI and every API route, generated per deploy. The user name is admin (override with VM_USERNAME). |
VM_PRIVATE_URL | URL on the private network, for Grafana or other services in the project. |
SCRAPE_TARGETS | Optional. Comma-separated host:port list to scrape. |
METRICS_PATH | Optional. Path on those targets, default /metrics. |
VM_RETENTION_PERIOD | Optional. Default 12 (months); accepts 30d, 12w, 1y. |
MIN_FREE_BYTES | Optional. Free space below which writes stop. Default 10% of the volume. |
VM_SCRAPE_CONFIG | Optional. A complete Prometheus-format scrape config, replaces the generated one. |
Why Deploy VictoriaMetrics 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 VictoriaMetrics 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
victoriametrics
ghcr.io/bon5co/victoriametrics-railway:1.153.0
