---
title: "Deploy Metabase App DB"
description: "Postgres app DB, not H2, for production Metabase"
category: "Analytics"
url: https://railway.com/deploy/metabase-app-db
---

# Deploy Metabase App DB

Postgres app DB, not H2, for production Metabase

**[Deploy Metabase App DB on Railway](https://railway.com/template/metabase-app-db)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/metabase-app-db/manifest.json

- **Creator:** onepush
- **Category:** Analytics

## Template content

### metabase/metabase

- **Image:** metabase/metabase
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

## Documentation

# Deploy and Host self hosted Metabase App DB (Postgres App Database) on Railway

Metabase ships with H2 for internal state—fine on a laptop, dangerous in a container. Railway redeploys wipe that file. This template pins the Metabase application database to Postgres so users, dashboards, and settings survive every deploy.

## About Hosting Metabase App DB open-source software on Railway (self hosted Metabase template)

Metabase has two database relationships. The app DB stores its own brain: users, permissions, saved questions, dashboard layouts, settings. Analytics databases are separate, connected after setup through Admin → Databases. This template handles only the app DB: the metabase/metabase image wired to companion Postgres via MB_DB_* variables.

H2 fails because Metabase keeps it as an embedded file on the container filesystem. Railway containers are ephemeral; a rebuild, restart, or image tag change deletes it. Postgres gives transactional migrations, backups, replication, and room to grow.

## Why Deploy Metabase App DB, the Metabase Cloud alternative on Railway (Railway Free Trial)

Metabase Cloud Starter starts around $85/month plus per-user, climbing fast for SSO or row-level permissions. Self-hosting OSS is AGPL—you own the box, control data, pay compute. For a 10-person internal team, a Railway Hobby stack with Postgres costs a small fraction of that.

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 App DB 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.

### Railway vs Other Hosting Providers and VPS for Metabase App DB self hosting

Railway gives a private network between Metabase and Postgres, so MB_DB_* variables point at the right host without firewall edits.

| Provider | Metabase App DB fit | Postgres handling | Operational burden | Notes |
|---|---|---|---|---|
| Railway | Strong | Postgres on the same private network | Low | Private DNS, GitHub deploys |
| DigitalOcean | Good | Managed Postgres, you wire networking | Medium | Droplet + managed DB |
| AWS | Heavy | RDS is solid; IAM, VPC, security groups eat time | High | Worth it if you already live in AWS |
| Hetzner | Cheap but manual | You run Postgres yourself, backups and updates | High | Best raw price, worst onboarding |

## Common Use Cases for hosted Metabase App DB

Small product teams use it for shared dashboards without a BI vendor contract. Someone on ops deploys Metabase with Postgres on Railway and adds the product Postgres or Redshift as an analytics source. Because the app DB is Postgres, redeploys never touch saved work.

Solo operators use it as a portable BI brain: dump the Postgres app DB, restore it elsewhere with the same MB_ENCRYPTION_SECRET_KEY, and every dashboard comes back.

## Dependencies for Metabase App DB Docker hosted on Railway

Core dependency: official image metabase/metabase (pin a tag like v0.63.x, not latest). Metabase listens on port 3000 and exposes health check at GET /api/health, used for deployment status and restarts.

Postgres is the second dependency, not optional. H2 gets wiped on redeploy. Use ghcr.io/railwayapp-templates/postgres-ssl (Postgres 17 fine).

### Deployment Dependencies for Managed Metabase App DB Service (Business Intelligence)

Set MB_DB_TYPE=postgres. Wire MB_DB_HOST and MB_DB_PORT to the Postgres service's internal Railway hostname and port, plus MB_DB_USER, MB_DB_PASS, MB_DB_DBNAME. Use Railway variable references, not IPs.

MB_ENCRYPTION_SECRET_KEY encrypts settings like SMTP passwords and source credentials. Change it between deploys and encrypted settings break. Generate once, pin it. MB_SITE_URL should be the public HTTPS URL for email links, embeds, and webhooks.

### Implementation Details for Metabase App DB (Using Metabase official docker image)

First boot runs Metabase migrations against Postgres, creating schema tables and indexes. Give /api/health a moment; a cold migration on a small Postgres can take a minute or so. Then the setup wizard asks for the admin user.

After first boot, connect analytics databases such as Postgres, MySQL, BigQuery, or Snowflake through Admin → Databases.

## How does Metabase App DB compare against other self-hosted BI app database platforms

Every self-hosted BI tool has an internal state layer. Metabase's is small and easy to get wrong by leaving it on H2.

### Metabase App DB vs Metabase Cloud (Metabase Cloud Alternative)

Self-hosting gives you control of backups, migrations, and the schema itself, while Cloud hides the app DB from you. Cloud wins on zero-ops, especially for SSO-heavy teams. Self-hosting wins on cost at small scale and on data residency.

### Metabase App DB vs Apache Superset (Apache Superset Alternative)

Superset keeps its metadata in a larger SQLAlchemy-managed Postgres or MySQL schema: charts, datasets, SQL Lab state, security rules. You get more chart types and a heavier setup. Metabase's app DB is simpler to back up and reason about.

### Metabase App DB vs Redash (Redash Alternative)

Redash also stores queries, dashboards, and users in Postgres, with a thinner schema. Redash is BSD-licensed and SQL-first; Metabase has the stronger point-and-click query builder.

### Metabase App DB vs Grafana (Grafana Alternative)

Grafana's internal DB is SQLite, MySQL, or Postgres, built for observability. Metabase's app DB holds relational BI metadata such as collections, questions, and permissions, which suits tabular analytics.

## How to use Metabase App DB (the OSS Business Intelligence)?

Once the admin user exists, create collections that mirror your reporting needs, add users, and set group permissions. Every write goes to the Postgres app DB and survives redeploys.

Then connect real data under Admin → Databases → Add database. Non-SQL users get the query builder and analysts get native SQL. Save questions, pin dashboards, and schedule email or Slack subscriptions. Global settings like SMTP, Slack, cache duration, and embedding toggles live in the app DB too, and several are encrypted.

## How to self host Metabase App DB on other VPS Services (Metabase App DB self hosting guide)

Railway is smoothest, but the same pattern works anywhere with Docker and Postgres. Use the official image and same variables.

### Clone the Repository

Skip the clone; the Docker image is all you need.

### Install Dependencies

Docker or Podman, plus a Postgres server you trust (17 is fine). Nothing else. Drivers for BigQuery, Snowflake, and friends ship inside the image.

### Configure Environment Variables

Create a .env or systemd EnvironmentFile with the full MB_DB_* block, MB_ENCRYPTION_SECRET_KEY, and MB_SITE_URL. Point MB_DB_HOST at Postgres, create the database, and let the Metabase user run migrations.

### Start the Metabase App DB Application

Run the container with port 3000 mapped, wait for /api/health to return 200, and open the setup wizard. First boot runs the migrations. Then put it behind a TLS reverse proxy.

## Official Pricing of Metabase App DB (Metabase App DB pricing)

The OSS build is free and AGPL-licensed, with unlimited users, dashboards, and data sources on your own infrastructure. Cloud Starter is around $85/month plus per-user fees; Pro adds SSO, row-level permissions, and interactive embedding. On Railway you pay for compute and the database: a small Metabase plus companion Postgres on Hobby typically runs $5–15/month.

## Metabase App DB cloud vs self hosted comparison (Pricing, features, costs, and more)

Cloud removes the ops; self-hosting accepts them in exchange for cost control and data ownership. OSS covers the core BI workflow (questions, dashboards, subscriptions, permissions) but lacks Pro-tier SAML/SSO, row-level permissions, and interactive embedding.

### Monthly cost of self hosting Metabase App DB on Railway

Expect $5–15/month on Hobby for a small team. The Metabase service uses most of that; the Postgres app DB stays small and cheap.

### System Requirements for Hosting Metabase App DB on a VPS

Minimum: 1 vCPU and 1–2 GB RAM for Metabase, plus 512 MB–1 GB for Postgres. The app DB usually stays small and grows with query logs and revisions. A comfortable production box is 2 vCPU and 4 GB RAM.

## Frequently Asked Questions (FAQs)

### What happens if I forget MB_DB_TYPE and leave H2 running?

The first deploy works, but the next build or restart wipes the container filesystem, and users, dashboards, and settings vanish with it. Set Postgres before anyone does real work.

### Can I migrate an existing H2 Metabase to Postgres later?

Yes. Keep the old H2 file, set the MB_DB_* variables for Postgres, and run Metabase's `load-from-h2` command on the same Metabase version. It copies users, questions, and dashboards across.

### What's the difference between the Metabase app DB and my analytics database?

The app DB stores Metabase's own state: users, permissions, saved questions, layouts, settings, query logs. Analytics databases are the sources you add via Admin → Databases.

### How big does the Postgres app DB get?

Smaller than you'd expect. For a small team it's mostly query logs and revision history; trim retention if it creeps. A pg_dump of it usually finishes quickly.

### Is single-node Metabase on Railway production-grade?

For internal BI, yes. This template runs one Metabase node, not a cluster, so a restart means a short blip. For customer-facing embeds, add backups and a restore drill first.

### What's the one setting people most often get wrong?

MB_ENCRYPTION_SECRET_KEY. A new random value per deploy breaks encrypted SMTP passwords and source credentials. Generate it once, store it as a Railway variable, and leave it alone.


## Similar templates

- [Typesense PHP](https://railway.com/deploy/typesense-php) — official PHP client against Railway
- [Typesense vs Meilisearch](https://railway.com/deploy/typesense-vs-meilisearch) — self-hosted Typesense vs Meilisearch
- [Matomo Analytics + MariaDB](https://railway.com/deploy/matomo-analytics-mariadb) — Privacy-friendly analytics with MariaDB and persistent volumes.

Open this page in a browser: https://railway.com/deploy/metabase-app-db
