Using Docker Compose

Launch LangDB locally via Docker Compose for fast development, and explore AWS or GCP guides for scalable cloud deployments.

This guide walks through a simple deployment using Docker Compose. For scalable cloud-native deployments, see our AWS and GCP guides.

docker-compose.yaml

version: '3.8'

services:
  ai-gateway:
    # We will share be a private image that contains the ai-gateway-enterprise edition.
    # For reference, checkout our free image available in our Github repo.
    # https://github.com/langdb/ai-gateway
    
    image: <private-url>/ai-gateway-enterprise:latest
    ports:
      - "8083:8083"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      # ai-gateway.yaml is expected in the configuration folder.
      - config:/usr/langdb/
    container_name: "langdb-ai-gateway"
    
  clickhouse:
    image: clickhouse/clickhouse-server:latest
    ports:
      - "8123:8123"
      - "9000:9000"
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    extra_hosts:
      - "host.docker.internal:host-gateway"
    container_name: "langdb-clickhouse"
    
  postgres:
    image: postgres:latest
    container_name: langdb-cloud-enterprise-pg
    environment:
      POSTGRES_USER: langdb
     # Note: Include your postgres password as specified in ai-gateway.yaml
      POSTGRES_PASSWORD: XXXXX
      POSTGRES_DB: langdb_staging
      ALLOW_IP_RANGE: 0.0.0.0/0
    ports:
      - "5438:5432"
    command: postgres -c 'max_connections=1000'
    volumes:
      - postgres_data:/var/lib/postgresql/data
      
  redis:
    image: redis:latest
    restart: always
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/root/redis
    environment:
      # Note: Include your redis password as specified in ai-gateway.yaml
      - REDIS_PASSWORD=XXXXX
      - REDIS_PORT=6379
      - REDIS_DATABASES=16
      
volumes:
  config:
  postgres_data:
  redis_data:
  

Refer to ai-gateway.yaml for configuring ai-gateway.

Next Steps

Last updated

Was this helpful?