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

Problems with Docker Compose not being able to find the backend #1327

Closed
RielKIM opened this issue Jan 12, 2024 · 3 comments
Closed

Problems with Docker Compose not being able to find the backend #1327

RielKIM opened this issue Jan 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@RielKIM
Copy link
Contributor

RielKIM commented Jan 12, 2024

Describe the bug
When using Docker Compose to run services, there is often an issue where the frontend starts before the backend, leading to the frontend not being able to find the backend and thus preventing components from loading.

Browser and Version

  • Browser [e.g. chrome, safari] : edge
  • Version [e.g. 22] : 120

To Reproduce
Steps to reproduce the behavior:

  1. docker-compose up (Occasionally occurring)

Screenshots
image

Additional context
Add any other context about the problem here.

Copy link

dosubot bot commented Jan 12, 2024

🤖

Hey there @RielKIM! 👋 I'm Dosu, your friendly neighborhood bot. I'm here to help you debug issues, answer questions, and become a super contributor to langflow. While we're waiting for a human maintainer, feel free to ask me anything. Let's make code fun! 😸

Based on the information you've provided, it seems like the frontend service is starting before the backend service is ready to accept connections. This is a common issue in Docker Compose where one service depends on another.

To resolve this issue, you can add a wait-for-it script in your frontend service. This script will delay the start of the frontend service until the backend service is ready to accept connections.

Here's how you can modify your docker-compose.debug.yml file:

version: "3.4"

services:
  backend:
    volumes:
      - ./:/app
    build:
      context: ./
      dockerfile: ./dev.Dockerfile
    command:
      [
        "sh",
        "-c",
        "pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 -m uvicorn --factory src.backend.langflow.main:create_app --host 0.0.0.0 --port 7860 --reload",
      ]
    ports:
      - 7860:7860
      - 5678:5678
    restart: on-failure

  frontend:
    build:
      context: ./src/frontend
      dockerfile: ./dev.Dockerfile
      args:
        - BACKEND_URL=http:https://backend:7860
    command: ["./wait-for-it.sh", "backend:7860", "--", "npm", "start"]
    ports:
      - "3000:3000"
    volumes:
      - ./src/frontend/public:/home/node/app/public
      - ./src/frontend/src:/home/node/app/src
      - ./src/frontend/package.json:/home/node/app/package.json
      - ./wait-for-it.sh:/home/node/app/wait-for-it.sh
    restart: on-failure

In this modification, I've added a new command to the frontend service that uses the wait-for-it.sh script to wait for the backend service to be ready before starting the frontend service. I've also added a new volume to copy the wait-for-it.sh script into the frontend service's container.

Please note that you'll need to add the wait-for-it.sh script to your project. You can find this script at https://github.com/vishnubob/wait-for-it.

I hope this helps! If you have any other questions, feel free to ask.

Best,
Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added the bug Something isn't working label Jan 12, 2024
@anovazzi1
Copy link
Contributor

@RielKIM it's working now?

@RielKIM
Copy link
Contributor Author

RielKIM commented Mar 21, 2024 via email

@dosubot dosubot bot added the stale label Jun 20, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2024
@dosubot dosubot bot removed the stale label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants