diff --git a/.dockerignore b/.dockerignore index 281e568..2e4935a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,13 +1,51 @@ +# Ignore node_modules and other dependency directories +node_modules +bower_components +vendor + +# Ignore logs and temporary files +*.log +*.tmp +*.swp + +# Ignore .env files and other environment files +.env +.env.* +*.local + +# Ignore git-related files .git +.gitignore + +# Ignore Docker-related files and configs +.dockerignore +docker-compose.yml + +# Ignore build and cache directories +dist +build +.cache +__pycache__ + +# Ignore IDE and editor configurations +.vscode +.idea +*.sublime-project +*.sublime-workspace +.DS_Store # macOS-specific + +# Ignore test and coverage files +coverage +*.coverage +*.test.js +*.spec.js +tests + +# Project .github .venv *.pyc -*.env -.coverage .devcontainer -.gitignore .pre-commit-config.yaml .pytest_cache .ruff_cache -__pycache__ -tests diff --git a/docker-compose.yml b/docker-compose.yml index 7bff9f0..15d6d7f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,63 +1,56 @@ +volumes: + langgraph-data: + driver: local + services: - qdrant: - image: qdrant/qdrant:v1.15.1 - container_name: qdrant + langgraph-redis: + image: redis:6 + healthcheck: + test: redis-cli ping + interval: 5s + timeout: 1s + retries: 5 + + langgraph-postgres: + image: pgvector/pgvector:pg16 ports: - - "6333:6333" # Dashboard: http://localhost:6333/dashboard - volumes: - - ./assets/qdrant_data:/qdrant/storage - elasticsearch: - build: - dockerfile: elasticsearch.Dockerfile - container_name: elasticsearch - ports: - - "9200:9200" - - "9300:9300" + - "5433:5432" environment: - - discovery.type=single-node - - xpack.security.enabled=false + POSTGRES_DB: postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + command: + - postgres + - -c + - shared_preload_libraries=vector volumes: - - ./assets/es_data:/usr/share/elasticsearch/data - postgres: - image: postgres:17 - container_name: postgres + - langgraph-data:/var/lib/postgresql/data + healthcheck: + test: pg_isready -U postgres + start_period: 10s + timeout: 1s + retries: 5 + interval: 60s + start_interval: 1s + + langgraph-api: ports: - - "5432:5432" - volumes: - - ./assets/postgres_data:/var/lib/postgresql/data - - ./data:/docker-entrypoint-initdb.d - environment: - POSTGRES_USER: user - POSTGRES_PASSWORD: password - POSTGRES_DB: db - restart: always - jaeger: - image: jaegertracing/all-in-one:1.72.0 - container_name: jaeger - environment: - - SPAN_STORAGE_TYPE=elasticsearch - - ES_SERVER_URLS=http://elasticsearch:9200 - - LOG_LEVEL=debug - ports: - - "16686:16686" # to access the Jaeger UI - - "4317:4317" - - "4318:4318" - - "5778:5778" - - "9411:9411" + - "8123:8000" depends_on: - - elasticsearch - restart: unless-stopped - # FIXME: disable for now since its port conflicts with jaeger - # otel-collector: - # image: otel/opentelemetry-collector-contrib:latest - # container_name: otel-collector - # volumes: - # - ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml - # ports: - # - 1888:1888 # pprof extension - # - 8888:8888 # Prometheus metrics exposed by the Collector - # - 8889:8889 # Prometheus exporter metrics - # - 13133:13133 # health_check extension - # - 4317:4317 # OTLP gRPC receiver - # - 4318:4318 # OTLP http receiver - # - 55679:55679 # zpages extension + langgraph-redis: + condition: service_healthy + langgraph-postgres: + condition: service_healthy + environment: + REDIS_URI: redis://langgraph-redis:6379 + POSTGRES_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable + healthcheck: + test: python /api/healthcheck.py + interval: 60s + start_interval: 1s + start_period: 10s + env_file: + - .env + build: + context: . + dockerfile: langgraph.Dockerfile diff --git a/langgraph.Dockerfile b/langgraph.Dockerfile new file mode 100644 index 0000000..b62ea66 --- /dev/null +++ b/langgraph.Dockerfile @@ -0,0 +1,26 @@ +FROM langchain/langgraph-api:3.11 + + + +# -- Adding local package . -- +ADD . /deps/template-langgraph +# -- End of local package . -- + +# -- Installing all local dependencies -- +RUN PYTHONDONTWRITEBYTECODE=1 uv pip install --system --no-cache-dir -c /api/constraints.txt -e /deps/* +# -- End of local dependencies install -- +ENV LANGSERVE_GRAPHS='{"chat_with_tools_agent": "template_langgraph.agents.chat_with_tools_agent.agent:graph", "demo_agents_parallel_rag_agent": "template_langgraph.agents.demo_agents.parallel_rag_agent.agent:graph", "demo_agents_multi_agent": "template_langgraph.agents.demo_agents.multi_agent:graph", "demo_agents_research_deep_agent": "template_langgraph.agents.demo_agents.research_deep_agent:graph", "demo_agents_weather_agent": "template_langgraph.agents.demo_agents.weather_agent:graph", "image_classifier_agent": "template_langgraph.agents.image_classifier_agent.agent:graph", "issue_formatter_agent": "template_langgraph.agents.issue_formatter_agent.agent:graph", "kabuto_helpdesk_agent": "template_langgraph.agents.kabuto_helpdesk_agent.agent:graph", "news_summarizer_agent": "template_langgraph.agents.news_summarizer_agent.agent:graph", "supervisor_agent": "template_langgraph.agents.supervisor_agent.agent:graph", "task_decomposer_agent": "template_langgraph.agents.task_decomposer_agent.agent:graph"}' + + + +# -- Ensure user deps didn't inadvertently overwrite langgraph-api +RUN mkdir -p /api/langgraph_api /api/langgraph_runtime /api/langgraph_license && touch /api/langgraph_api/__init__.py /api/langgraph_runtime/__init__.py /api/langgraph_license/__init__.py +RUN PYTHONDONTWRITEBYTECODE=1 uv pip install --system --no-cache-dir --no-deps -e /api +# -- End of ensuring user deps didn't inadvertently overwrite langgraph-api -- +# -- Removing build deps from the final image ~<:===~~~ -- +RUN pip uninstall -y pip setuptools wheel +RUN rm -rf /usr/local/lib/python*/site-packages/pip* /usr/local/lib/python*/site-packages/setuptools* /usr/local/lib/python*/site-packages/wheel* && find /usr/local/bin -name "pip*" -delete || true +RUN rm -rf /usr/lib/python*/site-packages/pip* /usr/lib/python*/site-packages/setuptools* /usr/lib/python*/site-packages/wheel* && find /usr/bin -name "pip*" -delete || true +RUN uv pip uninstall --system pip setuptools wheel && rm /usr/bin/uv /usr/bin/uvx + +WORKDIR /deps/template-langgraph diff --git a/tools.docker-compose.yml b/tools.docker-compose.yml new file mode 100644 index 0000000..7bff9f0 --- /dev/null +++ b/tools.docker-compose.yml @@ -0,0 +1,63 @@ +services: + qdrant: + image: qdrant/qdrant:v1.15.1 + container_name: qdrant + ports: + - "6333:6333" # Dashboard: http://localhost:6333/dashboard + volumes: + - ./assets/qdrant_data:/qdrant/storage + elasticsearch: + build: + dockerfile: elasticsearch.Dockerfile + container_name: elasticsearch + ports: + - "9200:9200" + - "9300:9300" + environment: + - discovery.type=single-node + - xpack.security.enabled=false + volumes: + - ./assets/es_data:/usr/share/elasticsearch/data + postgres: + image: postgres:17 + container_name: postgres + ports: + - "5432:5432" + volumes: + - ./assets/postgres_data:/var/lib/postgresql/data + - ./data:/docker-entrypoint-initdb.d + environment: + POSTGRES_USER: user + POSTGRES_PASSWORD: password + POSTGRES_DB: db + restart: always + jaeger: + image: jaegertracing/all-in-one:1.72.0 + container_name: jaeger + environment: + - SPAN_STORAGE_TYPE=elasticsearch + - ES_SERVER_URLS=http://elasticsearch:9200 + - LOG_LEVEL=debug + ports: + - "16686:16686" # to access the Jaeger UI + - "4317:4317" + - "4318:4318" + - "5778:5778" + - "9411:9411" + depends_on: + - elasticsearch + restart: unless-stopped + # FIXME: disable for now since its port conflicts with jaeger + # otel-collector: + # image: otel/opentelemetry-collector-contrib:latest + # container_name: otel-collector + # volumes: + # - ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml + # ports: + # - 1888:1888 # pprof extension + # - 8888:8888 # Prometheus metrics exposed by the Collector + # - 8889:8889 # Prometheus exporter metrics + # - 13133:13133 # health_check extension + # - 4317:4317 # OTLP gRPC receiver + # - 4318:4318 # OTLP http receiver + # - 55679:55679 # zpages extension