Deploy Metabase

Metabase BI dashboards on a private Postgres, admin set at deploy

Deploy Metabase

Deploy and Host Metabase on Railway

Metabase (AGPL-3.0) is an open-source business intelligence tool: connect your databases, ask questions with a query builder or SQL, and share dashboards with your team.

This template runs the official Metabase image (v0.65.6) with its own Postgres on Railway's private network, and the admin account set at deploy.

About Hosting Metabase

A new Metabase shows a setup wizard to whoever opens it first, and that person becomes the admin. On a public URL that could be anyone. Here the deploy form asks for your email, a password is generated into MB_ADMIN_PASSWORD, and a start step completes the setup from inside the container as soon as Metabase answers. Metabase then stops offering the setup token, so nobody can claim the instance after you. Open METABASE_URL and sign in.

Metabase keeps its own data (users, questions, dashboards) in Postgres instead of its built-in H2 file, which Metabase's docs say not to use in production. The credentials of the databases you connect are encrypted with MB_ENCRYPTION_SECRET_KEY, generated per deploy; keep it, because Metabase can't read those credentials without it.

Before publishing I tested it on Railway. By the time the public URL answered, Metabase reported the setup as done and exposed no setup token, and the API returned 401 without a session. The admin signed in, I connected the template's Postgres as a data source, ran SELECT 6 * 7 through Metabase (it returned 42) and saved it as a question. After restarting Metabase and Postgres, the admin signed in again and the saved question still ran.

Metabase is a Java app and needs memory: with the template's heap limit (JAVA_OPTS=-Xmx1536m) it used about 2.1 GB of RAM and Postgres 0.3 GB, roughly $24 a month on Railway's usage pricing. A trial account's 1 GB limit is too small (I watched it get killed on startup), so this needs a Hobby plan or higher. Two things need setup after the deploy: email subscriptions and alerts, because Railway blocks outbound SMTP below the Pro plan (Slack delivery works), and Metabase's AI features, which need an LLM provider set up under Admin settings. Until then Metabase logs an error about a missing "anthropic" connection, which is harmless.

Common Use Cases

  • Dashboards on your production database for a team that doesn't write SQL
  • Self-serve reporting for a small company, with permissions per group
  • Embedding charts in your own app (static embedding is in the open-source edition)

Dependencies for Metabase Hosting

A database to analyze: Postgres, MySQL, BigQuery, Snowflake, ClickHouse and many more. If it runs on Railway, connect it over the private network.

Deployment Dependencies

Implementation Details

METABASE_URL                        # open this
MB_ADMIN_EMAIL / MB_ADMIN_PASSWORD  # admin account, created on the first start
MB_DB_*                             # Metabase's own data in Postgres over the private network
MB_ENCRYPTION_SECRET_KEY            # encrypts connected databases' credentials; keep it
JAVA_OPTS=-Xmx1536m                 # raise for many users or big queries

If you add a custom domain, set MB_SITE_URL to it so links in Metabase point there.

Why Deploy Metabase on Railway?

Your dashboards sit next to the databases they read, on Railway's private network, with the admin account claimed before the URL goes public. Railway bills the RAM Metabase uses, so you can raise the heap when your team grows.


Template Content

More templates in this category

View Template
Plausible WordPress
Cookie-free WordPress stats from your own Plausible

onepush
0
View Template
Typesense Multilingual
Locale-aware multilingual search with Typesense

onepush
0
View Template
Formbricks
Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

Two Workspaces
3