Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is is possible to fully run on docker compose? #221

Open
HeMuling opened this issue Dec 25, 2024 · 2 comments
Open

Is is possible to fully run on docker compose? #221

HeMuling opened this issue Dec 25, 2024 · 2 comments

Comments

@HeMuling
Copy link

I tried:

services:
  open-canvas:
    build: .
    env_file: .env
    ports:
      - "3000:3000"
    depends_on:
      - langgraph
      - db
      - redis
    environment:
      - LANGCHAIN_TRACING_V2=${LANGCHAIN_TRACING_V2}
      - LANGCHAIN_API_KEY=${LANGCHAIN_API_KEY}
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - GOOGLE_API_KEY=${GOOGLE_API_KEY}
      - FIREWORKS_API_KEY=${FIREWORKS_API_KEY}
      - NEXT_PUBLIC_FIREWORKS_ENABLED=${NEXT_PUBLIC_FIREWORKS_ENABLED}
      - NEXT_PUBLIC_GEMINI_ENABLED=${NEXT_PUBLIC_GEMINI_ENABLED}
      - NEXT_PUBLIC_ANTHROPIC_ENABLED=${NEXT_PUBLIC_ANTHROPIC_ENABLED}
      - NEXT_PUBLIC_OPENAI_ENABLED=${NEXT_PUBLIC_OPENAI_ENABLED}
      - NEXT_PUBLIC_AZURE_ENABLED=${NEXT_PUBLIC_AZURE_ENABLED}
      - LANGGRAPH_API_URL=${LANGGRAPH_API_URL}
      - NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}
      - NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}
      - _AZURE_OPENAI_API_KEY=${_AZURE_OPENAI_API_KEY}
      - _AZURE_OPENAI_API_INSTANCE_NAME=${_AZURE_OPENAI_API_INSTANCE_NAME}
      - _AZURE_OPENAI_API_DEPLOYMENT_NAME=${_AZURE_OPENAI_API_DEPLOYMENT_NAME}
      - _AZURE_OPENAI_API_VERSION=${_AZURE_OPENAI_API_VERSION}

  langgraph:
    image: langchain/langgraphjs-api:20
    command: LANGSMITH_API_KEY=${LANGCHAIN_API_KEY} langgraph up --watch --port 54367
    environment:
      - LANGSMITH_API_KEY=${LANGCHAIN_API_KEY}
      - DATABASE_URI=postgresql://user:password@db:5432/mydatabase
      - REDIS_URI=redis://redis:6379
      - PORT=54367
    ports:
      - "54367:54367"

  db:
    image: postgres:15
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=mydatabase
    ports:
      - "5432:5432"

  redis:
    image: redis:7
    ports:
      - "6379:6379"

and for dockerfile:

FROM node:20

WORKDIR /app

COPY package*.json ./
RUN yarn install

COPY . .

ENV NODE_ENV development
ENV LANGGRAPH_API_URL=http://langgraph:54367
ENV NEXT_PUBLIC_LANGGRAPH_API_URL=http://langgraph:54367
ENV NEXT_PUBLIC_BASE_URL=http://langgraph:54367/api

EXPOSE 3000

CMD ["yarn", "dev"]

But it always fail with log:

yarn run v1.22.22
$ next dev
  ▲ Next.js 14.2.10
  - Local:        http://localhost:3000
  - Environments: .env

 ✓ Starting...
 ✓ Ready in 4.2s
 ✓ Compiled /src/middleware in 119ms
 ✓ Compiled (143 modules)
 ○ Compiling / ...
 ✓ Compiled /_not-found in 59.7s (10419 modules)
 GET /sw.js 404 in 31605ms
 GET / 200 in 61873ms
 GET / 200 in 120ms
 GET /sw.js 404 in 22ms
 ○ Compiling /api/[..._path] ...
 ✓ Compiled /api/[..._path] in 1988ms (4629 modules)
ERROR IN PROXY 404 Not Found
 GET /api/threads/5b796332-7638-48cc-9a50-8a784145df04 404 in 3545ms
 POST /api/threads/search 200 in 3592ms
 POST /api/threads/search 200 in 4331ms
ERROR IN PROXY 404 Not Found
 POST /api/assistants/search 404 in 3570ms
ERROR IN PROXY 404 Not Found
 POST /api/assistants 404 in 226ms
ERROR IN PROXY 404 Not Found
 GET /api/threads/5b796332-7638-48cc-9a50-8a784145df04 404 in 160ms
 POST /api/threads 200 in 288ms
 POST /api/threads 200 in 213ms
 POST /api/threads/search 200 in 195ms
 POST /api/threads/search 200 in 177ms
 GET /sw.js 404 in 130ms

so I'm wondering if it is possible to run on docker compose?

@HARISH-VARMA-GIT
Copy link

@HeMuling
It is possible to run fully on docker compose
I got the same erorr before (ERROR IN PROXY 404 Not Found) .I think this error occurs when there is an issue with the Langgraph server.
It worked for me when I used this Dockerfile for the Langgraph server:

FROM langchain/langgraphjs-api:20
ADD . /deps/open-canvas

RUN cd /deps/open-canvas && yarn install --frozen-lockfile

ENV LANGSERVE_GRAPHS='{
    "agent": "./src/agent/open-canvas/index.ts:graph",
    "reflection": "./src/agent/reflection/index.ts:graph",
    "thread_title": "./src/agent/thread-title/index.ts:graph"
}'

WORKDIR /deps/open-canvas

RUN (test ! -f /api/langgraph_api/js/build.mts && echo "Prebuild script not found, skipping") || tsx /api/langgraph_api/js/build.mts

This Dockerfile is generated from the langgraph.json file located in the root directory of open-canvas. Ensure that you build it before running the docker-compose command.

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: open-canvas:latest
    ports:
      - "57318: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: YOUR_API_KEY
      POSTGRES_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable

@tisDDM
Copy link

tisDDM commented Jan 4, 2025

No need to write the Dockerfile on your own. Just use langgraph build or langgraph dockerfile
https://langchain-ai.github.io/langgraph/cloud/reference/cli/#build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants