How to deploy Metabase using docker, Postgres, and Nginx

How to deploy Metabase using docker, Postgres, and Nginx

Metabase is an open-source data analysis tool that has gained a lot of attention in the community in recent years.

One of its strengths is that you can just "plug and play" your database into it and start extracting cool insights from your application all "plug and play".

The Metabase currently supports the following databases:

  • Amazon Redshift
  • Druid
  • Google Analytics
  • Google BigQuery
  • H2
  • MongoDB (version 3.4 or higher)
  • MySQL (version 5.7 or higher, as well as MariaDB version 10.2 or higher)
  • Oracle
  • PostgreSQL
  • Presto
  • Snowflake
  • SparkSQL
  • SQL Server
  • SQLite
  • Vertica

But of course, ideally, you have a separate database to use in your Metabase that is a faithful copy of the production environment a few hours or at most a day apart.

To make the deployment process easy, i created this project on Github:

https://github.com/paulocastellano/metabase-docker-template

I use docker with these services

  • Metabase
  • Postgres - for Metabase database (users, passwords, etc.)
  • Nginx

Why use NGINX?

You could even directly expose port 80 in your docker container, but that's not cool.

So that's why I used the Nginx server to create a reverse proxy from Metabase port 3000 to default port 80.

This way, you can point your DNS directly to your server's IP and by default, the Metabase will already appear in your browser :)

How to deploy the Metabase?

  1. Clone the project at https://github.com/paulocastellano/metabase-docker-template
  2. Create a file called .env in the project root and paste the contents of the .env.example file into it.
  3. Enter the database username and password you want
  4. Run the following command: docker-compose up or docker-compose up -d to run in the background

After you build and upload your docker container, you should see a screen that looks like this: