Skip to content

Commit f219726

Browse files
authored
Merge pull request #116 from ks6088ts-labs/feature/issue-109_self-hosted
support self-hosted langgraph api server
2 parents 8fbcb94 + 9f8b201 commit f219726

File tree

4 files changed

+182
-62
lines changed

4 files changed

+182
-62
lines changed

.dockerignore

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,51 @@
1+
# Ignore node_modules and other dependency directories
2+
node_modules
3+
bower_components
4+
vendor
5+
6+
# Ignore logs and temporary files
7+
*.log
8+
*.tmp
9+
*.swp
10+
11+
# Ignore .env files and other environment files
12+
.env
13+
.env.*
14+
*.local
15+
16+
# Ignore git-related files
117
.git
18+
.gitignore
19+
20+
# Ignore Docker-related files and configs
21+
.dockerignore
22+
docker-compose.yml
23+
24+
# Ignore build and cache directories
25+
dist
26+
build
27+
.cache
28+
__pycache__
29+
30+
# Ignore IDE and editor configurations
31+
.vscode
32+
.idea
33+
*.sublime-project
34+
*.sublime-workspace
35+
.DS_Store # macOS-specific
36+
37+
# Ignore test and coverage files
38+
coverage
39+
*.coverage
40+
*.test.js
41+
*.spec.js
42+
tests
43+
44+
# Project
245
.github
346
.venv
447
*.pyc
5-
*.env
6-
.coverage
748
.devcontainer
8-
.gitignore
949
.pre-commit-config.yaml
1050
.pytest_cache
1151
.ruff_cache
12-
__pycache__
13-
tests

docker-compose.yml

Lines changed: 50 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,56 @@
1+
volumes:
2+
langgraph-data:
3+
driver: local
4+
15
services:
2-
qdrant:
3-
image: qdrant/qdrant:v1.15.1
4-
container_name: qdrant
6+
langgraph-redis:
7+
image: redis:6
8+
healthcheck:
9+
test: redis-cli ping
10+
interval: 5s
11+
timeout: 1s
12+
retries: 5
13+
14+
langgraph-postgres:
15+
image: pgvector/pgvector:pg16
516
ports:
6-
- "6333:6333" # Dashboard: http://localhost:6333/dashboard
7-
volumes:
8-
- ./assets/qdrant_data:/qdrant/storage
9-
elasticsearch:
10-
build:
11-
dockerfile: elasticsearch.Dockerfile
12-
container_name: elasticsearch
13-
ports:
14-
- "9200:9200"
15-
- "9300:9300"
17+
- "5433:5432"
1618
environment:
17-
- discovery.type=single-node
18-
- xpack.security.enabled=false
19+
POSTGRES_DB: postgres
20+
POSTGRES_USER: postgres
21+
POSTGRES_PASSWORD: postgres
22+
command:
23+
- postgres
24+
- -c
25+
- shared_preload_libraries=vector
1926
volumes:
20-
- ./assets/es_data:/usr/share/elasticsearch/data
21-
postgres:
22-
image: postgres:17
23-
container_name: postgres
27+
- langgraph-data:/var/lib/postgresql/data
28+
healthcheck:
29+
test: pg_isready -U postgres
30+
start_period: 10s
31+
timeout: 1s
32+
retries: 5
33+
interval: 60s
34+
start_interval: 1s
35+
36+
langgraph-api:
2437
ports:
25-
- "5432:5432"
26-
volumes:
27-
- ./assets/postgres_data:/var/lib/postgresql/data
28-
- ./data:/docker-entrypoint-initdb.d
29-
environment:
30-
POSTGRES_USER: user
31-
POSTGRES_PASSWORD: password
32-
POSTGRES_DB: db
33-
restart: always
34-
jaeger:
35-
image: jaegertracing/all-in-one:1.72.0
36-
container_name: jaeger
37-
environment:
38-
- SPAN_STORAGE_TYPE=elasticsearch
39-
- ES_SERVER_URLS=http://elasticsearch:9200
40-
- LOG_LEVEL=debug
41-
ports:
42-
- "16686:16686" # to access the Jaeger UI
43-
- "4317:4317"
44-
- "4318:4318"
45-
- "5778:5778"
46-
- "9411:9411"
38+
- "8123:8000"
4739
depends_on:
48-
- elasticsearch
49-
restart: unless-stopped
50-
# FIXME: disable for now since its port conflicts with jaeger
51-
# otel-collector:
52-
# image: otel/opentelemetry-collector-contrib:latest
53-
# container_name: otel-collector
54-
# volumes:
55-
# - ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
56-
# ports:
57-
# - 1888:1888 # pprof extension
58-
# - 8888:8888 # Prometheus metrics exposed by the Collector
59-
# - 8889:8889 # Prometheus exporter metrics
60-
# - 13133:13133 # health_check extension
61-
# - 4317:4317 # OTLP gRPC receiver
62-
# - 4318:4318 # OTLP http receiver
63-
# - 55679:55679 # zpages extension
40+
langgraph-redis:
41+
condition: service_healthy
42+
langgraph-postgres:
43+
condition: service_healthy
44+
environment:
45+
REDIS_URI: redis://langgraph-redis:6379
46+
POSTGRES_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable
47+
healthcheck:
48+
test: python /api/healthcheck.py
49+
interval: 60s
50+
start_interval: 1s
51+
start_period: 10s
52+
env_file:
53+
- .env
54+
build:
55+
context: .
56+
dockerfile: langgraph.Dockerfile

langgraph.Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM langchain/langgraph-api:3.11
2+
3+
4+
5+
# -- Adding local package . --
6+
ADD . /deps/template-langgraph
7+
# -- End of local package . --
8+
9+
# -- Installing all local dependencies --
10+
RUN PYTHONDONTWRITEBYTECODE=1 uv pip install --system --no-cache-dir -c /api/constraints.txt -e /deps/*
11+
# -- End of local dependencies install --
12+
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"}'
13+
14+
15+
16+
# -- Ensure user deps didn't inadvertently overwrite langgraph-api
17+
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
18+
RUN PYTHONDONTWRITEBYTECODE=1 uv pip install --system --no-cache-dir --no-deps -e /api
19+
# -- End of ensuring user deps didn't inadvertently overwrite langgraph-api --
20+
# -- Removing build deps from the final image ~<:===~~~ --
21+
RUN pip uninstall -y pip setuptools wheel
22+
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
23+
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
24+
RUN uv pip uninstall --system pip setuptools wheel && rm /usr/bin/uv /usr/bin/uvx
25+
26+
WORKDIR /deps/template-langgraph

tools.docker-compose.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
services:
2+
qdrant:
3+
image: qdrant/qdrant:v1.15.1
4+
container_name: qdrant
5+
ports:
6+
- "6333:6333" # Dashboard: http://localhost:6333/dashboard
7+
volumes:
8+
- ./assets/qdrant_data:/qdrant/storage
9+
elasticsearch:
10+
build:
11+
dockerfile: elasticsearch.Dockerfile
12+
container_name: elasticsearch
13+
ports:
14+
- "9200:9200"
15+
- "9300:9300"
16+
environment:
17+
- discovery.type=single-node
18+
- xpack.security.enabled=false
19+
volumes:
20+
- ./assets/es_data:/usr/share/elasticsearch/data
21+
postgres:
22+
image: postgres:17
23+
container_name: postgres
24+
ports:
25+
- "5432:5432"
26+
volumes:
27+
- ./assets/postgres_data:/var/lib/postgresql/data
28+
- ./data:/docker-entrypoint-initdb.d
29+
environment:
30+
POSTGRES_USER: user
31+
POSTGRES_PASSWORD: password
32+
POSTGRES_DB: db
33+
restart: always
34+
jaeger:
35+
image: jaegertracing/all-in-one:1.72.0
36+
container_name: jaeger
37+
environment:
38+
- SPAN_STORAGE_TYPE=elasticsearch
39+
- ES_SERVER_URLS=http://elasticsearch:9200
40+
- LOG_LEVEL=debug
41+
ports:
42+
- "16686:16686" # to access the Jaeger UI
43+
- "4317:4317"
44+
- "4318:4318"
45+
- "5778:5778"
46+
- "9411:9411"
47+
depends_on:
48+
- elasticsearch
49+
restart: unless-stopped
50+
# FIXME: disable for now since its port conflicts with jaeger
51+
# otel-collector:
52+
# image: otel/opentelemetry-collector-contrib:latest
53+
# container_name: otel-collector
54+
# volumes:
55+
# - ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
56+
# ports:
57+
# - 1888:1888 # pprof extension
58+
# - 8888:8888 # Prometheus metrics exposed by the Collector
59+
# - 8889:8889 # Prometheus exporter metrics
60+
# - 13133:13133 # health_check extension
61+
# - 4317:4317 # OTLP gRPC receiver
62+
# - 4318:4318 # OTLP http receiver
63+
# - 55679:55679 # zpages extension

0 commit comments

Comments
 (0)