Railway

Deploy Prometheus | Open Source Monitoring, Datadog Alternative on Railway

Self host Prometheus. Time-series metrics, alerting, PromQL & more

Deploy Prometheus | Open Source Monitoring, Datadog Alternative on Railway

Just deployed

/prometheus

Prometheus logo

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.

Prometheus dashboard screenshot

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 /prometheus volume mounted automatically
  • Public HTTPS domain auto-issued, basic auth from first boot
  • Drop-in prometheus.yml via 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 /metrics endpoints
  • 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 onto python:3.12-slim for entrypoint scripting and bcrypt password hashing.

Environment Variables Reference

VariableDefaultPurpose
ADMIN_USERadminBasic-auth username for UI and API
ADMIN_PASSWORD${{secret(32)}}Basic-auth password (bcrypt-hashed)
PROMETHEUS_RETENTION_TIME15dTSDB retention window
PROMETHEUS_RETENTION_SIZE0Max TSDB size (0 = uncapped)
PROMETHEUS_SCRAPE_INTERVAL15sDefault scrape interval
PROMETHEUS_EVALUATION_INTERVAL15sDefault rule evaluation interval
PROMETHEUS_LOG_LEVELinfodebug, info, warn, error
PROMETHEUS_ENABLE_ADMIN_APIfalseEnable snapshot/delete API
PROMETHEUS_ENABLE_REMOTE_WRITE_RECEIVERfalseAccept remote_write
PROMETHEUS_CONFIG_B64(empty)Base64 prometheus.yml override

Deployment Dependencies for Prometheus on Railway

Hardware Requirements for Self-Hosting Prometheus

ResourceMinimumRecommended
CPU0.5 vCPU1–2 vCPU
RAM512 MB2 GB (~1KB per active series)
Storage1 GB volume5–20 GB
RuntimeGo 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)DatadogGrafana CloudVictoriaMetrics
LicenseApache 2.0Proprietary SaaSProprietary SaaSApache 2.0
PricingInfra onlyPer host + ingestPer active seriesInfra only
PromQLNativeCompatibleNative (Mimir)Native
Best forOwning your stackAll-in-one APMManaged Prom + LokiHigh-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

More templates in this category

View Template
SigOnly
Deploy SigNoz with a working demo app & config in one click

zoeyjones
View Template
NEW
Unwrapped Spotify Music Stats
Unwrapped Spotify Music Stats, Estatísticas de músicas disponíveis

Jorge Henrique
View Template
OpenTelemetry Collector and Backend
OpenTelemetry Collector with Backend Stack

Melissa