---
title: "Deploy Metabase ClickHouse"
description: "Chart ClickHouse tables in self-hosted Metabase"
category: "Analytics"
url: https://railway.com/deploy/deploy-metabase-with-clickhouse
---

# Deploy Metabase ClickHouse

Chart ClickHouse tables in self-hosted Metabase

**[Deploy Metabase ClickHouse on Railway](https://railway.com/template/deploy-metabase-with-clickhouse)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-metabase-with-clickhouse/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 ClickHouse (Open-Source BI for ClickHouse) on Railway

This template runs the metabase/metabase image beside Postgres on Railway and walks you through wiring it to ClickHouse over HTTP so you can chart OLAP tables. Aimed at analysts who want dashboards on big event tables without a warehouse bill.

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

This template runs two services: the official `metabase/metabase` image on port 3000, and Railway Postgres 18 holding Metabase's own application data: users, saved questions, dashboards, and connection settings. ClickHouse is deliberately not bundled.

## Why Deploy Metabase ClickHouse, the Grafana alternative on Railway (Railway Free Trial)

Grafana shines on time series, but ClickHouse ad-hoc questions are where Metabase feels easier. Self-hosting is free under AGPL, and you pay Railway compute instead of Grafana Cloud seats and per-viewer math. The $5 GitHub trial covers your first weekend.

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 ClickHouse 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 ClickHouse self hosting

Railway runs Metabase and its Postgres app database as project services; ClickHouse stays a connection either way.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Services with private networking and HTTPS on MB_SITE_URL. | Cheap droplets, but Docker, Postgres, and TLS are yours. |
| AWS | MB_DB_* wired from the Postgres service, no IAM plumbing. | RDS and ECS add control and compliance, with more setup. |
| Hetzner | Low-cost Metabase plus Postgres stack in one project. | Best price-to-CPU, but backups and TLS are your runbook. |

Pick Railway when the BI layer should be managed and ClickHouse stays where it already lives.

## Common Use Cases for hosted Metabase ClickHouse

ClickHouse usually holds the biggest, fastest tables a team has. Four places Metabase earns its keep:

- **Product analytics on event tables.** ClickHouse holds billions of clickstream rows; Metabase gives PMs filtered dashboards without SQL, as long as you filter on the partition key.
- **Ops and billing reporting.** Finance pulls daily spend by customer straight from pre-aggregated ClickHouse tables, with a read-only user and row caps so a wide date range can't stall the cluster.
- **Ad-hoc ClickHouse functions.** The native query editor handles quantiles, argMax, and array joins that generic BI tools choke on.
- **Embedded customer dashboards.** OSS static (signed) embeds with locked parameters give each tenant one filtered dashboard.

## Dependencies for Metabase ClickHouse Docker hosted on Railway

The template runs metabase/metabase (latest tag, port 3000) plus Railway Postgres 18 (ghcr.io/railwayapp-templates/postgres-ssl:18) with a volume. ClickHouse isn't bundled: use another Railway service over the private network, or ClickHouse Cloud over HTTPS.

### Deployment Dependencies for Managed Metabase ClickHouse Service (BI for ClickHouse)

Wire MB_DB_TYPE=postgres plus MB_DB_HOST, MB_DB_PORT, MB_DB_USER, MB_DB_PASS and MB_DB_DBNAME from Postgres; set MB_SITE_URL to the public HTTPS domain, MB_PASSWORD_COMPLEXITY=strong, and PORT=3000.

### Implementation Details for Metabase ClickHouse (Using Metabase official docker image)

Admin, then Databases, add ClickHouse: Host, Port 8123 or HTTPS 8443 (JDBC over HTTP, not TCP 9000), user, password, databases, SSL/SSH tunnel. Use a read-only user with quotas; pre-aggregate and cache questions. CSV uploads: Cloud or single-node only; model actions fail.

## How does Metabase ClickHouse compare against other BI tools for ClickHouse platforms

ClickHouse is an official Metabase connection now, so the question is fit, not feasibility. Four honest comparisons:

### Metabase ClickHouse vs Grafana (Grafana Alternative)

- **Time series vs tables:** Grafana's plugin wins on counters and infra panels; Metabase wins on the "revenue by region" questions non-engineers ask.
- **Where Grafana wins:** alert routing and one on-call pane mixing ClickHouse with logs and metrics.
- **Query control:** both use ClickHouse's HTTP interface, but Metabase adds a query builder and saved questions.

### Metabase ClickHouse vs Apache Superset (Superset Alternative)

- **Setup weight:** Superset needs a metadata DB plus worker and cache layers; Metabase ClickHouse is one container and Postgres.
- **Where Superset wins:** a wider chart catalog and SQL Lab for power users. Metabase leans on a read-only ClickHouse user and quotas instead.

### Metabase ClickHouse vs Tableau (Tableau Alternative)

- **Cost shape:** Tableau is per-seat; Metabase OSS is AGPL and free, so you pay Railway compute plus Postgres.
- **Where Tableau wins:** polished visuals and a governed semantic layer for large analyst teams. Pre-aggregate in materialized views to keep ClickHouse queries cheap.

### Metabase ClickHouse vs Redash (Redash Alternative)

- **Connection:** Metabase ships ClickHouse as an official connection with a query builder on top.
- **Where Redash wins:** fast query-to-chart work for SQL-only teams. Metabase's filters, subscriptions, and MB_SITE_URL links go further for stakeholders.

## How to use Metabase ClickHouse (the OSS BI for ClickHouse)?

1. Add `MB_ENCRYPTION_SECRET_KEY` to the Metabase service before you save any warehouse credentials, then redeploy.
2. Open the public URL, finish the setup wizard, and create the admin user.
3. Go to Admin, Databases, Add a database and pick ClickHouse.
4. Fill Host and Port: use the HTTP port (8123, or your HTTPS port like 8443). The native TCP port 9000 is never used; Metabase speaks to ClickHouse over HTTP through its JDBC driver.
5. Name the databases you want separated by spaces, or tick Scan all databases. Add a read-only ClickHouse user, cap it with settings and quotas.
6. Set a caching policy for slow questions, then build dashboards on pre-aggregated tables.

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

A 2 vCPU / 4 GB VM with Docker and a firewall is enough; ClickHouse can live off-box.

### Clone the Repository

No clone needed; Metabase ships an official image:

```bash
docker pull metabase/metabase:latest
```

### Install Dependencies

Docker Engine and a Postgres 18 database for the app DB.

### Configure Environment Variables

Point the app DB vars at Postgres, then set the public URL:

```bash
MB_DB_TYPE=postgres
MB_DB_HOST=localhost
MB_DB_PORT=5432
MB_DB_DBNAME=metabase
MB_DB_USER=metabase
MB_DB_PASS=change-me
MB_SITE_URL=https://your-domain
PORT=3000
```

Add `MB_ENCRYPTION_SECRET_KEY` before saving the ClickHouse password; never rotate it.

### Start the Metabase ClickHouse Application

```bash
docker run -d -p 3000:3000 --env-file .env metabase/metabase:latest
```

Proxy port 3000 with nginx or Caddy, then confirm `curl localhost:3000/api/health` returns ok.

Railway handles the container, TLS, and Postgres volume; you add ClickHouse and point Metabase at its HTTP port.

## Official Pricing of Metabase ClickHouse (Metabase ClickHouse pricing)

Metabase OSS is free under AGPL; you pay Railway compute plus the Postgres app database. Those plans cover hosted Metabase, not your ClickHouse cluster. Self-hosting keeps the software and drops the seat meter.

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

Metabase Cloud Starter runs $100/month with 5 users, then $6 per extra user; Pro is $575/month with 10 included plus $12 each; Enterprise starts at $20,000/year. The OSS build is free under AGPL, so the real question is what you spend on compute instead.

### Monthly cost of self hosting Metabase ClickHouse on Railway

A Metabase plus Postgres stack usually lands around $5-15/month on Hobby. Add ClickHouse as another service in the same project and its compute and volume sit on top of that, still well under a Starter seat for a small team.

### System Requirements for Hosting Metabase ClickHouse on a VPS

Metabase is a JVM app: 2 vCPU and 4 GB RAM is a sane floor, with 8 GB if dashboards get busy. ClickHouse is the memory-hungry half, so size it separately and keep its data on fast local disk rather than a network volume.

## Frequently Asked Questions (FAQs)

### Does Metabase ClickHouse connect over port 9000?

No. It speaks to ClickHouse's HTTP interface via JDBC, usually 8123, or 8443 with Use a secure connection ticked. Port 9000 is never used.

### Where do ClickHouse settings go in Metabase ClickHouse?

Two boxes: ClickHouse settings takes comma-separated pairs like allow_experimental_analyzer=1,max_result_rows=100. The rest goes in Additional JDBC connection string options as clickhouse_setting_ entries joined with ampersands.

### Why does my ClickHouse password break after a redeploy?

It ships without MB_ENCRYPTION_SECRET_KEY. Add one before saving warehouse credentials and never rotate it, or stored ClickHouse passwords stop decrypting.

### Can I upload CSVs or run model actions on ClickHouse?

CSV upload works on ClickHouse Cloud and single-node self-hosted only, never clusters; needs read on system.clusters plus create and insert on the upload database. Model actions aren't supported.

### My ClickHouse dashboard feels slow. Where do I fix it?

Aggregate in ClickHouse first with materialized views or pre-aggregated tables, filter on the partition date column, and cache slow questions. Quotas and a read-only user stop one dashboard saturating the cluster.


## Similar templates

- [Typesense Multilingual](https://railway.com/deploy/deploy-typesense-multilingual-search) — Locale-aware multilingual search with Typesense
- [Formbricks | Open-Source Typeform & Qualtrics Alternative](https://railway.com/deploy/formbricks-surveys) — Surveys, NPS and in-app feedback on your own Postgres, Hub and Cube
- [Typesense PHP](https://railway.com/deploy/typesense-php) — official PHP client against Railway

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