Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Langfuse Langfuse Docker Compose Production

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Deployment
Last Updated 2026-02-14 00:00 GMT

Overview

Production-grade Docker Compose configuration for self-hosting the complete Langfuse platform, including the web application, background worker, and all supporting infrastructure services.

Description

This docker-compose.yml file defines six services that together form a complete self-hosted Langfuse deployment:

  • langfuse-worker -- Express.js background job processor (image langfuse/langfuse-worker:3) bound to 127.0.0.1:3030
  • langfuse-web -- Next.js web application (image langfuse/langfuse:3) exposed on port 3000
  • clickhouse -- ClickHouse analytics database for high-volume trace data, bound to 127.0.0.1:8123 (HTTP) and 127.0.0.1:9000 (native)
  • minio -- S3-compatible blob storage (MinIO) for media and event uploads, exposed on port 9090 (S3 API) and 127.0.0.1:9091 (console)
  • redis -- Redis 7 cache and BullMQ job queue backend, bound to 127.0.0.1:6379
  • postgres -- PostgreSQL 17 primary database, bound to 127.0.0.1:5432

All infrastructure services (ClickHouse, Redis, PostgreSQL, MinIO console) are bound to 127.0.0.1 to prevent external access. Only langfuse-web (port 3000) and MinIO S3 API (port 9090) are externally accessible by default.

Usage

This file is the primary entry point for operators self-hosting Langfuse via Docker Compose. Developers reference it when:

  • Setting up a production or staging Langfuse deployment
  • Understanding the required infrastructure components and their interconnections
  • Configuring environment variables for database connections, S3 storage, Redis, and authentication
  • Customizing ports, volumes, or service dependencies

Code Reference

Source Location

Signature

services:
  langfuse-worker:
    image: docker.io/langfuse/langfuse-worker:3
    restart: always
    depends_on: &langfuse-depends-on
      postgres:
        condition: service_healthy
      minio:
        condition: service_healthy
      redis:
        condition: service_healthy
      clickhouse:
        condition: service_healthy
    ports:
      - 127.0.0.1:3030:3030

  langfuse-web:
    image: docker.io/langfuse/langfuse:3
    restart: always
    depends_on: *langfuse-depends-on
    ports:
      - 3000:3000

  clickhouse:
    image: docker.io/clickhouse/clickhouse-server
    restart: always

  minio:
    image: cgr.dev/chainguard/minio
    restart: always

  redis:
    image: docker.io/redis:7
    restart: always

  postgres:
    image: docker.io/postgres:${POSTGRES_VERSION:-17}
    restart: always

Services

Service Image Port(s) Purpose
langfuse-worker langfuse/langfuse-worker:3 127.0.0.1:3030 Background job processing (ingestion, evaluations, exports)
langfuse-web langfuse/langfuse:3 3000 Next.js web UI and API server
clickhouse clickhouse/clickhouse-server 127.0.0.1:8123, 127.0.0.1:9000 Analytics database for trace data
minio cgr.dev/chainguard/minio 9090 (S3), 127.0.0.1:9091 (console) S3-compatible blob storage
redis redis:7 127.0.0.1:6379 Cache and BullMQ job queues
postgres postgres:17 127.0.0.1:5432 Primary relational database

Key Environment Variables

Variable Default Description
DATABASE_URL postgresql://postgres:postgres@postgres:5432/postgres PostgreSQL connection string
NEXTAUTH_URL http://localhost:3000 Base URL for NextAuth.js authentication
NEXTAUTH_SECRET mysecret Secret key for NextAuth.js session encryption
SALT mysalt Salt for hashing operations
ENCRYPTION_KEY 64 hex zeroes Encryption key (generate via openssl rand -hex 32)
CLICKHOUSE_URL http://clickhouse:8123 ClickHouse HTTP endpoint
CLICKHOUSE_USER / CLICKHOUSE_PASSWORD clickhouse / clickhouse ClickHouse credentials
REDIS_HOST / REDIS_PORT redis / 6379 Redis connection details
REDIS_AUTH myredissecret Redis authentication password
LANGFUSE_S3_EVENT_UPLOAD_BUCKET langfuse S3 bucket for event uploads
LANGFUSE_S3_MEDIA_UPLOAD_BUCKET langfuse S3 bucket for media uploads

Volumes

Volume Name Mount Point Purpose
langfuse_postgres_data /var/lib/postgresql/data PostgreSQL persistent data
langfuse_clickhouse_data /var/lib/clickhouse ClickHouse persistent data
langfuse_clickhouse_logs /var/log/clickhouse-server ClickHouse log files
langfuse_minio_data /data MinIO blob storage data

Health Checks

All infrastructure services include health check configurations to ensure proper startup ordering:

  • PostgreSQL: pg_isready -U postgres (3s interval)
  • ClickHouse: wget --spider http://localhost:8123/ping (5s interval)
  • Redis: redis-cli ping (3s interval)
  • MinIO: mc ready local (1s interval)

Both langfuse-web and langfuse-worker use depends_on with condition: service_healthy to wait for all infrastructure services before starting.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment