Back to articles
Technology Insight

Building an Advanced Business Intelligence System: Deploying Metabase with ClickHouse on a VPS

May 30, 2026

Introduction to Modern Business Analytics Architecture

In today's hyper-competitive commercial landscape, data is no longer just an asset—it is the primary driver of strategic decision-making. However, many enterprises face a critical dilemma: proprietary Business Intelligence (BI) platforms often incur prohibitive licensing fees, while traditional relational databases struggle to maintain acceptable query speeds as data volumes scale into millions of rows. To solve this bottleneck, sophisticated data engineers are turning to a powerful, open-source synergy: Metabase and ClickHouse, deployed on a dedicated Virtual Private Server (VPS).

This comprehensive guide will walk you through the architectural principles, installation workflows, and optimization strategies required to build an enterprise-grade analytics system. By combining the intuitive, user-friendly visualization interface of Metabase with the ultra-high-performance columnar processing of ClickHouse, your organization can achieve real-time insights without the premium cloud analytics price tag.

Why Combine Metabase and ClickHouse?

Before diving into the technical deployment, it is vital to understand why this specific technology stack is highly effective for modern data workloads.

ClickHouse: The Columnar Powerhouse

Traditional databases like MySQL or PostgreSQL store data in rows, which is ideal for transactional processing (OLTP). However, analytical queries (OLAP) typically require aggregating billions of rows across only a few specific columns. ClickHouse is an open-source, column-oriented database management system designed explicitly for OLAP workloads. It compresses data aggressively and processes queries using vector execution, yielding performance figures that are often 100 to 1,000 times faster than traditional relational databases.

Metabase: Democratic Data Exploration

While ClickHouse handles the heavy computational lifting, Metabase provides the human interface. Metabase stands out in the BI landscape because it democratizes data access. It allows non-technical business stakeholders to build complex dashboards, filter datasets, and generate visual reports using a graphical "Visual Question" builder, while still allowing data analysts to write raw SQL queries when complex manipulations are required.

Prerequisites and System Architecture

To successfully deploy this infrastructure, your environment should meet the following minimum recommendations:

  • VPS Specifications: Minimum 4 vCPUs, 8GB RAM, and NVMe SSD storage. ClickHouse is highly dependent on memory for complex aggregations and benefits immensely from fast disk I/O.
  • Operating System: Ubuntu 22.04 LTS or Ubuntu 24.04 LTS.
  • Software Dependencies: Docker and Docker Compose installed on the host system.
  • Network Configuration: A registered domain name mapped to your VPS IP address, with ports 80, 443, and 8123 open in the firewall.

Step-by-Step Deployment via Docker Compose

Utilizing Docker Compose ensures that our environment is isolated, reproducible, and easy to maintain. We will create a unified stack containing Metabase, ClickHouse, and an Nginx reverse proxy secured by Let's Encrypt SSL certificates.

Step 1: Directory Setup and Configuration Files

First, establish a clean directory structure on your VPS to persist data and configuration files:

mkdir -p /opt/analytics-stack/{clickhouse,metabase,nginx} 
cd /opt/analytics-stack/

Next, create a basic configuration file for ClickHouse to optimize user access and resource constraints. Create a file at ./clickhouse/users.xml to define custom user permissions if necessary, or rely on environment variables for initial setups.

Step 2: Crafting the Docker Compose File

Create a file named docker-compose.yml within the root of your stack directory. Copy and paste the following production-ready configuration:

version: '3.8'

services:
  clickhouse:
    image: clickhouse/clickhouse-server:latest
    container_name: analytics-clickhouse
    volumes:
      - ./clickhouse/data:/var/lib/clickhouse
      - ./clickhouse/logs:/var/log/clickhouse-server
    environment:
      - CLICKHOUSE_DB=business_analytics
      - CLICKHOUSE_USER=analytics_user
      - CLICKHOUSE_PASSWORD=YourSecurePassword123
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    ports:
      - "8123:8123"
      - "9000:9000"
    restart: always

  metabase:
    image: metabase/metabase:latest
    container_name: analytics-metabase
    volumes:
      - ./metabase/data:/metabase.db
    environment:
      - MB_DB_TYPE=postgres
      - MB_DB_DBNAME=metabase_metadata
      - MB_DB_PORT=5432
      - MB_DB_USER=metabase_user
      - MB_DB_PASS=MetabaseMetaSecret
      - MB_DB_HOST=metabase-meta-db
    ports:
      - "3000:3000"
    depends_on:
      - clickhouse
    restart: always

Note: For a robust production ecosystem, it is highly recommended to configure Metabase to store its application metadata in an external PostgreSQL container rather than its default embedded H2 database. This prevents metadata corruption and simplifies scaling.

Step 3: Initializing the Stack

Execute the following command to pull the images and launch the containers in detached mode:

docker compose up -d

Verify that all containers are operational by checking the status logs:

docker compose ps

Connecting Metabase to ClickHouse

Once your containers are fully initialized, navigate to http://your-vps-ip:3000 to access the Metabase setup wizard. Follow the prompts to create your primary administrator account.

By default, Metabase does not ship with the ClickHouse driver pre-installed in the core package. To establish the connection, you must integrate the official ClickHouse Metabase driver plugin:

  1. Download the latest .jar driver release from the official GitHub repository for the ClickHouse Metabase driver.
  2. Place the downloaded driver file into the /plugins directory mapped within your Metabase container.
  3. Restart the Metabase container using docker compose restart metabase.

Once the driver is active, navigate to Admin Settings > Databases > Add Database. Select ClickHouse from the dropdown menu and fill in the connection details established in your Docker Compose file:

  • Host: analytics-clickhouse (leveraging internal Docker networking)
  • Port: 8123
  • Database Name: business_analytics
  • Username: analytics_user
  • Password: YourSecurePassword123

Click Save. Metabase will immediately scan the ClickHouse schema and sync the tables for analysis.

Optimizing ClickHouse Schema Design for BI Performance

To fully exploit the velocity of ClickHouse, data schemas must be tailored correctly. Unlike standard transactional databases, ClickHouse relies heavily on its table engines, most notably the MergeTree family.

When designing tables for business insights, adhere to these fundamental principles:

1. Use Correct Sorting Keys (ORDER BY)

The ORDER BY clause determines how data is physically arranged on disk. Choose columns that are frequently used in filters (e.g., date, region, product category) as your sorting keys. This allows ClickHouse to bypass scanning irrelevant blocks of data entirely.

2. Leverage Data Compression

ClickHouse natively applies specialized codecs such as ZSTD or LZ4. For high-cardinality string columns or timestamp streams, explicitly defining compression algorithms can reduce disk footprints by up to 70%, which translates directly to reduced disk read latency during query execution.

Securing Your Infrastructure

Exposing database engines directly to the web poses severe security vulnerabilities. Protect your analytics application with the following measures:

  • Nginx Reverse Proxy & TLS: Utilize Nginx to proxy traffic to Metabase, wrapping all communication in TLS certificates managed automatically via Certbot.
  • UFW Firewall Rules: Restrict public access to ports 8123 and 9000. Only the internal Docker network and trusted corporate IP addresses should communicate with the ClickHouse engine directly.
  • Role-Based Access Control (RBAC): Within Metabase, group users by department (e.g., Marketing, Finance) and grant granular permissions to specific schemas to maintain strict data compliance.

Conclusion

Deploying Metabase alongside ClickHouse on a single, high-performance VPS offers an unparalleled combination of processing power and user experience. By shifting the analytical computational burden away from transactional databases into an optimized, column-oriented architecture, your business gains the ability to execute complex queries across massive datasets in milliseconds. Implement this architecture today to establish a scalable, secure, and highly cost-effective foundation for your organization's data-driven future.

Building an Advanced Business Intelligence System: Deploying Metabase with ClickHouse on a VPS | DPTCloud