How to self-host Metabase on Ownkube

A step-by-step guide to self-hosting Metabase on Ownkube with the official image, a managed Postgres database instead of the default H2 file, and automatic TLS.

Ownkube team | | How-To | 5 min

Metabase ships with an embedded H2 database by default, which is fine for a five-minute demo and a bad idea the moment more than one person relies on the dashboards. Self-hosting it properly means putting its application data on a real Postgres database from the start, and Ownkube’s Metabase recipe does that wiring for you with the official image.

This walks through deploying it, the exact environment variables Metabase reads to find that database, why memory sizing matters more than it looks like it should, and the manual path if you want your own image instead.

TL;DR

  • Deploy Metabase from Ownkube’s Marketplace using the official metabase/metabase image, no server to patch yourself.
  • Ownkube wires a managed Postgres database into Metabase’s MB_DB_* environment variables, so your dashboards and questions live outside the container instead of in the default embedded H2 file.
  • The JVM needs real headroom: Ownkube’s recipe requests 1 GiB and caps memory at 2 GiB, size your box with that in mind.
  • Metabase’s own setup wizard creates the admin account on first boot. Ownkube does not bootstrap it for you the way it does for some other recipes.
  • The app gets a public hostname with automatic TLS once its health check passes.

What you need before you start

Just an Ownkube account, no cloud account of your own. The Personal plan is $5 a month, loaded straight into a wallet you then spend on the database box and the app’s compute. Sign in at app.ownkube.io.

Step 1: Open the Metabase recipe in the Marketplace

Ownkube’s Marketplace has a Metabase recipe at app.ownkube.io/marketplace/metabase that provisions the Metabase web app and a managed Postgres database together. It is public early access, so you can browse the recipe without an account, but deploying it needs one.

Step 2: Choose your Postgres box size, and use it

This is the step that matters most for self-hosting Metabase correctly. Left alone, Metabase stores everything (your dashboards, saved questions, users, and permissions) in a single embedded H2 file inside the container. That file does not survive a redeploy cleanly and was never meant to carry more than a quick trial. The recipe instead provisions a managed Postgres database box, starting at $4 a month plus storage at $0.15 per GB, and points Metabase at it before it ever boots.

Step 3: Let Ownkube wire the database connection

Metabase does not take a single connection URL for its application database. It reads the connection as separate fields, and Ownkube sets each one from the managed Postgres database it just provisioned:

MB_DB_TYPE=postgres
MB_DB_HOST=<managed Postgres host>
MB_DB_PORT=5432
MB_DB_DBNAME=<managed Postgres database>
MB_DB_USER=<managed Postgres user>
MB_DB_PASS=<managed Postgres password>

Setting MB_DB_TYPE=postgres is what actually turns off the default H2 file. Miss that one variable and Metabase quietly falls back to embedded storage even if the rest of the fields are correct, which is the most common mistake in a manual Metabase deploy. The connection runs without TLS by default between the app and the database, which is fine since both sit privately in the same project.

Step 4: Size memory for the JVM

Metabase runs on the JVM, and the JVM wants headroom before it wants CPU. Ownkube’s recipe requests 250m CPU and 1 GiB of memory, with a limit of 1 full CPU and 2 GiB of memory. If you are sizing a box by hand for a custom deploy, treat 1 GiB as the floor, not a comfortable ceiling. Undersizing memory here is the fastest way to see Metabase crash-loop during startup rather than run slowly.

The health check also gives it room: Ownkube polls /api/health for up to five minutes after boot before deciding the deploy failed, because a first boot has to run Metabase’s own database migrations against your Postgres box, and that takes real time.

Step 5: Deploy and finish setup in Metabase’s own wizard

Once the deployment is healthy, Ownkube assigns it a public hostname on the shared region edge with TLS already in place. Open it, and Metabase runs its own first-run setup wizard: you create the admin account and can add your first data source right there. Ownkube does not pre-generate this account the way it does for some other Marketplace recipes; it is entirely Metabase’s own onboarding.

Deploying a custom Metabase image instead

If you need a driver or plugin that is not in the stock image, connect a GitHub repository with a Dockerfile built FROM metabase/metabase instead of using the recipe. Ownkube builds and deploys it the same way it would any other container. You would then add a managed Postgres database to the project and set the same MB_DB_* variables yourself, copying the host, port, database name, user, and password from the database’s Connect tab. The Marketplace recipe exists specifically so you do not have to do that wiring by hand unless you actually need a customized image.

Move it to your own AWS later, with no rewrite

If Metabase’s query load or your team outgrows what you want to run on Ownkube Compute, the same app, the same official image, and the same Postgres data move into your own AWS account with no rewrite. Its logs, metrics, and health checks come with it. If you are also weighing this against Railway for the rest of your stack, our Railway alternative comparison covers how that portability compares.

FAQ

Does Metabase need Postgres, or can I use the built-in database?

Metabase ships with an embedded H2 file by default, which is not recommended once more than one person depends on it. Wiring a real Postgres database through MB_DB_*, which Ownkube’s recipe does automatically, is the production setup Metabase itself recommends.

How much memory does Metabase need on Ownkube?

Plan on at least 1 GiB. Ownkube’s recipe requests 1 GiB and caps at 2 GiB for the JVM’s headroom; going below that risks crash loops during startup rather than a graceful slowdown.

Is this the actual official Metabase image?

Yes. The recipe pulls metabase/metabase directly from Docker Hub at a pinned version, not a custom build.

Do I create the admin account through Ownkube?

No. Metabase’s own setup wizard runs the first time you open the app, and that is where you create the admin account.

Can Metabase still connect to other databases as data sources?

Yes, and that is separate from the Postgres database Ownkube wires in for Metabase’s own application data. You add any additional database, warehouse, or spreadsheet as a data source from inside Metabase once it is running.

Where Ownkube fits

If you want Metabase’s dashboards and SQL editor without babysitting an H2 file or sizing a JVM host from scratch, the Marketplace recipe gets you the official image, a real Postgres database wired in from the start, and a TLS-covered URL in one action. Deploy your first app.

More posts