Metabase with PostgreSQL on Debian 12 (Docker Compose + Nginx + SSL)
Metabase is an open-source business intelligence (BI) and analytics platform that allows teams to easily explore, visualize, and share data — without writing complex SQL queries. With an intuitive web-based interface, users can build dashboards, charts, and reports directly from databases like PostgreSQL, MySQL, or MongoDB, helping organizations make informed, data-driven decisions.
Running Metabase on Debian 12 (Bookworm) with PostgreSQL provides a stable, secure, and long-term supported environment. Debian 12 includes systemd 252, OpenSSL 3, and up-to-date Docker packages, making it an excellent base for deploying Metabase in production with Docker Compose, Nginx reverse proxy, and SSL encryption.
Architecture Overview
| Layer | Component | Role | 
|---|---|---|
| OS | Debian 12 (Bookworm) | Stable, long-term supported Linux base | 
| Container Runtime | Docker Engine + Compose | Orchestrates Metabase and PostgreSQL containers | 
| Database | PostgreSQL 15 | Stores dashboards, users, queries, and configuration data | 
| Application | Metabase Server | Provides web-based BI dashboards and data visualization tools | 
| Reverse Proxy | Nginx (optional) | Manages HTTPS, compression, caching, and routing | 
| TLS | Let’s Encrypt / PKI | Enables secure HTTPS access for users and admins | 
Why Use Metabase?
- Self-hosted BI platform – no vendor lock-in, full control of your data.
- User-friendly interface – create dashboards and queries with no code.
- SQL-ready – advanced users can write and optimize custom SQL.
- Multi-database support – connect PostgreSQL, MySQL, BigQuery, and more.
- Free and open-source – deploy anywhere with no licensing cost.
- Enterprise extensions – SSO, advanced permissions, and auditing available in paid editions.
Metabase vs Other BI Tools
| Feature/Capability | Metabase (Self-hosted) | Tableau (Cloud) | Power BI (Microsoft) | Apache Superset (Self-hosted) | 
|---|---|---|---|---|
| Hosting | Self-hosted (Docker) | SaaS / Desktop | SaaS / Windows only | Self-hosted (Docker) | 
| Cost | Free, open-source | Subscription | Subscription | Free, open-source | 
| Database support | Broad (SQL sources) | Very broad | MS ecosystem | Broad (SQL sources) | 
| Ease of use | Very easy | Moderate | Moderate | Developer-oriented | 
| Ideal for | Teams, SMBs, startups | Large orgs | Enterprises | Engineers and analysts | 
Metabase is best suited for teams and organizations that want a self-hosted analytics solution that’s simple to use yet powerful enough for complex insights.
Security & Best Practices
- Deploy behind Nginx with SSL (HTTPS) for secure access.
- Store PostgreSQL credentials securely in environment variables or Docker secrets.
- Use a dedicated PostgreSQL user with limited privileges for Metabase.
- Restrict PostgreSQL to internal Docker networks only.
- Automate PostgreSQL backups using pg_dumpor containerized backup jobs.
- Keep Debian, Docker, and Metabase images updated.
- Enforce strong passwords and configure Metabase role-based permissions.
- Automate SSL renewals using Certbot or Traefik ACME integration.
Typical Use Cases
- Business dashboards and performance reports.
- Marketing and sales analytics using PostgreSQL data.
- KPI tracking for startups and enterprises.
- Data exploration for non-technical users.
- Internal analytics for SaaS, finance, and e-commerce platforms.
Deploying Metabase with PostgreSQL on Debian 12 provides a powerful, secure, and scalable analytics platform that allows your organization to turn data into actionable insights — all while maintaining full ownership and control of your infrastructure.
Step 1: Create a Server Instance on Shape.Host
Log in to your Shape.Host account.
Click Create → Instance.

Choose your preferred location.

Select a plan with at least 2 CPUs, 4 GB RAM, and 20 GB SSD.
Choose Debian 12 (64-bit) as the operating system.

Click Create Instance.

Once the instance is ready, copy your public IP address from the Resources section.

Step 2: Connect to Your Server
Use SSH to connect:
- Linux/macOS: ssh root@your_server_ip
- Windows (PuTTY):
- Open PuTTY.
- Enter your server IP and click Open.
- Log in as root.
 
Step 3: Install Docker and Docker Compose
Update system packages:
apt update

Install required dependencies:
apt install ca-certificates curl gnupg lsb-release
These packages allow Debian to securely download and verify Docker packages.

Create a directory for Docker’s GPG key:
mkdir -p /etc/apt/keyrings
Download and save Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
Add the Docker repository to your APT sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
> /etc/apt/sources.list.d/docker.list
Update the package index again:
apt update

Install Docker Engine, CLI, container runtime, and Compose plugin:
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Enable Docker to start on boot:
systemctl enable docker
Start Docker:
systemctl start docker
Verify Docker installation:
docker --version
docker compose version
Step 4: Create the Metabase Project Directory
Create a working directory for your containers:
mkdir -p /opt/metabase
cd /opt/metabase

Step 5: Create Docker Compose Configuration
Open the configuration file:
nano docker-compose.yml
Paste the following content:
version: "3.9"
services:
  db:
    image: postgres:15
    container_name: metabase-postgres
    restart: always
    environment:
      POSTGRES_USER: metabase
      POSTGRES_PASSWORD: StrongPassword123!
      POSTGRES_DB: metabase
    volumes:
      - pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
  metabase:
    image: metabase/metabase:latest
    container_name: metabase-app
    restart: always
    ports:
      - "3000:3000"
    environment:
      MB_DB_TYPE: postgres
      MB_DB_DBNAME: metabase
      MB_DB_PORT: 5432
      MB_DB_USER: metabase
      MB_DB_PASS: StrongPassword123!
      MB_DB_HOST: db
    depends_on:
      - db
    volumes:
      - mb-data:/metabase-data
volumes:
  pgdata:
  mb-data:
Explanation
| Component | Description | 
|---|---|
| db | PostgreSQL 15 container storing all Metabase configuration data. | 
| metabase | The Metabase web application, exposed on port 3000. | 
| volumes | Persistent storage for database and app data to survive container restarts. | 
Save and exit (CTRL + O, then CTRL + X).

Step 6: Deploy Metabase
Download the required Docker images:
docker compose pull

Start Metabase and PostgreSQL containers:
docker compose up -d

Verify both services are running:
docker compose ps
If both containers show Up, your Metabase stack is now live.

Step 7: Access Metabase
If you’re not using Nginx, open Metabase directly via:
http://YOUR_SERVER_IP:3000
If you configured a domain and SSL, open:
https://metabase.example.com
You’ll see the Metabase Setup Wizard — create your admin account, connect your data sources, and start building dashboards.
Welcome to Metabase
The welcome page indicates that everything is working.
Click “Let’s get started” to begin the initial configuration process.

Choose Your Language
Metabase will ask for your preferred interface language.
- Select English (or any language you prefer).
- Click Next to continue.

Administrator Account Setup
You’ll now create the first admin account for your Metabase instance.
Fill out the fields as follows:
- First name: Andrei
- Last name: Gh
- Email: contact@shape.host
- Company or team name: ShapeHost
- Password: Choose a secure password
- Confirm password: Re-enter your password
After completing the form, click Next.

Usage Purpose
Metabase will ask how you plan to use it.
Select:
Self-service analytics for my own company
This option helps configure Metabase for your internal analytics environment.
Click Next to proceed.

Database Connection
In this step, you can connect Metabase to a data source.
Since PostgreSQL was already configured earlier, you have two options:
- Connect to your PostgreSQL database now by selecting PostgreSQL and entering your credentials.
 or
- Click Continue with sample data to explore Metabase first using its built-in demo dataset.
You can always connect your PostgreSQL database later from the Metabase Admin Panel:
Admin → Databases → Add Database

Data Collection Preferences
Metabase will ask whether you want to share anonymous usage data to help improve the software.
You can either:
- Leave it enabled (default), or
- Turn it off for privacy.
Click Finish to finalize the setup.

Dashboard Overview
Screenshot 7 – Metabase Home Page
Once setup is complete, you’ll be redirected to the main dashboard.
From here, you can:
- Explore the sample dashboards and charts
- Connect to your PostgreSQL data
- Create custom dashboards, reports, and visualizations
- Manage data models and metrics from the left sidebar

You installed Metabase with PostgreSQL on Debian 12 using Docker Compose.
You now have a robust, containerized analytics platform ready for dashboards, charts, and business insights.
For optimal uptime and performance, host your Metabase instance on a Shape.Host Cloud VPS, offering high availability, SSD storage, and full root access.