---
title: "Deploy Metabase"
description: "Open-source BI: dashboards, charts and SQL, with Postgres as app database"
category: "Analytics"
url: https://railway.com/deploy/metabase-3
---

# Deploy Metabase

Open-source BI: dashboards, charts and SQL, with Postgres as app database

**[Deploy Metabase on Railway](https://railway.com/template/metabase-3)**

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

- **Creator:** Agaz Self-Host
- **Category:** Analytics

## Template content

### Metabase https://cdn.jsdelivr.net/gh/selfhst/icons/svg/metabase.svg

- **Image:** metabase/metabase:v0.65.4.1@sha256:1061f1e8f492b9511600373de15e399a93c153af4110ad7fcc413406da83cbbb
- **Start command:** `/bin/sh -c 'export MB_DB_TYPE="${MB_DB_TYPE:-postgres}" MB_JETTY_PORT="${PORT:-3000}" JAVA_OPTS="${JAVA_OPTS:--Xmx2g}"; exec /app/run_metabase.sh'`
- **Health check:** /api/health
- **Public domain:** Yes

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

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

## Documentation

# Deploy and Host Metabase on Railway

Metabase is an open-source business intelligence tool. You connect it to your databases, then ask questions with a point-and-click editor or SQL, build charts and dashboards, and share them with your team. It runs as a single Java application and stores its own users, questions and dashboards in an application database.

## About Hosting Metabase

Metabase ships as one official Docker image. Out of the box it keeps its application data in an embedded H2 file, which Metabase itself does not recommend for production because the file can be corrupted on restarts and is hard to back up. This template runs the official image pinned to v0.65.4.1 and connects it to a Railway PostgreSQL service as the application database, wired over the private network. It generates the encryption key for saved database credentials and the session signing key, sets the site URL to your Railway domain, caps the Java heap at 2 GB, and uses Metabase's `/api/health` endpoint as the health check. The first start runs database migrations and takes about a minute.

## Common Use Cases

* Build dashboards and reports on top of your production or analytics databases
* Let non-technical teammates explore data with the visual query builder instead of SQL
* Share charts, embed dashboards and schedule email or Slack summaries

## Dependencies for Metabase Hosting

* PostgreSQL (Railway's PostgreSQL service, included) as the application database
* The official `metabase/metabase` Docker image

### Deployment Dependencies

* Metabase Docker image: https://hub.docker.com/r/metabase/metabase
* Running Metabase on Docker: https://www.metabase.com/docs/latest/installation-and-operation/running-metabase-on-docker
* Migrating away from H2 and supported application databases: https://www.metabase.com/docs/latest/installation-and-operation/configuring-application-database
* Environment variables reference: https://www.metabase.com/docs/latest/configuring-metabase/environment-variables
* Releases: https://github.com/metabase/metabase/releases

### Implementation Details

The Metabase service runs the official image `metabase/metabase:v0.65.4.1` (pinned by digest) with this start command, which sets fixed defaults and then runs the image's own entrypoint:

```sh
/bin/sh -c 'export MB_DB_TYPE="${MB_DB_TYPE:-postgres}" MB_JETTY_PORT="${PORT:-3000}" JAVA_OPTS="${JAVA_OPTS:--Xmx2g}"; exec /app/run_metabase.sh'
```

* Open your Railway domain after the deploy finishes and complete the setup wizard. The first account you create becomes the admin. Until you finish setup, anyone who knows the URL can open the wizard, so do it right away.
* `MB_ENCRYPTION_SECRET_KEY` encrypts the connection details of databases you add. Keep it and don't change it, or Metabase can no longer read those saved connections.
* `MB_SESSION_SECRET_KEY` signs login sessions. Changing it logs everyone out.
* To give Metabase more or less memory, set a `JAVA_OPTS` variable on the Metabase service, for example `-Xmx1g` or `-Xmx4g`.
* All questions, dashboards and users live in the Postgres service, which has its own volume. Back up that database to back up Metabase.
* To upgrade, change the image tag to a newer Metabase release. Metabase migrates the application database on start, so back up Postgres first.

## 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.




## Similar templates

- [Plausible WordPress](https://railway.com/deploy/deploy-plausible-for-wordpress-sites) — Cookie-free WordPress stats from your own Plausible
- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube

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