---
title: "Self-host Metabase in France over MCP, with while.sh"
url: https://while.sh/en/guides/self-host-metabase/
author: "Aloïs Oddon, co-founder of Nextmap"
updated: 2026-11-03
---

# Self-host Metabase in France, with its PostgreSQL database, from your AI agent

Your dashboards deserve better than a forgotten server. Connected to while over MCP, your AI agent deploys Metabase in France, with its settings in a PostgreSQL database backed up every day, and private to your colleagues if you want.

## Prerequisites

- A new Metabase instance, or the database of a current instance.
- Your AI agent: Claude Code, Codex, Cursor or Gemini CLI.

## Step 1: Ask your agent for Metabase

> You, to your agent: Connect to while with my account (while.sh/agents), then deploy Metabase with its PostgreSQL database.

Your agent adds while's MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn't open, type /mcp, choose while, then Authenticate. On that page, choose "A new app", then click Authorize.

## Step 2: Create your Metabase account

Your agent gives you the address of your Metabase, for example `https://metabase.while.cloud`. The first startup takes about five minutes. You then create the admin account there, then your first questions.

## What your agent does

It deploys the official Metabase image, without a Dockerfile (source 3), with this while.yaml:

```yaml titre="while.yaml"
apiVersion: while/v1
project: metabase
services:
  - name: web
    image: docker.io/metabase/metabase:latest
    port: 3000
    health:
      path: /api/health
      startup_timeout_seconds: 600
    command: ["sh", "-c", "MB_DB_TYPE=postgres MB_DB_CONNECTION_URI=\"$DATABASE_URL\" MB_JETTY_PORT=$PORT exec /app/run_metabase.sh"]
    scale:
      min: 1
      max: 1
    resources:
      cpu: 2000m
      memory: 1536Mi
databases:
  - name: main
    pool: session
```

Metabase keeps its settings, its questions and its dashboards in the PostgreSQL database (source 1). The startup command gives it that database's address and its port (sources 1 and 2). Three settings can't be guessed, and without them Metabase doesn't start:

- **`pool: session`, on the database.** Metabase's migrations take a lock that needs to keep the same connection to the database. Without this line, Metabase stops at startup.
- **`startup_timeout_seconds: 600`.** On its first startup, Metabase prepares its database for about three minutes. Without this line, while withdraws the version after 120 seconds.
- **`memory: 1536Mi`.** Metabase is a Java app: with the default memory, it falls over.

Two CPUs make startup shorter, and a single instance is enough: it fits within the Free plan's CPU quota. If your agent leaves out one of these settings, show it this guide.

## Connect Metabase to your app's database

> You, to your agent: Connect Metabase to our app's database, read-only.

Your agent gives Metabase read-only access to your app's database, even when it sits in another project of your organization. Metabase reads, and can never write.

## Restrict Metabase to your colleagues

> You, to your agent: Restrict Metabase to people in the company.

Your agent adds two lines to the service:

```yaml titre="while.yaml"
    access: internal
    email_domains: [acme.com]
```

Once your Google Workspace or Microsoft 365 is connected to while, on the Pro plan, your colleagues sign in with their usual account, then with Metabase's own sign-in.

## Move to your own domain

> You, to your agent: Put Metabase on stats.acme.com.

Your agent declares the domain, you add the DNS records it gives you, and the HTTPS certificate follows.

## Upgrade to the latest version of Metabase

> You, to your agent: Upgrade Metabase to the latest version.

Your agent deploys the latest Metabase image. If the new version disappoints, it rolls back to the previous one.

## Put Metabase back the way it was yesterday

> You, to your agent: Restore Metabase's database to yesterday at 6 pm.

Your agent prepares the restore, and you approve it: a safety backup is taken first, then the database goes back to the moment you asked for.

## Next steps

- [Restore your database to a precise moment](/en/guides/restore-postgresql/)
- [Restrict an internal tool to company accounts](/en/guides/internal-tool-company-sign-in/)
- [Deploy a Docker container](/en/guides/deploy-docker-container/)

## Sources

1. [Metabase, the application database (PostgreSQL)](https://www.metabase.com/docs/latest/installation-and-operation/configuring-application-database), 2026-11-02
2. [Metabase, environment variables](https://www.metabase.com/docs/latest/configuring-metabase/environment-variables), 2026-11-02
3. [Metabase, the Docker image](https://www.metabase.com/docs/latest/installation-and-operation/running-metabase-on-docker), 2026-11-02

## Questions

### Are my dashboards backed up?

Yes: they live in Metabase's PostgreSQL database, which is backed up every day and can go back to a precise moment.

### Can Metabase read my databases?

It reads your apps' databases on while, read-only, through a private connection. It can also read a database outside while, once internet access is opened and approved.

### How much memory does it need?

1.5 GiB: Metabase is a Java app, and with less, it falls over at startup.

### How long does the first startup take?

About five minutes: Metabase prepares its database before it opens its pages. Later startups are shorter.

### Where is my Metabase hosted?

In France, by Nextmap, a French company.
