Deploy Metabase Postgres
connect Postgres warehouses to Metabase
metabase/metabase
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host self hosted Metabase Postgres (Open-Source BI) on Railway
Pointing Metabase at a Postgres warehouse takes four minutes, until a sync scan pins your prod primary for twenty. The difference between a demo and a quarter-long deployment is in the details: read replicas, schema filters, statement timeouts, and keeping Metabase's own app database off your analytics box.
About Hosting Metabase Postgres open-source software on Railway (self hosted Metabase template)
The first-boot wizard creates your admin user, and that's when most people open Admin → Databases and type in their prod primary hostname. Resist. The Postgres you add there is the warehouse: your orders, events, or customer tables. It is not the companion Postgres that stores Metabase's users, dashboards, and saved questions. The template gives you the app side; this guide is about making the warehouse connection production-safe.
Why Deploy Metabase Postgres, the Tableau alternative on Railway (Railway Free Trial)
Tableau costs real money before your first dashboard. Metabase is AGPL, SQL-native, and browser-first: add a Postgres warehouse, write questions in the query builder or raw SQL, and share links. It won't give you Tableau's data-prep workflow or enterprise governance. Railway's $5 GitHub trial lets you run the stack for a weekend to find out whether the OSS route fits.
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 Postgres 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 Postgres self hosting
What matters is the private network between Metabase and the Postgres it queries. Railway puts the app container and companion Postgres on one private network with internal DNS, so MB_DB_HOST is just the service hostname.
| Provider | Private networking | Setup effort | Verdict |
|---|---|---|---|
| Railway | Built in, internal DNS | Low | Fastest path to a private app DB |
| DigitalOcean | VPC, manual peering | Medium | Fine, more manual work |
| AWS | VPC, security groups, IAM | High | Flexible, heavy setup tax |
| Hetzner | Plain VPS, own firewall | Medium-high | Cheapest, you own it all |
Common Use Cases for hosted Metabase Postgres
The most common production pattern is pointing Metabase at a read replica, not the prod primary. A replica absorbs the sync and fingerprint scans Metabase runs when it introspects a schema, and on a schema with hundreds of tables the first sync can hammer a primary for minutes. The second is one warehouse connection with schema filters, so finance and support read the same Postgres as engineering through saved questions. Statement timeouts are the unsung hero: 15–30 seconds makes a runaway cross join fail fast instead of pinning your replica.
Dependencies for Metabase Postgres Docker hosted on Railway
There are two Postgres roles in this stack, and conflating them is the classic production mistake. The companion Postgres stores Metabase's app DB; the warehouse Postgres is the data you chart. The template provisions Metabase plus a Postgres 17 companion (ghcr.io/railwayapp-templates/postgres-ssl). The warehouse is added after first boot and can be any reachable Postgres.
Deployment Dependencies for Managed Metabase Postgres Service (Postgres BI)
The app Postgres must be reachable before Metabase starts, because first boot runs migrations against it. The official image metabase/metabase listens on port 3000, and Railway's health check hits GET /api/health. Set MB_DB_TYPE=postgres plus MB_DB_HOST, MB_DB_PORT, MB_DB_USER, MB_DB_PASS, and MB_DB_DBNAME for the companion service. Keep MB_ENCRYPTION_SECRET_KEY stable across deploys; rotating it breaks decryption of saved connection details. Set MB_SITE_URL to the public HTTPS URL so share links and password-reset emails use the right host. The warehouse needs none of these env vars.
Implementation Details for Metabase Postgres (Using Metabase official docker image)
Pin the image (the v0.63.x line is a reasonable target) instead of floating on :latest. The default H2 database is wiped on redeploy, so never boot without the Postgres app DB configured. For the warehouse, create a dedicated read-only role, not your app's service account and never the superuser, and grant SELECT only on the schemas you want exposed. If the warehouse is also a Railway service, use its private hostname (like postgres.railway.internal) rather than the public TCP proxy, which adds latency and exposes the port to the internet.
How does Metabase Postgres compare against other Postgres BI and SQL dashboard platforms
The real test is how each tool treats a read-only Postgres warehouse: sync scans, schema filters, and timeouts.
Metabase Postgres vs Tableau (Tableau Alternative)
Tableau wins on visual polish and enterprise governance, but expects a data-prep layer and a desktop workflow. For a Postgres replica with a read-only role, Metabase is easier to harden and share.
Metabase Postgres vs Apache Superset (Apache Superset Alternative)
Superset has more chart types and a Python stack, but schema handling takes more manual config. Metabase's Admin → Databases flow, schema filters, and saved questions are more turnkey, and the learning curve is gentler for non-SQL users. Superset for advanced viz, Metabase for operational dashboards.
Metabase Postgres vs Grafana (Grafana Alternative)
Grafana can read Postgres but treats it as a time-series source. Use Grafana for metrics and alerts, Metabase for SQL dashboards and ad-hoc questions from business users.
Metabase Postgres vs Redash (Redash Alternative)
Redash is the closest: SQL-first and lightweight, with an excellent query editor. Metabase adds stronger permissions, collections, and a no-code query builder. For a solo analyst, Redash is fine; for several teams sharing one Postgres, Metabase's governance saves time.
How to use Metabase Postgres (the OSS Postgres BI)?
Go to Admin → Databases → Add database → PostgreSQL. Fill host (private networking on Railway), port, database name, and the read-only role. Set SSL mode to require or verify-full for external hosts, and restrict schemas to the ones you'll chart. Save, let the initial sync run against a replica, then build questions with the query builder or raw SQL.
How to self host Metabase Postgres on other VPS Services (Metabase Postgres self hosting guide)
On a VPS, run Docker; there's no application source you must compile. The rest is the app Postgres and the warehouse connection.
Clone the Repository
Nothing to clone. Metabase ships as a Docker image and a JAR; the source is on GitHub if you want it.
Install Dependencies
Docker plus a reachable Postgres for the app DB. No Python, Node, or build steps.
Configure Environment Variables
Set MB_DB_TYPE=postgres, MB_DB_HOST, MB_DB_PORT, MB_DB_USER, MB_DB_PASS, and MB_DB_DBNAME for the app Postgres, plus a stable MB_ENCRYPTION_SECRET_KEY and MB_SITE_URL.
Start the Metabase Postgres Application
Run docker run -d -p 3000:3000 --env-file metabase.env metabase/metabase:v0.63.x, finish the setup wizard, then add the warehouse.
Official Pricing of Metabase Postgres (Metabase Postgres pricing)
Metabase OSS is AGPL and free, Postgres connector included. Cloud Starter is $100/month plus per-user; Pro costs more and adds SSO, row and column security, and embedding.
Metabase Postgres cloud vs self hosted comparison (Pricing, features, costs, and more)
Cloud handles upgrades, backups, and SSO on higher tiers. Self-hosted gives full control, but you own patching, migrations, and the app Postgres. Fine if you pin versions and test upgrades first.
Monthly cost of self hosting Metabase Postgres on Railway
Railway Hobby with Metabase plus the Postgres companion typically runs $5–15/month. A warehouse on Railway adds cost; external replicas don't.
System Requirements for Hosting Metabase Postgres on a VPS
Metabase is a JVM app; give it 1–2 GB RAM, 1 vCPU, and 10 GB disk. Warehouse load depends on sync scans, so size the replica, not just Metabase.
Frequently Asked Questions (FAQs)
What operators ask after connecting their first warehouse.
Can I point Metabase at the same Postgres that stores its app DB?
Don't. The app DB holds Metabase metadata; the warehouse holds your data. Sharing them means sync scans compete with app metadata queries, and a bad SQL question can slow the whole instance. Use separate instances.
Should I connect to my production primary or a read replica?
A read replica. Fingerprint and sync scans spike CPU and I/O. No replica? Set conservative sync schedules and timeouts.
Which SSL mode should I pick for a Postgres warehouse?
For public endpoints, require or verify-full with a CA cert. Inside Railway private networking SSL may be optional, but the postgres-ssl image supports it. Avoid disable outside a trusted network.
Why is the first sync on my warehouse so slow?
Metabase scans every table in allowed schemas to fingerprint columns. On a wide schema that's expensive. Narrow the schema filter to the tables you'll chart, and run the first sync against a replica off-peak.
How does Railway cost compare to Metabase Cloud?
About $5–15/month plus your warehouse, versus Cloud Starter at $100/month plus per-user. Self-hosted is cheaper if you handle updates and backups.
Is this template highly available?
No. Single-node OSS Metabase with one Postgres companion, no multi-node cluster or automatic failover. Railway restarts a crashed container, but that's recovery, not HA.
Template Content
metabase/metabase
metabase/metabase