Giter Club home page Giter Club logo

Comments (13)

dosubot avatar dosubot commented on July 30, 2024 3

To deploy the Docker version of Langflow in production mode, follow these detailed instructions:

  1. Clone the LangFlow repository:

    git clone https://github.com/langflow-ai/langflow.git
  2. Navigate to the docker_example directory:

    cd langflow/docker_example
  3. Run the Docker Compose file:

    docker compose up

LangFlow will now be accessible at http://localhost:7860/.

Docker Compose Configuration

The Docker Compose configuration spins up multiple services including langflow, postgres, proxy, pgadmin, result_backend, celeryworker, flower, frontend, broker, prometheus, and grafana.

LangFlow Service

The langflow service uses the langflowai/langflow:latest Docker image and exposes port 7860. It depends on the postgres, broker, and result_backend services.

Environment variables:

  • LANGFLOW_DATABASE_URL: The connection string for the PostgreSQL database.
  • LANGFLOW_CONFIG_DIR: The directory where LangFlow stores logs, file storage, monitor data, and secret keys.

Volumes:

  • ../:/app
  • ./startup-backend.sh:/startup-backend.sh

Command:

The Dockerfile for LangFlow specifies the command to run the application:

FROM langflowai/langflow:latest

CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]

PostgreSQL Service

The postgres service uses the postgres:15.4 Docker image and exposes port 5432.

Environment variables:

  • POSTGRES_USER: The username for the PostgreSQL database.
  • POSTGRES_PASSWORD: The password for the PostgreSQL database.
  • POSTGRES_DB: The name of the PostgreSQL database.

Volumes:

  • app-db-data:/var/lib/postgresql/data/pgdata

Proxy Service

The proxy service uses the traefik:v3.0 Docker image and handles routing and SSL termination.

Environment variables:

  • Defined in .env file.

Volumes:

  • /var/run/docker.sock:/var/run/docker.sock

Command:

  • Various Traefik configuration commands to enable Docker provider, access logs, and the Traefik dashboard.

Additional Services

  • pgadmin: Uses dpage/pgadmin4 image for PostgreSQL management.
  • result_backend: Uses redis:6.2.5 image for Redis backend.
  • celeryworker: Uses the same image as langflow for Celery worker.
  • flower: Uses the same image as langflow for Celery Flower monitoring.
  • frontend: Uses ogabrielluiz/langflow_frontend:latest image for the frontend.
  • broker: Uses rabbitmq:3-management image for RabbitMQ.
  • prometheus: Uses prom/prometheus:v2.37.9 image for Prometheus monitoring.
  • grafana: Uses grafana/grafana:8.2.6 image for Grafana dashboards.

Switching to a Specific LangFlow Version

If you want to use a specific version of LangFlow, you can modify the image field under the langflow service in the Docker Compose file. For example, to use version 1.0-alpha, change langflowai/langflow:latest to langflowai/langflow:1.0-alpha.

Alternatively, you can use the following Dockerfile to specify the version:

FROM langflowai/langflow:1.0-alpha

CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"]

Alternative Deployment with Render

You can also deploy LangFlow using Render with the following configuration in a render.yaml file:

services:
  - type: web
    name: langflow
    runtime: docker
    dockerfilePath: ./Dockerfile
    repo: https://github.com/langflow-ai/langflow
    branch: main
    healthCheckPath: /health
    autoDeploy: false
    envVars:
      - key: LANGFLOW_DATABASE_URL
        value: sqlite:////home/user/.cache/langflow/langflow.db
    disk:
      name: langflow-data
      mountPath: /home/user/.cache/langflow

This configuration sets up a Docker web service for LangFlow, specifying the repository, branch, health check path, and environment variables. It also mounts a disk for persistent storage [1][2][3][4][5].

Details

About Dosu
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.

To continue the conversation, mention @dosu.

from langflow.

dosubot avatar dosubot commented on July 30, 2024 3

The error message indicates that the celery executable is not found in the $PATH within the celeryworker container. To resolve this, you need to ensure that celery is installed in the Docker image used for the celeryworker service.

Here are two ways to fix this issue:

Option 1: Modify the Dockerfile to Install celery

  1. Modify the Dockerfile:
    Ensure that the Dockerfile used for the backend and celeryworker services installs celery. Here is an example Dockerfile:

    # Dockerfile for langflowai/langflow
    FROM python:3.8-slim
    
    # Set the working directory
    WORKDIR /app
    
    # Copy the requirements file
    COPY requirements.txt .
    
    # Install the dependencies
    RUN pip install --no-cache-dir -r requirements.txt
    
    # Install celery
    RUN pip install celery
    
    # Copy the rest of the application code
    COPY . .
    
    # Set the entrypoint
    ENTRYPOINT ["sh", "/startup-backend.sh"]
  2. Rebuild the Docker Image:
    After updating the Dockerfile, rebuild the Docker image and push it to the appropriate repository if necessary.

  3. Update docker-compose.yml:
    Ensure your docker-compose.yml uses the updated image.

Option 2: Install celery in the docker-compose.yml

If you cannot modify the Dockerfile, you can install celery directly in the celeryworker service definition in docker-compose.yml:

  1. Update docker-compose.yml:
    Modify the celeryworker service to install celery before running the celery command:

    celeryworker:
      <<: *backend
      env_file:
        - .env
      command: /bin/sh -c "pip install celery && celery -A langflow.worker.celery_app worker --loglevel=INFO --concurrency=1 -n lf-worker@%h -P eventlet"
      healthcheck:
        test: "exit 0"
      deploy:
        replicas: 1

This command ensures that celery is installed each time the container starts.

By following either of these options, you should be able to resolve the issue with the celeryworker container failing to start due to the missing celery executable [1].

Details

About Dosu
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.

To continue the conversation, mention @dosu.

from langflow.

dosubot avatar dosubot commented on July 30, 2024 3

To fix the issue with the celeryworker container failing to start due to the missing celery executable, you can modify the docker-compose.yml to install celery before running the celery command. Here is how you can update your docker-compose.yml:

version: "3.8"

services:
  proxy:
    image: traefik:v3.0
    env_file:
      - .env
    networks:
      - ${TRAEFIK_PUBLIC_NETWORK?Variable not set}
      - default
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command:
      - --providers.docker
      - --providers.docker.constraints=Label(`traefik.constraint-label-stack`, `${TRAEFIK_TAG?Variable not set}`)
      - --providers.docker.exposedbydefault=false
      - --accesslog
      - --log
      - --api
    deploy:
      placement:
        constraints:
          - node.role == manager
      labels:
        - traefik.enable=true
        - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set}
        - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set}
        - traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.scheme=https
        - traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.permanent=true
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`)
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.entrypoints=http
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`)
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.entrypoints=https
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls=true
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls.certresolver=le
        - traefik.http.services.${STACK_NAME?Variable not set}-proxy.loadbalancer.server.port=80
        - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.regex=^https?://(www.)?(${DOMAIN?Variable not set})/(.*)
        - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.replacement=https://${DOMAIN?Variable not set}/$${3}
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.middlewares=${STACK_NAME?Variable not set}-www-redirect
        - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.middlewares=${STACK_NAME?Variable not set}-www-redirect,${STACK_NAME?Variable not set}-https-redirect

  backend: &backend
    image: "langflowai/langflow:latest"
    depends_on:
      - db
      - broker
      - result_backend
    env_file:
      - .env
    volumes:
      - ../:/app
      - ./startup-backend.sh:/startup-backend.sh
    command: /startup-backend.sh
    healthcheck:
      test: "exit 0"
    deploy:
      labels:
        - traefik.enable=true
        - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
        - traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=PathPrefix(`/api/v1`) || PathPrefix(`/docs`) || PathPrefix(`/health`)
        - traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=7860

  db:
    image: postgres:15.4
    volumes:
      - app-db-data:/var/lib/postgresql/data/pgdata
    environment:
      - PGDATA=/var/lib/postgresql/data/pgdata
    deploy:
      placement:
        constraints:
          - node.labels.app-db-data == true
    healthcheck:
      test: "exit 0"
    env_file:
      - .env

  pgadmin:
    image: dpage/pgadmin4
    networks:
      - ${TRAEFIK_PUBLIC_NETWORK?Variable not set}
      - default
    volumes:
      - pgadmin-data:/var/lib/pgadmin
    env_file:
      - .env
    deploy:
      labels:
        - traefik.enable=true
        - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set}
        - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set}
        - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.rule=Host(`pgadmin.${DOMAIN?Variable not set}`)
        - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.entrypoints=http
        - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.middlewares=${STACK_NAME?Variable not set}-https-redirect
        - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.rule=Host(`pgadmin.${DOMAIN?Variable not set}`)
        - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.entrypoints=https
        - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls=true
        - traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls.certresolver=le
        - traefik.http.services.${STACK_NAME?Variable not set}-pgadmin.loadbalancer.server.port=5050

  result_backend:
    image: redis:6.2.5
    env_file:
      - .env
    ports:
      - 6379:6379
    healthcheck:
      test: "exit 0"

  celeryworker:
    <<: *backend
    env_file:
      - .env
    command: /bin/sh -c "pip install celery && celery -A langflow.worker.celery_app worker --loglevel=INFO --concurrency=1 -n lf-worker@%h -P eventlet"
    healthcheck:
      test: "exit 0"
    deploy:
      replicas: 1

  flower:
    <<: *backend
    env_file:
      - .env
    networks:
      - default
    environment:
      - FLOWER_PORT=5555
    command: /bin/sh -c "celery -A langflow.worker.celery_app --broker=${BROKER_URL?Variable not set} flower --port=5555"
    deploy:
      labels:
        - traefik.enable=true
        - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set}
        - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set}
        - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.rule=Host(`flower.${DOMAIN?Variable not set}`)
        - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.entrypoints=http
        - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.middlewares=${STACK_NAME?Variable not set}-https-redirect
        - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.rule=Host(`flower.${DOMAIN?Variable not set}`)
        - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.entrypoints=https
        - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls=true
        - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls.certresolver=le
        - traefik.http.services.${STACK_NAME?Variable not set}-flower.loadbalancer.server.port=5555

  frontend:
    image: "ogabrielluiz/langflow_frontend:latest"
    env_file:
      - .env
    build:
      context: ../src/frontend
      dockerfile: Dockerfile
      args:
        - BACKEND_URL=http://backend:7860
    restart: on-failure
    deploy:
      labels:
        - traefik.enable=true
        - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
        - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=PathPrefix(`/`)
        - traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=80

  broker:
    image: rabbitmq:3-management
    environment:
      - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-admin}
      - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-admin}
    volumes:
      - rabbitmq_data:/etc/rabbitmq/
      - rabbitmq_data:/var/lib/rabbitmq/
      - rabbitmq_log:/var/log/rabbitmq/
    ports:
      - 5672:5672
      - 15672:15672

  prometheus:
    image: prom/prometheus:v2.37.9
    env_file:
      - .env
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    command:
      - "--config.file=/etc/prometheus/prometheus.yml"
    healthcheck:
      test: "exit 0"
    deploy:
      labels:
        - traefik.enable=true
        - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
        - traefik.http.routers.${STACK_NAME?Variable not set}-prometheus-http.rule=PathPrefix(`/metrics`)
        - traefik.http.services.${STACK_NAME?Variable not set}-prometheus.loadbalancer.server.port=9090

  grafana:
    image: grafana/grafana:8.2.6
    env_file:
      - .env
    volumes:
      - grafana_data:/var/lib/grafana
    deploy:
      labels:
        - traefik.enable=true
        - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
        - traefik.http.routers.${STACK_NAME?Variable not set}-grafana-http.rule=PathPrefix(`/grafana`)
        - traefik.http.services.${STACK_NAME?Variable not set}-grafana.loadbalancer.server.port=3000

volumes:
  grafana_data:
  app-db-data:
  rabbitmq_data:
  rabbitmq_log:
  pgadmin-data:

networks:
  traefik-public:
    external: false

This modification ensures that celery is installed each time the celeryworker container starts [1].

Details

About Dosu
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.

To continue the conversation, mention @dosu.

from langflow.

dosubot avatar dosubot commented on July 30, 2024 2

The __enter__ error you're encountering typically indicates an issue with context management in your Docker deployment. Here are some steps to help you troubleshoot and resolve this issue:

  1. Check docker-compose Configuration:
    Ensure that the command definitions in your docker-compose file are correctly set up. For example, verify the backend service command:

    backend:
      ...
      command: /startup-backend.sh
  2. Review /startup-backend.sh Script:
    Make sure the /startup-backend.sh script is correctly implemented and handles context management properly. The script should look like this:

    #!/bin/bash
    
    export LANGFLOW_DATABASE_URL="postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}"
    
    if [ "$ENVIRONMENT" = "development" ]; then
        echo "Starting backend in development mode"
        exec python -m uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --log-level ${LOG_LEVEL:-info} --workers 2 --reload
    else
        echo "Starting backend in production mode"
        exec langflow run --host 0.0.0.0 --port 7860 --log-level ${LOG_LEVEL:-info} --workers -1 --backend-only
    fi
  3. Inspect create_app Function:
    The create_app function in langflow.main uses a context manager for the application's lifespan. Ensure this is correctly implemented:

    from contextlib import asynccontextmanager
    from fastapi import FastAPI
    
    @asynccontextmanager
    async def lifespan(app: FastAPI):
        initialize_services()
        setup_llm_caching()
        LangfuseInstance.update()
        yield
        teardown_services()
    
    def create_app():
        app = FastAPI(lifespan=lifespan)
        # Additional setup...
        return app

    This context manager is responsible for initializing and tearing down services properly [1].

  4. Check Docker Logs:
    Review the logs from your Docker containers to identify any specific errors or issues during startup. The logs can provide more context on where the __enter__ error is occurring.

  5. Environment Variables:
    Ensure all necessary environment variables are correctly set in your .env file. Missing or incorrect environment variables can lead to context management issues.

By following these steps, you should be able to identify and resolve the __enter__ error in your Docker deployment. If the issue persists, further investigation into the specific scripts and commands being executed within your Docker containers may be necessary.

Details

About Dosu
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.

To continue the conversation, mention @dosu.

from langflow.

dosubot avatar dosubot commented on July 30, 2024 2

Here is an example .env configuration for Langflow:

# Description: Example of .env file
# Usage: Copy this file to .env and change the values
#        according to your needs
#        Do not commit .env file to git
#        Do not change .env.example file

# Config directory
# Directory where files, logs and database will be stored
# Example: LANGFLOW_CONFIG_DIR=~/.langflow
LANGFLOW_CONFIG_DIR=

# Save database in the config directory
# Values: true, false
# If false, the database will be saved in Langflow's root directory
# This means that the database will be deleted when Langflow is uninstalled
# and that the database will not be shared between different virtual environments
# Example: LANGFLOW_SAVE_DB_IN_CONFIG_DIR=true
LANGFLOW_SAVE_DB_IN_CONFIG_DIR=

# Database URL
# Postgres example: LANGFLOW_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/langflow
# SQLite example:
LANGFLOW_DATABASE_URL=sqlite:///./langflow.db

# Cache type
LANGFLOW_LANGCHAIN_CACHE=SQLiteCache

# Server host
# Example: LANGFLOW_HOST=127.0.0.1
LANGFLOW_HOST=

# Worker processes
# Example: LANGFLOW_WORKERS=1
LANGFLOW_WORKERS=

# Server port
# Example: LANGFLOW_PORT=7860
LANGFLOW_PORT=

# Logging level
# Example: LANGFLOW_LOG_LEVEL=critical
LANGFLOW_LOG_LEVEL=

# Path to the log file
# Example: LANGFLOW_LOG_FILE=logs/langflow.log
LANGFLOW_LOG_FILE=

# Path to the frontend directory containing build files
# Example: LANGFLOW_FRONTEND_PATH=/path/to/frontend/build/files
LANGFLOW_FRONTEND_PATH=

# Whether to open the browser after starting the server
# Values: true, false
# Example: LANGFLOW_OPEN_BROWSER=true
LANGFLOW_OPEN_BROWSER=

# Whether to remove API keys from the projects saved in the database
# Values: true, false
# Example: LANGFLOW_REMOVE_API_KEYS=false
LANGFLOW_REMOVE_API_KEYS=

# Whether to use RedisCache or InMemoryCache
# Values: memory, redis
# Example: LANGFLOW_CACHE_TYPE=memory
# If you want to use redis then the following environment variables must be set:
# LANGFLOW_REDIS_HOST (default: localhost)
# LANGFLOW_REDIS_PORT (default: 6379)
# LANGFLOW_REDIS_DB (default: 0)
# LANGFLOW_REDIS_CACHE_EXPIRE (default: 3600)
LANGFLOW_CACHE_TYPE=

# Set AUTO_LOGIN to false if you want to disable auto login
# and use the login form to login. LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD
# must be set if AUTO_LOGIN is set to false
# Values: true, false
LANGFLOW_AUTO_LOGIN=false

# Superuser username
# Example: LANGFLOW_SUPERUSER=admin
LANGFLOW_SUPERUSER=admin

# Superuser password
# Example: LANGFLOW_SUPERUSER_PASSWORD=123456
LANGFLOW_SUPERUSER_PASSWORD=123456

# Should store environment variables in the database
# Values: true, false
LANGFLOW_STORE_ENVIRONMENT_VARIABLES=

# STORE_URL
# Example: LANGFLOW_STORE_URL=https://api.langflow.store
# LANGFLOW_STORE_URL=

# DOWNLOAD_WEBHOOK_URL
#
# LANGFLOW_DOWNLOAD_WEBHOOK_URL=

# LIKE_WEBHOOK_URL
#
# LANGFLOW_LIKE_WEBHOOK_URL=

# Additional configurations from deploy/.env.example

DOMAIN=localhost
STACK_NAME=langflow-stack
ENVIRONMENT=development

TRAEFIK_PUBLIC_NETWORK=traefik-public
TRAEFIK_TAG=langflow-traefik
TRAEFIK_PUBLIC_TAG=traefik-public

# RabbitMQ configuration
RABBITMQ_DEFAULT_USER=langflow
RABBITMQ_DEFAULT_PASS=langflow

# Database configuration
DB_USER=langflow
DB_PASSWORD=langflow
DB_HOST=db
DB_PORT=5432
DB_NAME=langflow

# Logging configuration
LOG_LEVEL=debug

# DB configuration
POSTGRES_USER=langflow
POSTGRES_PASSWORD=langflow
POSTGRES_DB=langflow
POSTGRES_PORT=5432

# Flower configuration
LANGFLOW_CACHE_TYPE=redis
LANGFLOW_REDIS_HOST=result_backend
LANGFLOW_REDIS_PORT=6379
LANGFLOW_REDIS_DB=0
LANGFLOW_REDIS_EXPIRE=3600
LANGFLOW_REDIS_PASSWORD=
FLOWER_UNAUTHENTICATED_API=True
BROKER_URL=amqp://langflow:langflow@broker:5672
RESULT_BACKEND=redis://result_backend:6379/0
C_FORCE_ROOT="true"

# Frontend configuration
VITE_PROXY_TARGET=http://backend:7860/api/
BACKEND_URL=http://backend:7860

# PGAdmin configuration
PGADMIN_DEFAULT_EMAIL=[email protected]
PGADMIN_DEFAULT_PASSWORD=admin

# OpenAI configuration (for testing purposes)
OPENAI_API_KEY=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

# Superuser configuration
LANGFLOW_SUPERUSER=superuser
LANGFLOW_SUPERUSER_PASSWORD=superuser

# New user configuration
LANGFLOW_NEW_USER_IS_ACTIVE=False

Make sure to adjust the values according to your specific setup and requirements [1][2][3].

Details

About Dosu
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.

To continue the conversation, mention @dosu.

from langflow.

ogabrielluiz avatar ogabrielluiz commented on July 30, 2024 1

Hey @0FL01

How are you?
Try running the compose inside the docker_example folder. The one in the root folder is not up-to-date.

from langflow.

0FL01 avatar 0FL01 commented on July 30, 2024

@dosu
Example .env configuration?

from langflow.

0FL01 avatar 0FL01 commented on July 30, 2024

@dosu how deploy docker version in production mode?

from langflow.

0FL01 avatar 0FL01 commented on July 30, 2024

@dosu How do I fix it? Script attempt langflow/deploy -> docker-compose up -d (.env configured as per the example above)

[banka@telega deploy]$ docker-compose up -d WARN[0000] /home/banka/langflow/deploy/docker-compose.yml:versionis obsolete WARN[0000] /home/banka/langflow/deploy/docker-compose.override.yml:versionis obsolete [+] Running 10/11 ✔ Container deploy-db-1 Running 0.0s ✔ Container deploy-prometheus-1 Running 0.0s ✔ Container deploy-broker-1 Running 0.0s ✔ Container deploy-frontend-1 Running 0.0s ✔ Container deploy-result_backend-1 Running 0.0s ✔ Container deploy-proxy-1 Running 0.0s ✔ Container deploy-pgadmin-1 Running 0.0s ✔ Container deploy-grafana-1 Running 0.0s ✔ Container deploy-backend-1 Running 0.0s ✔ Container deploy-flower-1 Started 0.8s ⠙ Container deploy-celeryworker-1 Starting 1.1s Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "celery": executable file not found in $PATH: unknown

from langflow.

0FL01 avatar 0FL01 commented on July 30, 2024

The error message indicates that the celery executable is not found in the $PATH within the celeryworker container. To resolve this, you need to ensure that celery is installed in the Docker image used for the celeryworker service.

Here are two ways to fix this issue:

Option 1: Modify the Dockerfile to Install celery

1. **Modify the Dockerfile**:
   Ensure that the Dockerfile used for the `backend` and `celeryworker` services installs `celery`. Here is an example Dockerfile:
   ```dockerfile
   # Dockerfile for langflowai/langflow
   FROM python:3.8-slim
   
   # Set the working directory
   WORKDIR /app
   
   # Copy the requirements file
   COPY requirements.txt .
   
   # Install the dependencies
   RUN pip install --no-cache-dir -r requirements.txt
   
   # Install celery
   RUN pip install celery
   
   # Copy the rest of the application code
   COPY . .
   
   # Set the entrypoint
   ENTRYPOINT ["sh", "/startup-backend.sh"]
   ```

2. **Rebuild the Docker Image**:
   After updating the Dockerfile, rebuild the Docker image and push it to the appropriate repository if necessary.

3. **Update `docker-compose.yml`**:
   Ensure your `docker-compose.yml` uses the updated image.

Option 2: Install celery in the docker-compose.yml

If you cannot modify the Dockerfile, you can install celery directly in the celeryworker service definition in docker-compose.yml:

1. **Update `docker-compose.yml`**:
   Modify the `celeryworker` service to install `celery` before running the `celery` command:
   ```yaml
   celeryworker:
     <<: *backend
     env_file:
       - .env
     command: /bin/sh -c "pip install celery && celery -A langflow.worker.celery_app worker --loglevel=INFO --concurrency=1 -n lf-worker@%h -P eventlet"
     healthcheck:
       test: "exit 0"
     deploy:
       replicas: 1
   ```

This command ensures that celery is installed each time the container starts.

By following either of these options, you should be able to resolve the issue with the celeryworker container failing to start due to the missing celery executable [1].

Details

To continue the conversation, mention @dosu.

docker-compose.yml look like this
`
version: "3.8"

services:
proxy:
image: traefik:v3.0
env_file:
- .env
networks:
- ${TRAEFIK_PUBLIC_NETWORK?Variable not set}
- default
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
# Enable Docker in Traefik, so that it reads labels from Docker services
- --providers.docker
# Add a constraint to only use services with the label for this stack
# from the env var TRAEFIK_TAG
- --providers.docker.constraints=Label(traefik.constraint-label-stack, ${TRAEFIK_TAG?Variable not set})
# Do not expose all Docker services, only the ones explicitly exposed
- --providers.docker.exposedbydefault=false
# Enable the access log, with HTTP requests
- --accesslog
# Enable the Traefik log, for configurations and errors
- --log
# Enable the Dashboard and API
- --api
deploy:
placement:
constraints:
- node.role == manager
labels:
# Enable Traefik for this service, to make it available in the public network
- traefik.enable=true
# Use the traefik-public network (declared below)
- traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set}
# Use the custom label "traefik.constraint-label=traefik-public"
# This public Traefik will only use services with this label
- traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set}
# traefik-http set up only to use the middleware to redirect to https
- traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.scheme=https
- traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.permanent=true
# Handle host with and without "www" to redirect to only one of them
# Uses environment variable DOMAIN
# To disable www redirection remove the Host() you want to discard, here and
# below for HTTPS
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.rule=Host(${DOMAIN?Variable not set}) || Host(www.${DOMAIN?Variable not set})
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.entrypoints=http
# traefik-https the actual router using HTTPS
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.rule=Host(${DOMAIN?Variable not set}) || Host(www.${DOMAIN?Variable not set})
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.entrypoints=https
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls=true
# Use the "le" (Let's Encrypt) resolver created below
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls.certresolver=le
# Define the port inside of the Docker service to use
- traefik.http.services.${STACK_NAME?Variable not set}-proxy.loadbalancer.server.port=80
# Handle domain with and without "www" to redirect to only one
# To disable www redirection remove the next line
- traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.regex=^https?://(www.)?(${DOMAIN?Variable not set})/(.*)
# Redirect a domain with www to non-www
# To disable it remove the next line
- traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.replacement=https://${DOMAIN?Variable not set}/$${3}
# Redirect a domain without www to www
# To enable it remove the previous line and uncomment the next
# - traefik.http.middlewares.${STACK_NAME}-www-redirect.redirectregex.replacement=https://www.${DOMAIN}/$${3}
# Middleware to redirect www, to disable it remove the next line
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.middlewares=${STACK_NAME?Variable not set}-www-redirect
# Middleware to redirect www, and redirect HTTP to HTTPS
# to disable www redirection remove the section: ${STACK_NAME?Variable not set}-www-redirect,
- traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.middlewares=${STACK_NAME?Variable not set}-www-redirect,${STACK_NAME?Variable not set}-https-redirect

backend: &backend
image: "langflowai/langflow:latest"
depends_on:
- db
- broker
- result_backend
env_file:
- .env
volumes:
- ../:/app
- ./startup-backend.sh:/startup-backend.sh # Ensure the paths match
command: /startup-backend.sh # Fixed the path
healthcheck:
test: "exit 0"
deploy:
labels:
- traefik.enable=true
- traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=PathPrefix(/api/v1) || PathPrefix(/docs) || PathPrefix(/health)
- traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=7860

db:
image: postgres:15.4
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
deploy:
placement:
constraints:
- node.labels.app-db-data == true
healthcheck:
test: "exit 0"
env_file:
- .env

pgadmin:
image: dpage/pgadmin4
networks:
- ${TRAEFIK_PUBLIC_NETWORK?Variable not set}
- default
volumes:
- pgadmin-data:/var/lib/pgadmin
env_file:
- .env
deploy:
labels:
- traefik.enable=true
- traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set}
- traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set}
- traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.rule=Host(pgadmin.${DOMAIN?Variable not set})
- traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.entrypoints=http
- traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-http.middlewares=${STACK_NAME?Variable not set}-https-redirect
- traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.rule=Host(pgadmin.${DOMAIN?Variable not set})
- traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.entrypoints=https
- traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls=true
- traefik.http.routers.${STACK_NAME?Variable not set}-pgadmin-https.tls.certresolver=le
- traefik.http.services.${STACK_NAME?Variable not set}-pgadmin.loadbalancer.server.port=5050

result_backend:
image: redis:6.2.5
env_file:
- .env
ports:
- 6379:6379
healthcheck:
test: "exit 0"

celeryworker:
<<: *backend
env_file:
- .env
command: celery -A langflow.worker.celery_app worker --loglevel=INFO --concurrency=1 -n lf-worker@%h -P eventlet
healthcheck:
test: "exit 0"
deploy:
replicas: 1

flower:
<<: *backend
env_file:
- .env
networks:
- default
environment:
- FLOWER_PORT=5555

command: /bin/sh -c "celery -A langflow.worker.celery_app --broker=${BROKER_URL?Variable not set} flower --port=5555"
deploy:
  labels:
    - traefik.enable=true
    - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set}
    - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set}
    - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.rule=Host(`flower.${DOMAIN?Variable not set}`)
    - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.entrypoints=http
    - traefik.http.routers.${STACK_NAME?Variable not set}-flower-http.middlewares=${STACK_NAME?Variable not set}-https-redirect
    - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.rule=Host(`flower.${DOMAIN?Variable not set}`)
    - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.entrypoints=https
    - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls=true
    - traefik.http.routers.${STACK_NAME?Variable not set}-flower-https.tls.certresolver=le
    - traefik.http.services.${STACK_NAME?Variable not set}-flower.loadbalancer.server.port=5555

frontend:
image: "ogabrielluiz/langflow_frontend:latest"
env_file:
- .env
# user: your-non-root-user
build:
context: ../src/frontend
dockerfile: Dockerfile
args:
- BACKEND_URL=http://backend:7860
restart: on-failure
deploy:
labels:
- traefik.enable=true
- traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=PathPrefix(/)
- traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=80

broker:
# RabbitMQ management console
image: rabbitmq:3-management
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER:-admin}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS:-admin}
volumes:
- rabbitmq_data:/etc/rabbitmq/
- rabbitmq_data:/var/lib/rabbitmq/
- rabbitmq_log:/var/log/rabbitmq/
ports:
- 5672:5672
- 15672:15672

prometheus:
image: prom/prometheus:v2.37.9
env_file:
- .env
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- "--config.file=/etc/prometheus/prometheus.yml"
# ports:
# - 9090:9090
healthcheck:
test: "exit 0"
deploy:
labels:
- traefik.enable=true
- traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
- traefik.http.routers.${STACK_NAME?Variable not set}-prometheus-http.rule=PathPrefix(/metrics)
- traefik.http.services.${STACK_NAME?Variable not set}-prometheus.loadbalancer.server.port=9090

grafana:
image: grafana/grafana:8.2.6
env_file:
- .env
# ports:
# - 3000:3000
volumes:
- grafana_data:/var/lib/grafana
deploy:
labels:
- traefik.enable=true
- traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
- traefik.http.routers.${STACK_NAME?Variable not set}-grafana-http.rule=PathPrefix(/grafana)
- traefik.http.services.${STACK_NAME?Variable not set}-grafana.loadbalancer.server.port=3000

volumes:
grafana_data:
app-db-data:
rabbitmq_data:
rabbitmq_log:
pgadmin-data:

networks:
traefik-public:
# Allow setting it to false for testing
external: false # ${TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL-true}

`

from langflow.

0FL01 avatar 0FL01 commented on July 30, 2024

Hi @ogabrielluiz

As I understand it docker_example is an old version of langflow? I would like to have access to authorization and API, or is there any way to enable the latest version?

Is it possible to switch the main version from development to production? When trying to specify .env environment=production, nothing changes, the startup happens at the delepment level

from langflow.

ogabrielluiz avatar ogabrielluiz commented on July 30, 2024

The docker_example folder contains two docker-compose files. The one starting with pre. runs Langflow 1.0-alpha.

What do you mean by production mode? Do you want logs to be different?

from langflow.

0FL01 avatar 0FL01 commented on July 30, 2024

@ogabrielluiz
I think I misunderstood you and you me, I would like to throw langflow on vds and attach to the domain and have access from other devices (for this I would like to have authorization and access via API), as I understand this version is still in the "early stages of development" and is not ready yet?

P.S To use in a scenario similar to n8n

from langflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.