Run Metabase with Dokku

Run Metabase with Dokku

How to deploy Metabase (open-source BI tool) to production using Dokku PaaS (open-source Heroku alternative).

Step-by-step guide

Install Dokku

Imagine that you have already rent a server for your project. I use Digital Ocean droplets (this is my referral link with a $100 deposit for new users). Id' suggest having at least 2CPU and 2Gb RAM on your server.

The latest Dokku installation one-liner can be found on their official website but I'd suggest reading my blog post where I cover more details.

Install Metabase

Since Metabase has its Docker image with the latest version which supports environment variables, all we need is to create a Dokku app from Docker image with all proper configs:

dokku apps:create metabase

For production deployment, you need to switch from the default database to Postgres. Create & link Postgres DB to the Dokku app:

dokku postgres:create metabase
dokku postgres:link metabase metabase

Now let's link Postgres the way Metabase will understand. Take POSTGRES_URL from the output above and insert it to the command below:

dokku config:set metabase MB_DB_TYPE=postgres MB_DB_CONNECTION_URI=<your postgres url>

Metabase uses 3000 port as default. Let's tell Dokku to use it for its internal Nginx routing:

dokku proxy:ports-set metabase http:80:3000

And finally, deploy Metabase from the official docker image:

dokku git:from-image metabase metabase/metabase:latest

If you want to attach a domain and use HTTPS from letsencrypt:

dokku domains:set metabase YOURDOMAIN.com
dokku letsencrypt:enable metabase

Now just open YOURDOMAIN.COM in the browser and finish Metabase setup 🥳


Thanks for reading!

You may ask me why I do all these tutorials? Well, since I was banned from Instagram I need someplace to publish my selfies. And of course: