Deploy Metabase [Updated Sep'26]

Self-host Metabase — dashboards, SQL, unlimited users, Postgres app DB

Deploy Metabase [Updated Sep'26]

Just deployed

/var/lib/postgresql/data

Deploy and Host Metabase on Railway

Metabase

Metabase is the open-source business intelligence tool for teams where answering a data question shouldn't require a SQL person — a self-hosted alternative to Tableau, Looker and Mode. Point it at your warehouse and non-technical people build dashboards in a query builder, while analysts drop into raw SQL in the same interface. This template pairs the official image with a Postgres application database wired at deploy time — the difference between dashboards that survive a redeploy and dashboards that don't.

What This Template Deploys

ServicePurpose
metabaseWeb UI and API on port 3000, health-checked at /api/health. Public HTTPS domain.
PostgresApplication database: users, dashboards, saved questions, collections, permissions. Volume attached.

The two talk over Railway's private network. Note what that Postgres is not: it holds Metabase's own metadata, not your analytics data. The databases you query are connected after first login through the admin UI and can live anywhere.

About Hosting

Metabase deploys easily and disappoints later. The traps below are mostly discovered after you have built something worth losing.

Embedding branded dashboards in your product is a paid feature. Open-source Metabase is AGPL-3.0 with unlimited users, dashboards and questions, and signed static embeds work — but white-labelling and full-app embedding are Enterprise. If the plan is customer-facing analytics under your own logo, price that in first, because self-hosting does not unlock it. For internal BI the open-source edition is complete.

The default H2 database throws your work away. Without MB_DB_TYPE=postgres, Metabase writes to an embedded H2 file inside the container, and every redeploy replaces it. Worse is the recovery path: switching to Postgres later gives you an empty Metabase, because the dashboards sit in an H2 file the new config never reads. Getting them out needs Metabase's load-from-h2 command. Start on Postgres and the problem never exists.

First boot runs migrations and can trip your health check. Metabase applies its schema on first start, taking one to two minutes. A short health-check timeout kills the container mid-migration, the next attempt restarts it, and you get a restart loop that looks like a broken image. Give the check room and watch the logs for initialization completing.

512 MB is not enough, whatever you have read. Metabase is a JVM application and its own documentation puts the floor at 1 GB, 2 GB for comfort. Under-provision it and the first aggregation over a real table gets the process OOM-killed — which surfaces as a dropped browser connection, not an obvious memory error.

MB_ENCRYPTION_SECRET_KEY must be set on day one and never changed. It encrypts the warehouse credentials stored in the application database. Change it and every saved connection becomes undecryptable; skip it entirely and adding it later invalidates the same credentials. Set it once at deploy and leave it alone.

Typical cost: ~$15–25/month for Metabase with 1–2 GB of RAM plus a small Postgres, at $10/GB/month RAM, $20/vCPU/month CPU and $0.15/GB/month volumes. Metabase Open Source is free with no seat count.

How It Compares

Metabase (self-hosted)TableauLookerSuperset
Cost modelFlat infrastructurePer seatPer seat, enterprise contractFlat infrastructure
Non-SQL query buildingStrongStrongVia LookML modellingWeak
Self-hostableYesNoNoYes

The honest edge: Superset is more permissive on embedding and costs nothing to white-label, so if branded customer-facing analytics is the goal, start there. Looker's modelling layer buys governed metric definitions Metabase has no real answer to. Metabase wins on what most teams actually need — a non-technical person answering their own question in an afternoon — and on escaping per-seat pricing entirely.

Deploy in Under 5 Minutes

  1. Click Deploy and pick a workspace. Metabase and Postgres come up with MB_DB_TYPE=postgres and the connection variables already referenced.
  2. Wait for first-boot migrations. Expect one to two minutes, and watch the logs for initialization completing before assuming anything is wrong.
  3. Open the public domain and complete the setup wizard to create the admin account.
  4. Go to Admin → Databases and connect the warehouse you actually want to query.
  5. Build one question, save it to a dashboard, and share the link to confirm MB_SITE_URL resolves correctly.

Verify before you rely on it: redeploy the Metabase service and check your saved question is still there. If it is gone, Metabase is running on H2 and nothing you build will survive.

Common Use Cases

  • Self-service dashboards — let ops, sales and support answer their own questions instead of queueing data requests.
  • Scheduled reporting and alerts — email or Slack a dashboard on a schedule, or alert when a metric crosses a threshold.
  • Replacing per-seat BI — move a team off Tableau or Mode seat licensing onto flat infrastructure, unlimited users.

Configuration

VariableRequiredDescription
MB_DB_TYPERequiredpostgres. Anything else falls back to ephemeral H2.
MB_DB_HOST, MB_DB_PORT, MB_DB_DBNAMEAutoReference variables pointing at the private Postgres hostname.
MB_DB_USER, MB_DB_PASSAutoApplication database credentials, referenced from Postgres.
MB_ENCRYPTION_SECRET_KEYGeneratedEncrypts stored warehouse credentials. Set once, never rotate.
MB_SITE_URLRequiredPublic HTTPS domain. Share links, embeds and email alerts are built from it.
MB_JETTY_PORTPre-set3000. Metabase ignores Railway's injected PORT.

Never change MB_ENCRYPTION_SECRET_KEY on a running instance. Every saved database connection is encrypted with it, and rotating it means re-entering every warehouse credential by hand.

The Postgres service needs its own volume. Moving off H2 solves nothing if the application database itself is ephemeral — check the volume is attached before you build anything.

Dependencies for Metabase Hosting

  • Railway account — ~$15–25/month for Metabase at 1–2 GB RAM plus a small Postgres application database.
  • Bundled services — Postgres for application metadata, provisioned and wired by the template. No volume on Metabase; it is stateless once the app DB is external.
  • Volume — on Postgres only, holding everything Metabase saves.
  • Optional — SMTP for scheduled reports and alerts, Slack for notifications, and your own analytics databases connected after first login.

Deployment Dependencies

Implementation Details

The application runs the official metabase/metabase image on a pinned tag rather than latest, listening on 3000 with /api/health as the health-check target. Railway's injected PORT is deliberately not relied on, because Metabase reads MB_JETTY_PORT — a mismatch produces a container that starts cleanly then fails every health check. Postgres is reached by private hostname through reference variables, so credentials are never typed by hand.

Metabase holds no state once the application database is external, which is why it carries no volume and Postgres does. Everything you create — users, permissions, collections, saved questions, dashboards, alert schedules — lives in that Postgres. Protect it, and treat the Metabase container as replaceable, because it is.

For backups, a scheduled pg_dump of the application database captures every dashboard and saved question, and restoring it into a fresh Metabase of the same version brings everything back. Store MB_ENCRYPTION_SECRET_KEY alongside that dump: a restored database without the matching key is full of connections nobody can decrypt.

Frequently Asked Questions

Why did my dashboards disappear after a redeploy? Metabase was running on embedded H2 inside the container. Confirm MB_DB_TYPE=postgres is set and the Postgres service has a volume.

Can I embed dashboards in my own product? Signed static embeds, yes, in the open-source edition. Removing Metabase branding and full-app embedding are Enterprise features and are not available by self-hosting.

How much RAM does it need? At least 1 GB, 2 GB for comfortable use. Metabase is a JVM application and under-provisioning shows up as queries failing rather than as a clear memory error.

Is the bundled Postgres where my data goes? No. It stores Metabase's own metadata. Your analytics databases are connected separately through Admin → Databases and can live anywhere.

Is Metabase really free? The open-source edition is AGPL-3.0 with unlimited users, dashboards and questions. Paid tiers add white-label embedding, SSO, granular permissions and support.

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 get a BI instance configured the way the documentation actually recommends — Postgres as the application database from the first boot, an encryption key set before any credential is saved, a health check that survives first-boot migrations, and enough memory to run a real query.


Template Content

More templates in this category

View Template
Typesense vs Meilisearch
self-hosted Typesense vs Meilisearch

onepush
0
View Template
Betterlytics
Betterlytics is a cookieless analytics platform GDPR-compliant.

OpenSource Templates
27
View Template
Finance Tracker
Private multi-user household finance ledger with budgets and CSV import.

wotonews
0