Railway

Deploy Metabase BI

Metabase v0.63 with Postgres 17 on a volume, no H2 data loss

Deploy Metabase BI

Just deployed

Just deployed

/var/lib/postgresql/data

Deploy and Host Metabase on Railway

Metabase is the open-source business intelligence tool: connect a database, then build dashboards, charts, and SQL questions through a browser — no BI license, no per-seat pricing. This template deploys Metabase v0.63 backed by its own PostgreSQL 17 application database on a persistent volume.

About Hosting Metabase

Metabase ships with an embedded H2 database so it can start with zero configuration. That default is the single most common way a self-hosted Metabase is lost: H2 writes to the container filesystem, so on Railway every redeploy discards your dashboards, questions, users, and saved database connections. Metabase's own documentation states H2 is unsuitable for production and offers no supported migration path once data is in it.

This template never touches H2. Metabase is pointed at a dedicated PostgreSQL 17 service over Railway's private network from the first boot, with Postgres storing its data on a mounted volume. MB_ENCRYPTION_SECRET_KEY is generated once at deploy and held stable — that key encrypts the credentials Metabase stores for the databases you connect, so a rotating key would lock you out of your own data sources.

Metabase runs on the JVM and is memory-resident rather than request-scaled; JAVA_OPTS is set to a 2GB heap with the G1 collector, which suits Railway's standard instance. Anonymous usage tracking is disabled.

Why Deploy Metabase 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 Metabase 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.

  • Postgres from the first boot — no H2, so there is no data to lose and no migration to attempt later.
  • Stable encryption key — saved database credentials keep working across restarts and upgrades.
  • Tuned JVM heap — sized for Railway's standard instance instead of leaving the default unset.
  • Private application database — Postgres has no public domain; only Metabase is exposed.
  • No per-seat billing — add as many people to your instance as you like on flat infrastructure cost.

Common Use Cases

  • Product and revenue dashboards — chart signups, retention, and MRR straight from your production replica.
  • Self-serve analytics — let non-engineers answer their own questions with the visual query builder.
  • Scheduled reporting — email or Slack a dashboard digest to stakeholders on a cadence.

Dependencies for Metabase Hosting

  • A PostgreSQL 17 service with a volume mounted at /var/lib/postgresql/data (included in this template).
  • Roughly 2GB RAM for the JVM heap configured here.
  • One or more databases of your own to connect and analyze.

Deployment Dependencies

Implementation Details

Two services on Railway's private network:

ServiceImageVolumePublic
metabasemetabase/metabase:v0.63.1.6none — state lives in Postgresyes
postgrespostgres:17.10-trixie/var/lib/postgresql/datano

Metabase takes a minute or two to run its first-boot migrations. Watch readiness at:

curl https:///api/health

A {"status":"ok"} response means migrations finished and the application database is connected. Then open your public domain to create the admin account and connect your first data source.

The Postgres service here is Metabase's application database — it stores dashboards and settings, not your analytics data. Connect the databases you actually want to query from Admin → Databases once you're in.


Template Content

More templates in this category

View Template
Matomo Analytics + MariaDB
Privacy-friendly analytics with MariaDB and persistent volumes.

leodev
0
View Template
Bugsink
Self-hosted Error Tracking. Sentry-SDK compatible

zǝʇɹoɔ oɓıɹpoɹ
18
View Template
SubTrackr
Self-hosted Subscription Tracker

amnesia
3