Deploy Prometheus | Open Source Monitoring, Datadog Alternative on Railway
Self host Prometheus. Time-series metrics, alerting, PromQL & more
Prometheus
Just deployed
/prometheus

Deploy and Host Prometheus on Railway
Prometheus is the de-facto open source monitoring system and time-series database — it scrapes metrics from your services, stores them locally with high compression, and lets you query and alert on them via PromQL. Self-host Prometheus on Railway to keep application, infrastructure, and Kubernetes metrics in your own environment without per-host SaaS fees.
The template wraps prom/prometheus:v3.11.3 (custom Dockerfile at praveen-ks-2001/prometheus-railway) with bcrypt-hashed HTTP basic auth, an auto-generated default prometheus.yml, and a persistent /prometheus volume. Web UI, /metrics, /api/v1/*, and health endpoints are all protected — safe on the public internet.
Getting Started with Prometheus on Railway
After deploy, open the Railway domain — your browser prompts for HTTP basic auth. Log in with ADMIN_USER / ADMIN_PASSWORD from the Variables tab. The default config self-scrapes Prometheus on localhost:9090, so the UI is immediately useful: open Status -> Targets to confirm scrape health, then run a query like up from the Graph tab. To monitor your own services, write a prometheus.yml, base64-encode it (base64 -w0 prometheus.yml), paste into PROMETHEUS_CONFIG_B64, and redeploy.

About Hosting Prometheus
Prometheus is a CNCF graduated project originally built at SoundCloud. It pulls metrics over HTTP from instrumented targets (apps, exporters, Kubernetes pods), stores them in a local TSDB, and exposes PromQL for ad-hoc analysis, dashboards, and alert evaluation.
Key features of self-hosted Prometheus on Railway:
- Pull-based scraping with service discovery (static, DNS, file_sd)
- PromQL — vectorised queries with rate, histogram, aggregation operators
- Built-in TSDB, ~1KB per active series
- Recording and alerting rules (Alertmanager-compatible)
- Toggleable remote-write receiver and admin API
- HTTP basic auth on every endpoint by default
Why Deploy Prometheus on Railway
- One-click deploy with
/prometheusvolume mounted automatically - Public HTTPS domain auto-issued, basic auth from first boot
- Drop-in
prometheus.ymlvia base64 env var — no SSH needed - Vertical scaling as active series grow
- Pay only for the compute and storage you use
- Private networking to scrape Railway services over
*.railway.internal
Common Use Cases for Self-Hosted Prometheus
- Scrape Kubernetes clusters, Node Exporter, cAdvisor, and your own
/metricsendpoints - Pair with Grafana for dashboards (Grafana data source with basic auth)
- PromQL alerts evaluated on a schedule, fired to Alertmanager / Slack / PagerDuty
- Ingest from edge agents (Grafana Agent, OpenTelemetry Collector, Vector) via remote_write
- Replace Datadog/New Relic for metric pipelines without per-host billing
Dependencies for Prometheus on Railway
- Prometheus — built on
prom/prometheus:v3.11.3, repackaged via custom Dockerfile at praveen-ks-2001/prometheus-railway. Multi-stage build copies the static Prometheus binary ontopython:3.12-slimfor entrypoint scripting andbcryptpassword hashing.
Environment Variables Reference
| Variable | Default | Purpose |
|---|---|---|
ADMIN_USER | admin | Basic-auth username for UI and API |
ADMIN_PASSWORD | ${{secret(32)}} | Basic-auth password (bcrypt-hashed) |
PROMETHEUS_RETENTION_TIME | 15d | TSDB retention window |
PROMETHEUS_RETENTION_SIZE | 0 | Max TSDB size (0 = uncapped) |
PROMETHEUS_SCRAPE_INTERVAL | 15s | Default scrape interval |
PROMETHEUS_EVALUATION_INTERVAL | 15s | Default rule evaluation interval |
PROMETHEUS_LOG_LEVEL | info | debug, info, warn, error |
PROMETHEUS_ENABLE_ADMIN_API | false | Enable snapshot/delete API |
PROMETHEUS_ENABLE_REMOTE_WRITE_RECEIVER | false | Accept remote_write |
PROMETHEUS_CONFIG_B64 | (empty) | Base64 prometheus.yml override |
Deployment Dependencies for Prometheus on Railway
- Runtime: Go binary from
prom/prometheus:v3.11.3 - Source: github.com/prometheus/prometheus
- Docker Hub: prom/prometheus
- Custom wrapper: github.com/praveen-ks-2001/prometheus-railway
- Docs: prometheus.io/docs
Hardware Requirements for Self-Hosting Prometheus
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 0.5 vCPU | 1–2 vCPU |
| RAM | 512 MB | 2 GB (~1KB per active series) |
| Storage | 1 GB volume | 5–20 GB |
| Runtime | Go 1.22 (bundled) | Go 1.22 (bundled) |
512 MB handles a few thousand series. Heavy Kubernetes fleets with millions of active series should plan ~1KB/series plus query headroom.
Self-Hosting Prometheus with Docker
The plain prom/prometheus image runs out of the box but has no auth — this template wraps it with basic auth for production. The simplest local equivalent:
docker run -d --name prometheus -p 9090:9090 \
-v prometheus_data:/prometheus \
prom/prometheus:v3.11.3
To use a custom scrape config on Railway, write the YAML below, run base64 -w0 prometheus.yml, paste into PROMETHEUS_CONFIG_B64, and redeploy:
global:
scrape_interval: 15s
scrape_configs:
- job_name: my-app
static_configs:
- targets: ['my-app.railway.internal:8080']
The entrypoint decodes the config on every boot — no rebuild needed.
How Much Does Prometheus Cost to Self-Host?
Prometheus is 100% free under Apache 2.0 — no enterprise tier, no per-host fees, no metric ingestion limits. The only costs are infrastructure and engineering time. On Railway, expect a few dollars a month for a 512 MB / 1 GB volume instance scraping a handful of services. Compare to Grafana Cloud's metered pricing (~$6.50 per 1K active series after the free tier) or Datadog's $15+ per host per month.
Prometheus vs Datadog vs Grafana Cloud vs VictoriaMetrics
| Prometheus (self-hosted) | Datadog | Grafana Cloud | VictoriaMetrics | |
|---|---|---|---|---|
| License | Apache 2.0 | Proprietary SaaS | Proprietary SaaS | Apache 2.0 |
| Pricing | Infra only | Per host + ingest | Per active series | Infra only |
| PromQL | Native | Compatible | Native (Mimir) | Native |
| Best for | Owning your stack | All-in-one APM | Managed Prom + Loki | High-cardinality |
Self-hosted Prometheus wins on control, predictable cost, and PromQL-native pipelines. Pair with Grafana for dashboards and Alertmanager for routing.
FAQ
What is Prometheus and why self-host it? Prometheus is an open-source metrics database and monitoring system. Self-hosting on Railway keeps your metrics in your own environment, avoids per-host SaaS fees, and gives you full control over retention and scrape configs.
What does this Railway template deploy?
A single Prometheus service running prom/prometheus:v3.11.3 behind HTTP basic auth, with a /prometheus volume for TSDB persistence and a base64 env var (PROMETHEUS_CONFIG_B64) to drop in your own scrape config.
Why does this Prometheus template require a persistent volume?
The TSDB writes blocks to /prometheus every two hours and compacts older blocks. Without a volume, every redeploy wipes your historical metrics.
How do I add custom scrape targets to self-hosted Prometheus on Railway?
Write a prometheus.yml, run base64 -w0 prometheus.yml, paste the output into PROMETHEUS_CONFIG_B64, and redeploy. The entrypoint decodes the config and starts Prometheus with it.
How do I connect Grafana to self-hosted Prometheus on Railway?
In Grafana, add a Prometheus data source pointing at https://, set auth type to Basic auth, and enter ADMIN_USER / ADMIN_PASSWORD. PromQL works identically to a local Prometheus.
Template Content
Prometheus
praveen-ks-2001/prometheus-railwayADMIN_USER
Basic-auth username
ADMIN_PASSWORD
Basic-auth password (bcrypt-hashed)
