Deployment - janardhanhere/langgraph-deployment-kit GitHub Wiki

Deployment Guide

This guide explains how to deploy the LangGraph Deployment Kit to production environments.

Deployment Options

There are several ways to deploy the kit:

  1. Directly on a server
  2. Using Docker
  3. Using a cloud platform (AWS, Azure, GCP)

Direct Server Deployment

Prerequisites

  • Python 3.11 or higher
  • A server with appropriate networking
  • API keys for your LLM providers

Steps

  1. Clone the repository on your server:

    git clone https://github.com/your-username/langgraph-deployment-kit.git
    cd langgraph-deployment-kit
    
  2. Create a virtual environment and install dependencies:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -e .
    
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with production settings
    
  4. Start the service (with a process manager like supervisord):

    python src/run_service.py
    

Docker Deployment

Prerequisites

  • Docker installed
  • Docker Compose (optional, for more complex setups)

Steps

  1. Create a Dockerfile in the root directory:

    FROM python:3.12-slim
    
    WORKDIR /app
    
    COPY . .
    
    RUN pip install -e .
    
    EXPOSE 8080
    
    CMD ["python", "src/run_service.py"]
    
  2. Build and run the Docker container:

    docker build -t langgraph-deployment-kit .
    docker run -p 8080:8080 --env-file .env langgraph-deployment-kit
    

Cloud Deployment

AWS Elastic Beanstalk

  1. Install the AWS EB CLI
  2. Configure your application:
    eb init
    
  3. Create an environment and deploy:
    eb create
    

Google Cloud Run

  1. Install the Google Cloud SDK
  2. Build and push your Docker image:
    gcloud builds submit --tag gcr.io/your-project/langgraph-deployment-kit
    
  3. Deploy to Cloud Run:
    gcloud run deploy --image gcr.io/your-project/langgraph-deployment-kit --platform managed
    

Production Considerations

Security

  • Always set AUTH_SECRET to a strong random string
  • Use HTTPS in production environments
  • Consider using a reverse proxy like Nginx

Scaling

  • For high traffic, consider using a database like PostgreSQL instead of SQLite
  • Set up proper monitoring and logging
  • Implement rate limiting if needed

Monitoring

  • Set up Langfuse for observability
  • Consider adding Prometheus metrics
  • Set up uptime monitoring

Environment Variables

Key environment variables for production:

  • MODE: Set to "deployment" in production
  • HOST and PORT: Configure according to your environment
  • AUTH_SECRET: A secure authentication key
  • DATABASE_TYPE: "postgres" recommended for production
  • POSTGRES_*: Configure your PostgreSQL connection