Deploy VictoriaMetrics | (Just Updated) Prometheus Alternative, Login From Boot, Scrape From Env

VictoriaMetrics behind a login. Writes stop before the disk fills

Deploy VictoriaMetrics | (Just Updated) Prometheus Alternative, Login From Boot, Scrape From Env

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 answer 401 without 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.minFreeDiskSpaceBytes to 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_TARGETS to a comma-separated list such as api.railway.internal:3000,worker.railway.internal:9100 and redeploy; no config file to edit. For anything more elaborate, put a full scrape config in VM_SCRAPE_CONFIG.
  • Data survives redeploys. The volume at /victoria-metrics-data is chowned at boot and the database runs as the unprivileged nobody user; samples written before a redeploy were read back after it.
  • Healthcheck on. /health is 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_URL with 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

Implementation Details

VariablePurpose
VM_PASSWORDPassword for the UI and every API route, generated per deploy. The user name is admin (override with VM_USERNAME).
VM_PRIVATE_URLURL on the private network, for Grafana or other services in the project.
SCRAPE_TARGETSOptional. Comma-separated host:port list to scrape.
METRICS_PATHOptional. Path on those targets, default /metrics.
VM_RETENTION_PERIODOptional. Default 12 (months); accepts 30d, 12w, 1y.
MIN_FREE_BYTESOptional. Free space below which writes stop. Default 10% of the volume.
VM_SCRAPE_CONFIGOptional. 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

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
22