langgraph/how-tos/deploy-self-hosted/ #2460
Replies: 14 comments 14 replies
-
This does not work at all. Running into a ton of issues running the application locally using docker and docker compose. |
Beta Was this translation helpful? Give feedback.
-
I am successfully running my application locally on Docker and it's working fine on Langgraph Studio. However, I have a node.js frontend and I am getting the following error message. Unhandled Runtime Error Call Stack It seem I am not hooking properly to the API server. What configuration do I need to do to properly connect the local API server to the frontend client? What values to I need to set for the following environmental variables? |
Beta Was this translation helpful? Give feedback.
-
When I use the docker compose, the error print like this:
The docker-compose.yml is below: volumes:
langgraph-data:
driver: local
services:
langgraph-redis:
image: redis:6
healthcheck:
test: redis-cli ping
interval: 5s
timeout: 1s
retries: 5
langgraph-postgres:
image: postgres:16
ports:
- "5433:5432"
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- langgraph-data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U postgres
start_period: 10s
timeout: 1s
retries: 5
interval: 5s
langgraph-api:
image: langgraph-image
ports:
- "8123:8000"
depends_on:
langgraph-redis:
condition: service_healthy
langgraph-postgres:
condition: service_healthy
env_file:
- .env
environment:
REDIS_URI: redis://langgraph-redis:6379
LANGSMITH_API_KEY: <...>
POSTGRES_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable |
Beta Was this translation helpful? Give feedback.
-
Langgraph Studio and CLI problem: Graph not found Hi all, Happy Xmas! I am stuck for a week trying to make my langgraph project work with Langgraph Visual Studio and haven't found the root cause yet. Module 6 deployment and rag-research-agent-template both work fine. I've compared the langgraph.json, pyproject.toml, and docker-compose.yml but no lucky. The building process finishes successfully. Has anyone faced similar issue? Thanks in advance for any help. Alexandre |
Beta Was this translation helpful? Give feedback.
-
Hello, I was wondering (Haven't started building with the platform yet) if with the LangGraph Platform/Server I can also deploy multiple and separate/different applications so that like there may be two compleately different graphs and endpoints for two completely different business logics. |
Beta Was this translation helpful? Give feedback.
-
What are the limits on the given docker file with langgraph's URIs? I am assuming langgraph's redis and postgres are not supposed to be used for deployment, correct? |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Some advice.
The best way to get this structure and all the necessary files is to install langgraph-cli and run When you are importing stuff from utils into your graph.py you should use in the {
"dependencies": ["."],
"graphs": {
"agent": "./src/your_agent/graph.py:_graph" #path to your graph file and import variable name that holds your compiled graph
},
"env": ".env"
} You need to change some lines in pyproject.toml
The rest you can leave as is. You can run Finally if your curl command fails at the end, try this instead: |
Beta Was this translation helpful? Give feedback.
-
What If I don't want to use LangSmith. Is there a way to do so. |
Beta Was this translation helpful? Give feedback.
-
I use the docker compose as given in the tutorial and I am not able to see my checkpoints in postgres. Whenever I restart the api server I can't access the same threads by id. I tried providing a Postgres checkpointer when compiling the graph but it didn't help. I can see that the "checkpoints" table is created in postgres and no connections warnings when I start the server instance, but it just doesn't write to it.. |
Beta Was this translation helpful? Give feedback.
-
I successfully built the Docker image following the examples, and it is working. Now, for various use cases, I will be adding different agents as mentioned in the documentation and adding them to the langgraph.json. Is there any way to dynamically update the langgraph.json so that the Docker container picks it up without having to rebuild, or is there a better way to do this? My functionality is that I will let users define their own agent structure in my app, and based on the data, I will generate the Python code for the LangGraph application and serve it using a self-hosted LangGraph server. Appreciate if someone could help me on this! |
Beta Was this translation helpful? Give feedback.
-
For anyone struggling with CORS related issues when trying to access a locally hosted LangGraph server from LangSmith web Studio interface here's a solution which worked for me. Problem:
Solution:The solution I took was to build a nginx proxy which adds the missing headers to allow cross-origin requests. This can be done fairly simply using docker and docker compose. I outline the steps below. All carried out in my project root directory. Nginx docker imageCreate a
What this is doing:
Create a FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
CMD ["nginx", "-g", "daemon off;"] Docker Compose adjustmentsModify your Docker Compose file volumes:
langgraph-data:
driver: local
services:
langgraph-redis:
image: redis:6
healthcheck:
test: redis-cli ping
interval: 5s
timeout: 1s
retries: 5
langgraph-postgres:
image: postgres:16
ports:
- "5433:5432"
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- langgraph-data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U postgres
start_period: 10s
timeout: 1s
retries: 5
interval: 5s
langgraph-api:
image: ${IMAGE}
#network_mode: "host" -- linux only
ports:
- "8000:8000" #<===== NOTE this change
depends_on:
langgraph-redis:
condition: service_healthy
langgraph-postgres:
condition: service_healthy
env_file:
- .env
environment:
REDIS_URI: redis://langgraph-redis:6379
LANGSMITH_API_KEY: ${LANGSMITH_API_KEY}
POSTGRES_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable
nginx-reverse-proxy:
image: nginx-linker:latest. #<========NOTE change your Docker build tag if you change this!
ports:
- "8123:8123"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
depends_on:
- langgraph-api. #<======== NOTE this must be the name of your langgraph-api service Build and launchBuild everything, then deploy it (from your project root / same location as your DockerFile + Compose.yml)
Test each of the elements work as intended
For some reason Chrome did not complain about the request also being http, from an https origin so this worked for me. If you wanted to also add in https this would be possible with a self-signed certificate and some extension to the nginx setup. You could probably also streamline the build approach. |
Beta Was this translation helpful? Give feedback.
-
Is langgraph-api docker image open source? I can't find langgraph-api Python source code, only JS source code here. https://github.com/langchain-ai/langgraphjs-api langgraph-api docker image: https://hub.docker.com/r/langchain/langgraph-api |
Beta Was this translation helpful? Give feedback.
-
I got redis issue on langgraph cloud : How do i increase the redis buffer? Or Any Suggestion? Thanks |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
langgraph/how-tos/deploy-self-hosted/
Build language agents as graphs
https://langchain-ai.github.io/langgraph/how-tos/deploy-self-hosted/
Beta Was this translation helpful? Give feedback.
All reactions