← Back to Guides
Profile image for Adam Charvat

By Adam Charvat

Published 17th December 2021

Deploying Metabase with PostgreSQL

Metabase is an easy and open-source way to visualise data from databases and create insightful dashboards via a powerful user interface without writing SQL.

In this guide, you will learn how to deploy Metabase from its official Docker image and set up a PostgreSQL database which Metabase will use to store its configuration.

mb-dark-dashboard.png

  1. Create a new PostgreSQL database. For increased security, keep SSL enabled and External Access disabled. You can start with the smallest compute plan with 4 GB of storage and one replica.

    • This PostgreSQL database will only be used to store Metabase config data, not for any analytics or dashboards. You will connect your databases for analytics once Metabase is set up.

  2. Create a new secret group in your project and link the database. Then inherit the environment variable JDBC_POSTGRES_URI as an alias MB_DB_CONNECTION_URI.

    • This will ensure that the database connection details are automatically injected into the environment and you don't have to manually copy and paste them.

  3. Create a new deployment service that will be deploying an external image metabase/metabase:latest from DockerHub. Port 3000 will be automatically detected and publicly exposed by default.

    • For service resources, we recommend at least nf-compute-50 (0.5 vCPU and 1024 MB memory) but you may choose a higher plan for increased performance (lower plans may not be enough for Metabase to start properly).

Once your service is created, you can view the start up by going to the container logs. The first time it runs Metabase will configure the database, therefore it can take longer than any subsequent runs. Once finished, go to the service URL and start by creating your first user and connecting your data!

Metabase supports connecting databases such as MySQL, MongoDB, PostgreSQL, BigQuery, Google Analytics and more. You can view the full list in Metabase documentation.

Share this article with your network