version: "3"
services:
  langchain-playground:
    image: langchain/${_LANGSMITH_IMAGE_PREFIX-}langchainplus-playground:latest
    ports:
      - 3001:3001
  langchain-frontend:
    image: langchain/${_LANGSMITH_IMAGE_PREFIX-}langchainplus-frontend-dynamic:latest
    ports:
      - 80:80
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - langchain-backend
      - langchain-playground
      - langchain-hub
  langchain-backend:
    image: langchain/${_LANGSMITH_IMAGE_PREFIX-}langchainplus-backend:latest
    environment:
      - PORT=1984
      - LANGCHAIN_ENV=local_docker
      - LOG_LEVEL=warning
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
    ports:
      - 1984:1984
    depends_on:
      - langchain-db
      - langchain-redis
  langchain-queue:
    image: langchain/${_LANGSMITH_IMAGE_PREFIX-}langchainplus-backend:latest
    environment:
      - LANGCHAIN_ENV=local_docker
      - LOG_LEVEL=warning
      - LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
    entrypoint: "rq worker --with-scheduler -u redis://langchain-redis:6379 --serializer lc_database.queue.serializer.ORJSONSerializer --worker-class lc_database.queue.worker.Worker --connection-class lc_database.queue.connection.RedisRetry --job-class lc_database.queue.job.AsyncJob"
  langchain-hub:
    image: langchain/${_LANGSMITH_IMAGE_PREFIX-}langchainhub-backend:latest
    environment:
      - PORT=1985
      - LANGCHAIN_ENV=local_docker
      - LOG_LEVEL=warning
      - LANGSMITH_LICENSE_KEY=${LANGSMITH_LICENSE_KEY}
    ports:
      - 1985:1985
    depends_on:
      - langchain-db
  langchain-db:
    image: postgres:14.7
    command:
      [
        "postgres",
        "-c",
        "log_min_messages=WARNING",
        "-c",
        "client_min_messages=WARNING",
      ]
    environment:
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_USER=postgres
      - POSTGRES_DB=postgres
    volumes:
      - langchain-db-data:/var/lib/postgresql/data
    ports:
      - 5433:5432
  langchain-redis:
    image: redis:7
    ports:
      - 63791:6379
    volumes:
      - langchain-redis-data:/data
volumes:
  langchain-db-data:
  langchain-redis-data:
