---
title: "Deploy VictoriaMetrics | (Just Updated) Prometheus Alternative, Login From Boot, Scrape From Env"
description: "VictoriaMetrics behind a login. Writes stop before the disk fills"
category: "Observability"
url: https://railway.com/deploy/victoriametrics-or-just-updated-promethe
---

# 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 on Railway](https://railway.com/template/victoriametrics-or-just-updated-promethe)**

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

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

## Template content

### victoriametrics

- **Image:** ghcr.io/bon5co/victoriametrics-railway:1.153.0
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# 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

- 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.


## Similar templates

- [Rootprint](https://railway.com/deploy/rootprint-1) — Open-source logs and traces with full-text search on object-storage.
- [Pyroscope profiling](https://railway.com/deploy/pyroscope-profiling) — Protected continuous profiling with durable Pyroscope storage.
- [SigOnly](https://railway.com/deploy/sigonly) — Deploy SigNoz with a working demo app & config in one click

Open this page in a browser: https://railway.com/deploy/victoriametrics-or-just-updated-promethe
