|
| 1 | +--- |
| 2 | +title: Deploying Metabase in a Private Network using Serverless Containers |
| 3 | +description: This page shows you how to deploy Metabase in a Private Network using Serverless Containers. |
| 4 | +products: |
| 5 | + - serverless-containers |
| 6 | + - postgresql-and-mysql |
| 7 | + - private-networks |
| 8 | + - vpc |
| 9 | +tags: deploy metabase virtual private cloud private networks serverless containers |
| 10 | +dates: |
| 11 | + validation: 2025-08-07 |
| 12 | + posted: 2025-08-07 |
| 13 | + validation_frequency: 12 |
| 14 | +--- |
| 15 | + |
| 16 | +import Requirements from '@macros/iam/requirements.mdx' |
| 17 | + |
| 18 | +Metabase is an open-source business intelligence platform. You can use Metabase to ask questions about your data, or embed Metabase in your app to let your customers explore their data on their own. Metabase provides an official Docker image via Docker Hub that can be used for deployments on any system that is running Docker. |
| 19 | + |
| 20 | +This tutorial guides you through the steps to deploy Metabase with Serverless Containers, backed by a Managed Databases for PostgreSQL Database Instance, in a Private Network for enhanced security. |
| 21 | + |
| 22 | +<Requirements /> |
| 23 | + |
| 24 | +- A Scaleway account logged into the [console](https://console.scaleway.com) |
| 25 | +- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization |
| 26 | +- Created a [Private Network](/vpc/how-to/create-private-network/) within a dedicated [VPC](/vpc/how-to/create-vpc/) |
| 27 | + |
| 28 | +## Creating a PostgreSQL Database Instance |
| 29 | + |
| 30 | +1. [Create a Database Instance](/classic-hosting/how-to/create-postgresql-database/) with the latest PostgreSQL versions in the same region as your Private Network. You can keep the default parameters, or change them according to your needs. |
| 31 | + |
| 32 | +2. Once your Database Instance is ready, attach your previously created Private Network from the **Network** Section of the **Overview** tab. |
| 33 | + |
| 34 | +3. Still from the **Network** section of the **Overview** tab, click **Remove** next to **Public endpoint** to prevent connections from the public Internet. |
| 35 | + |
| 36 | +Your Database Instance is now ready to be used with Metabase. |
| 37 | + |
| 38 | +## Deploying Metabase with Serverless Containers |
| 39 | + |
| 40 | +1. [Create a VPC-enabled Serverless Containers Namespace](/serverless-containers/how-to/create-manage-delete-containers-namespace/). |
| 41 | + |
| 42 | +2. [Create a Serverless Container](/serverless-containers/how-to/deploy-container/) with the parameters below. You can keep the other values as default, or change them according to your needs. |
| 43 | + - **External** container registry |
| 44 | + - **Image URL**: `metabase/metabase` |
| 45 | + - **Container port**: `3000` |
| 46 | + - **VPC**: the Private Network attached to your Database Instance |
| 47 | + |
| 48 | +3. Add the following **environment variables**: |
| 49 | + |
| 50 | + | Key | Value | Comment | |
| 51 | + |-----------------|---------------|---------------------------------------------------------------------------------------------------------------| |
| 52 | + | `MB_DB_TYPE` | `postgres` | | |
| 53 | + | `MB_DB_DBNAME` | `rdb` | From the **Databases** tab of your Database Instance (`rdb` by default) | |
| 54 | + | `MB_DB_PORT` | `5432` | Default PostgreSQL port | |
| 55 | + | `MB_DB_HOST` | `172.16.0.2` | Private Network endpoint, visible from the **Network** section of the **Overview** of your Database Instance | |
| 56 | + | `MB_DB_USER` | `user` | The username defined during Database Instance creation. Visible from the **Users** tab | |
| 57 | + | `MB_JETTY_HOST` | `0.0.0.0` | Must be set to prevent Metabase from listening on `localhost` | |
| 58 | + |
| 59 | +4. Add the following **secret**: |
| 60 | + |
| 61 | + | Key | Value | Comment | |
| 62 | + |-----------------|-------------|---------------------------------------------------------------------------------------------------------------| |
| 63 | + | `MB_DB_PASS` | `password` | The password defined during Database Instance creation | |
| 64 | + |
| 65 | +5. Review the estimated cost, then click **Deploy container** to finish. Deploying a Serverless Container for the first time can take several minutes. |
| 66 | + |
| 67 | +6. Once your Serverless Container is in a **Ready** state, you can access your Metabase deployment using the container endpoint visible from its **Overview**. |
| 68 | + |
| 69 | +Refer to the [official documentation](https://www.metabase.com/learn/metabase-basics/getting-started/index) for comprehensive information on how to use Metabase. |
| 70 | + |
| 71 | +## Going Further |
| 72 | + |
| 73 | +You can quickly deploy Metabase in a Private Network using Serverless Containers with Terraform/OpenTofu. Refer to our [Serverless Example](https://github.com/scaleway/serverless-examples/tree/main/containers/vpc-metabase) for more information. |
0 commit comments