Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

3.9 KB
Raw Blame
name: lobehub
services:
  network-service:
    image: alpine
    container_name: lobe-network
    restart: always
    ports:
      - '${RUSTFS_PORT}:9000' # RustFS API
      - '9001:9001' # RustFS Console
      - '${LOBE_PORT}:3210' # LobeChat
    command: tail -f /dev/null
    networks:
      - lobe-network
    env_file:
      - .env

  postgresql:
    image: paradedb/paradedb:latest-pg17
    container_name: lobe-postgres
    ports:
      - '5432:5432'
    volumes:
      - './data:/var/lib/postgresql/data'
    # Keep the image's default preload list: its first-start bootstrap creates the pg_cron
    # extension and aborts initialization when pg_cron is missing from this list.
    command: ['postgres', '-c', 'shared_preload_libraries=pg_search,pg_cron,pg_stat_statements']
    environment:
      - 'POSTGRES_DB=${LOBE_DB_NAME}'
      - 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}'
    healthcheck:
      # Probe over TCP: during first-time initialization the image runs a temporary server that
      # only listens on the Unix socket, so a socket probe reports ready while LobeHub's TCP
      # connections are still refused.
      test: ['CMD-SHELL', 'pg_isready -U postgres -h 127.0.0.1']
      interval: 5s
      timeout: 5s
      retries: 5
      # TCP stays closed until initialization finishes, which can outlast the retries above
      start_period: 60s
    restart: always
    networks:
      - lobe-network
    env_file:
      - .env

  redis:
    image: redis:7-alpine
    container_name: lobe-redis
    ports:
      - '6379:6379'
    command: redis-server --save 60 1000 --appendonly yes
    volumes:
      - 'redis_data:/data'
    healthcheck:
      test: ['CMD', 'redis-cli', 'ping']
      interval: 5s
      timeout: 3s
      retries: 5
    restart: always
    networks:
      - lobe-network

  rustfs:
    image: rustfs/rustfs:latest
    container_name: lobe-rustfs
    network_mode: 'service:network-service'
    environment:
      - RUSTFS_CONSOLE_ENABLE=true
      - RUSTFS_ACCESS_KEY=${RUSTFS_ACCESS_KEY}
      - RUSTFS_SECRET_KEY=${RUSTFS_SECRET_KEY}
    volumes:
      - rustfs-data:/data
    healthcheck:
      test: ['CMD-SHELL', 'wget -qO- http://localhost:9000/health >/dev/null 2>&1 || exit 1']
      interval: 5s
      timeout: 3s
      retries: 30
    command: ['--access-key','${RUSTFS_ACCESS_KEY}','--secret-key','${RUSTFS_SECRET_KEY}','/data']
    env_file:
      - .env

  rustfs-init:
    image: rustfs/rc:latest
    container_name: lobe-rustfs-init
    depends_on:
      rustfs:
        condition: service_healthy
    volumes:
      - ./bucket.config.json:/bucket.config.json:ro
    entrypoint: /bin/sh
    command: -c '
        set -eux;
        echo "S3_ACCESS_KEY=${RUSTFS_ACCESS_KEY}, S3_SECRET_KEY=${RUSTFS_SECRET_KEY}";
        rc --version;
        rc alias set rustfs "http://network-service:9000" "${RUSTFS_ACCESS_KEY}" "${RUSTFS_SECRET_KEY}";
        rc ls rustfs || true;
        rc mb "rustfs/lobe" --ignore-existing;
        rc admin info cluster rustfs || true;
        rc anonymous set-json "/bucket.config.json" "rustfs/lobe";
        printf "%s" "<CORSConfiguration><CORSRule><AllowedOrigin>*</AllowedOrigin><AllowedMethod>GET</AllowedMethod><AllowedMethod>PUT</AllowedMethod><AllowedMethod>HEAD</AllowedMethod><AllowedHeader>*</AllowedHeader><ExposeHeader>ETag</ExposeHeader><MaxAgeSeconds>3600</MaxAgeSeconds></CORSRule></CORSConfiguration>" | rc bucket cors set "rustfs/lobe" -;
      '
    restart: 'no'
    networks:
      - lobe-network
    env_file:
      - .env

  searxng:
    image: searxng/searxng
    container_name: lobe-searxng
    ports:
      - '8180:8080'
    volumes:
      - './searxng-settings.yml:/etc/searxng/settings.yml'
    environment:
      - 'SEARXNG_SETTINGS_FILE=/etc/searxng/settings.yml'
    restart: always
    networks:
      - lobe-network

volumes:
  data:
    driver: local
  redis_data:
    driver: local
  rustfs-data:
    driver: local

networks:
  lobe-network:
    driver: bridge