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

Docker deployment with custom DB #6892

Open
eidmann opened this issue Mar 1, 2025 · 1 comment
Open

Docker deployment with custom DB #6892

eidmann opened this issue Mar 1, 2025 · 1 comment
Labels
question Further information is requested

Comments

@eidmann
Copy link

eidmann commented Mar 1, 2025

Hello i am trying to deploy Langflow on GCP by storing container versions in Artifact Registry for version control and rollback, with a custom postgre DB. But i am new to Docker so i am trying to figure out the Docker configurations in the Langflow Repo. I can run the docker compose in the docker_example and just replace LANGFLOW_DATABASE_URL= with my connection string. But that still runs the default postgres service, which i dont need. So what i am asking for i some guidance on a more production suited solution and what are the 'docker' and 'deploy' folders used for?

I have tried creating a .env file and running the command

docker run -it --rm
-p 7860:7860
--env-file .env
langflowai/langflow:latest

following the instructions on https://docs.langflow.org/deployment-docker#clone-the-repo-and-build-the-langflow-docker-container
but then i am unable to access the site on my localhost.

I would highly apreciate any guidance on where i should be looking or how i should aproach this. Thanks

@dosubot dosubot bot added the question Further information is requested label Mar 1, 2025
Copy link

dosubot bot commented Mar 1, 2025

Hey @eidmann! I'm here to help you with any issues or questions you have about Langflow. Let's figure this out together!

I found a similar unsolved discussion that might be relevant: Serverless deployment with google cloud storage [1].

To deploy Langflow with a custom PostgreSQL database and exclude the default PostgreSQL service, you can modify the Docker Compose file. Here's how you can do it:

  1. Modify the Docker Compose File: Remove or comment out the postgres service section and any references to it in the langflow service. Update the LANGFLOW_DATABASE_URL with your custom database connection string. Here's an example:

    version: '3.8'
    
    services:
      langflow:
        image: langflowai/langflow:latest
        ports:
          - "7860:7860"
        environment:
          LANGFLOW_DATABASE_URL: "your_database_url"  # Update with your own database URL
          LANGFLOW_CONFIG_DIR: "/var/lib/langflow"
        volumes:
          - langflow-data:/var/lib/langflow
        # Remove the dependency on the postgres service
        # depends_on:
        #   - postgres
    
    # Remove the entire postgres service section
    #  postgres:
    #    image: postgres:16
    #    environment:
    #      POSTGRES_USER: your_user
    #      POSTGRES_PASSWORD: your_password
    #      POSTGRES_DB: your_db
    #    volumes:
    #      - langflow-postgres:/var/lib/postgresql/data
    
    volumes:
      langflow-data:
      # langflow-postgres:  # Remove this volume if not used elsewhere
  2. Environment Variables: Ensure your .env file is correctly set up with the LANGFLOW_DATABASE_URL pointing to your custom PostgreSQL database:

    LANGFLOW_DATABASE_URL="postgresql://user:password@host:port/dbname"
    
  3. Accessing the Site: If you're unable to access the site on localhost, double-check your port mapping in the Docker Compose file and ensure the Docker container is running without errors. You can also check the logs for any issues.

Regarding the 'docker' and 'deploy' folders, I couldn't find specific information about their contents in the repository. They likely contain configurations and scripts for managing Docker deployments, but you might need to explore them directly in the repository for more details.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

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

No branches or pull requests

1 participant