Deploy Prometheus

Prometheus 3.16 metrics database with login, volume storage and OTLP

Deploy Prometheus

/prometheus

Deploy and Host Prometheus on Railway

Prometheus is an open-source monitoring system and time-series database from the Cloud Native Computing Foundation. It scrapes metrics from your services over HTTP, stores them efficiently, and lets you query them with PromQL. Grafana and many other tools use it as their metrics source, and it can evaluate alerting rules.

About Hosting Prometheus

This template deploys Prometheus v3.16.0 from the official image, built from a public GitHub repo so Railway can offer you updates. Prometheus has no login of its own, so a small Caddy gateway in the same container asks for a username and a password generated at deploy time on the web UI and every API path. Only the health checks stay open. Data and the editable prometheus.yml live on a Railway volume at /prometheus and survive redeploys. Samples are kept for 15 days by default. Apps can push metrics through the remote-write and OTLP receivers, or Prometheus can scrape services over Railway's private network.

Common Use Cases

  • Collecting and graphing metrics from the apps, databases and exporters in your Railway projects
  • A Prometheus data source for Grafana dashboards and alerting
  • Receiving metrics pushed by OpenTelemetry SDKs, Grafana Alloy or other Prometheus servers through remote write

Dependencies for Prometheus Hosting

  • The official prom/prometheus:v3.16.0 image, pinned by digest, with a Caddy 2.11.9 login gateway
  • A Railway volume mounted at /prometheus

Deployment Dependencies

Implementation Details

Sign in at your Railway domain with the user admin and the PROMETHEUS_PASSWORD value from the service's Variables tab.

Scrape targets. On first boot the default configuration is copied to /prometheus/config/prometheus.yml; it scrapes Prometheus itself. To add targets, set a PROMETHEUS_CONFIG variable to a complete prometheus.yml (it replaces the file at every start), or edit the file with railway ssh and redeploy. Services in the same project are reachable as SERVICE-NAME.railway.internal:PORT.

Push metrics (basic auth with the same login):

  • Remote write: https://YOUR-DOMAIN/api/v1/write
  • OTLP over HTTP: https://YOUR-DOMAIN/api/v1/otlp/v1/metrics

Grafana. Add a Prometheus data source with the URL ${{prometheus.PROMETHEUS_PRIVATE_URL}} and basic auth with the same user and password.

VariableDefaultPurpose
PROMETHEUS_USERNAMEadminLogin user
PROMETHEUS_PASSWORDgeneratedLogin password; Prometheus won't start without one
PROMETHEUS_RETENTION15dHow long samples are kept
PROMETHEUS_RETENTION_SIZEnot setOptional size limit such as 4GB; keep it below the volume size
PROMETHEUS_EXTRA_ARGSnot setOptional extra Prometheus flags

Updates to the template repo reach you as an "update available" notice on Railway; read the repo's CHANGELOG before applying one.

Why Deploy Prometheus 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 Prometheus 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
21