langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
33.66k stars 4.08k forks source link

Starting all from Docker image fails #1745

Closed tacass closed 3 months ago

tacass commented 6 months ago

Describe the bug This is really two different issues, but I'll put them both here. To get the dockerized app to start I had to make this change in v1.0.0a23

diff --git a/docker-compose.yml b/docker-compose.yml
index c74447899..ed1cc0b42 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -13,7 +13,7 @@ services:
       - "7860:7860"
     volumes:
       - ./:/app
-    command: bash -c "uvicorn --factory src.backend.langflow.main:create_app --host 0.0.0.0 --port 7860 --reload"
+    command: bash -c "uvicorn --factory src.backend.base.langflow.main:create_app --host 0.0.0.0 --port 7860 --reload"
     networks:
       - langflow
   frontend:

I'm not an expert in asyncio in this context, but to allow it to run I made this change:

diff --git a/src/backend/base/langflow/main.py b/src/backend/base/langflow/main.py
index 81797dc80..eae68c961 100644
--- a/src/backend/base/langflow/main.py
+++ b/src/backend/base/langflow/main.py
@@ -38,7 +38,7 @@ def get_lifespan(fix_migration=False, socketio_server=None):

     @asynccontextmanager
     async def lifespan(app: FastAPI):
-        nest_asyncio.apply()
+
         # Startup message
ogabrielluiz commented 6 months ago

Hey @tacass Thanks for this! The asyncio problem is that when running using uvicorn directly we need to pass --loop asyncio because of the nest_asyncio.

Now, if you just want to run Langflow in a docker container, you should use the logspace/langflow:1.0-alpha image.

If you want to build the docker image yourself, you should probably use langflow.main:create_app instead of thesrc.backend....

The Dockerfiles in the root folder are still in need of updates, that's why they don't work.

You can take a look in the docker_example folder for some more up-to-date examples.

ogabrielluiz commented 6 months ago

Would you be willing to test this PR out? #1751

tacass commented 6 months ago

I won't be able to do it today, but I can take a look at it tomorrow. Did you intend to include -loop asyncio in the uvicorn launch in the docker version?

lgertel commented 6 months ago

Would you be willing to test this PR out? #1751

It seems not working yet.

backend-1 | Error: Invalid value for '--loop': 'asyncio,' is not one of 'auto', 'asyncio', 'uvloop'.

I'm taking a look but there is a lot of Dockerfiles!

qwaszaq commented 6 months ago

anyone solved the issue with docker compose for the whole stuff?

anovazzi1 commented 4 months ago

Hello @qwaszaq, Sorry for the delay. Did you try using the new version? Does the error still persist?

carlosrcoelho commented 3 months ago

Hi @tacass and @qwaszaq ,


We hope you're doing well. Just a friendly reminder that if we do not hear back from you within the next 3 days, we will close this issue. If you need more time or further assistance, please let us know.


Thank you for your understanding!

carlosrcoelho commented 3 months ago

Thank you for your contribution! This issue will be closed. If you have any questions or encounter another problem, please open a new issue and we will be ready to assist you.