langflow icon indicating copy to clipboard operation
langflow copied to clipboard

LangFlow 1.1.0 crashes on startup without root fs permissions

Open devinbost opened this issue 3 months ago • 1 comments

Bug Description

Creating cache file requires running container as root user in LangFlow 1.1.0.

Stack trace indicates that it's crashing when attempting to create the cache_dir.

Screenshot 2024-11-18 at 4 31 44 AM

Reproduction

Start langflow with the following docker compose:

  langflow:
    image: langflowai/langflow:v1.1.0
    ports:
      - "7860:7860"
    depends_on:
      - postgres
      - registry
    command: ["langflow", "run", "--env-file", "/app/.env", "--host", "0.0.0.0", "--port", "7860"]
    working_dir: /app
    environment:
      - LANGFLOW_WORKERS=1
      - LANGFLOW_STORE_ENVIRONMENT_VARIABLES=true
      - LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=HUGGINGFACE_MODEL_PATH, ...
      - COLUMNS=200
      - LANGFLOW_LOAD_FLOWS_PATH=/app/flows
    networks:
      - langflow-network

Interestingly, on one VM, I was able to bypass the issue by adding this section:

    volumes:
      - ./langflow-tmp/cache:/app/data/.cache

However, it didn't work in the customer's environment. The only workaround was to to add the root user to the container:

  langflow:
    image: langflowai/langflow:v1.1.0
    user: "0:0"
    ports:
      - "7860:7860"
    command: ["langflow", "run", "--env-file", "/app/.env", "--host", "0.0.0.0", "--port", "7860"]
    working_dir: /app
    environment:
      - LANGFLOW_WORKERS=1
      - LANGFLOW_STORE_ENVIRONMENT_VARIABLES=true
      - LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=HUGGINGFACE_MODEL_PATH, ...
      - COLUMNS=200
      - LANGFLOW_LOAD_FLOWS_PATH=/app/flows
    networks:
      - langflow-network

Expected behavior

Root user should not be required to run the container or create the cache files.

Who can help?

@cbornet ?

Operating System

RHEL 8.10

Langflow Version

1.1.0

Python Version

None

Screenshot

No response

Flow File

No response

devinbost avatar Nov 18 '24 17:11 devinbost