Deploying Langflow: An Open-Source Visual Framework for Building AI Applications A developer published a step-by-step guide for self-hosting Langflow, an open-source low-code visual framework for building AI agents, workflows, and RAG applications, on a Linux server using Docker Compose. The deployment covers PostgreSQL persistence, Traefik reverse proxying with automatic HTTPS, editor authentication, and validation through a RAG chatbot that answers questions from an uploaded document. The guide notes that Langflow flows can run as API endpoints or Model Context Protocol servers without extra boilerplate code. Langflow https://github.com/langflow-ai/langflow is an open-source, low-code visual framework for building artificial intelligence AI agents, workflows, and retrieval-augmented generation RAG applications. Developers use its visual builder to assemble large language model LLM pipelines from prebuilt components and test them in an interactive Playground, and finished flows run as API endpoints or Model Context Protocol MCP servers without extra boilerplate code. This guide walks through self-hosting a production-ready Langflow instance on a Linux server with Docker Compose, covering PostgreSQL persistence, Traefik reverse proxying with automatic HTTPS certificates, authentication for the visual editor, and validation of the deployment through a RAG chatbot that answers questions from an uploaded document. By the end, you'll have a secured Langflow deployment running behind HTTPS with a working RAG chatbot proving that ingestion, retrieval, and generation all work end to end. Before you begin, you need a Linux-based server with at least 2 CPU cores and 4 GB of RAM as a non-root user with sudo privileges, Docker and Docker Compose installed, a domain A record pointing to the server's public IP address for example, langflow.example.com , and an API key from a supported LLM provider — this deployment uses OpenAI models for embeddings and chat responses. Langflow reads its runtime configuration from environment variables, so a dedicated project directory with a .env file keeps credentials out of the Compose manifest. 1. Create the project directory and switch into it: bash $ mkdir ~/langflow && cd ~/langflow 2. Generate a Langflow secret key and write it to the environment file: python $ python3 -c "from secrets import token urlsafe; print f'LANGFLOW SECRET KEY={token urlsafe 32 }' " .env Langflow encrypts stored credentials with this Fernet key. Without an explicit key, Langflow generates a random one at startup and encrypted values become unreadable after a restart. 3. Verify that the file contains the key without displaying its value: bash $ grep -c "LANGFLOW SECRET KEY" .env Output: 1 4. Open the .env file with a text editor such as nano : bash $ nano .env 5. Add the following variables below the existing LANGFLOW SECRET KEY line, replacing every placeholder with your own values: Domain and certificate settings LANGFLOW HOSTNAME=langflow.example.com LETSENCRYPT EMAIL=admin@example.com PostgreSQL credentials POSTGRES USER=langflow POSTGRES PASSWORD=DATABASE PASSWORD POSTGRES DB=langflow Langflow storage paths LANGFLOW CONFIG DIR=/app/langflow LANGFLOW KNOWLEDGE BASES DIR=/app/langflow/knowledge bases Authentication settings LANGFLOW AUTO LOGIN=False LANGFLOW SUPERUSER=administrator LANGFLOW SUPERUSER PASSWORD=ADMIN PASSWORD LANGFLOW NEW USER IS ACTIVE=False LANGFLOW ENABLE SUPERUSER CLI=False LLM provider credentials OPENAI API KEY=OPENAI API KEY LANGFLOW HOSTNAME and LETSENCRYPT EMAIL supply the domain for the Traefik routing rule and the contact address for certificate expiry notices. The POSTGRES variables initialize the database container on first boot and are reused in the Langflow connection string — use only letters and numbers in the password, because symbols require %-encoding and $ conflicts with Compose interpolation. LANGFLOW CONFIG DIR and LANGFLOW KNOWLEDGE BASES DIR place application data and knowledge base vectors on the same volume-mapped path; without the second variable, Langflow writes knowledge bases outside that volume and a container replacement deletes your vector data. LANGFLOW AUTO LOGIN=False disables anonymous access, LANGFLOW SUPERUSER / LANGFLOW SUPERUSER PASSWORD define the administrator account Langflow creates at startup, LANGFLOW NEW USER IS ACTIVE=False keeps new accounts inactive until approved, and LANGFLOW ENABLE SUPERUSER CLI=False blocks superuser creation from the command line. OPENAI API KEY supplies the LLM provider credential, which Langflow stores as an encrypted global variable. 6. Restrict the environment file so only its owner can read or modify it: bash $ chmod 600 .env The stack runs three services. Traefik terminates HTTPS, Langflow serves the application on internal port 7860 , and PostgreSQL stores flows, users, and settings. Langflow joins the proxy network with Traefik and the internal network with PostgreSQL, so the database stays unreachable from outside. 1. Create the docker-compose.yml file in the project directory: bash $ nano docker-compose.yml 2. Add the following service definitions to the file: services: traefik: image: traefik:v3.7 restart: unless-stopped command: - --providers.docker=true - --providers.docker.exposedbydefault=false - --providers.docker.network=proxy - --entryPoints.web.address=:80 - --entryPoints.websecure.address=:443 - --entryPoints.websecure.http.tls=true - --entryPoints.web.http.redirections.entryPoint.to=websecure - --entryPoints.web.http.redirections.entryPoint.scheme=https - --certificatesresolvers.le.acme.email=${LETSENCRYPT EMAIL} - --certificatesresolvers.le.acme.storage=/letsencrypt/acme.json - --certificatesresolvers.le.acme.httpchallenge.entrypoint=web ports: - "80:80" - "443:443" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./letsencrypt:/letsencrypt networks: - proxy langflow: image: langflowai/langflow:1.11.3 restart: unless-stopped depends on: postgres: condition: service healthy environment: - LANGFLOW DATABASE URL=postgresql://${POSTGRES USER}:${POSTGRES PASSWORD}@postgres:5432/${POSTGRES DB} - LANGFLOW CONFIG DIR=${LANGFLOW CONFIG DIR} - LANGFLOW KNOWLEDGE BASES DIR=${LANGFLOW KNOWLEDGE BASES DIR} - LANGFLOW AUTO LOGIN=${LANGFLOW AUTO LOGIN} - LANGFLOW SUPERUSER=${LANGFLOW SUPERUSER} - LANGFLOW SUPERUSER PASSWORD=${LANGFLOW SUPERUSER PASSWORD} - LANGFLOW SECRET KEY=${LANGFLOW SECRET KEY} - LANGFLOW NEW USER IS ACTIVE=${LANGFLOW NEW USER IS ACTIVE} - LANGFLOW ENABLE SUPERUSER CLI=${LANGFLOW ENABLE SUPERUSER CLI} - OPENAI API KEY=${OPENAI API KEY} volumes: - langflow-data:/app/langflow networks: - proxy - internal labels: - traefik.enable=true - traefik.http.routers.langflow.rule=Host ${LANGFLOW HOSTNAME} - traefik.http.routers.langflow.entrypoints=websecure - traefik.http.routers.langflow.tls.certresolver=le - traefik.http.services.langflow.loadbalancer.server.port=7860 postgres: image: postgres:16-trixie restart: unless-stopped environment: - POSTGRES USER=${POSTGRES USER} - POSTGRES PASSWORD=${POSTGRES PASSWORD} - POSTGRES DB=${POSTGRES DB} healthcheck: test: "CMD-SHELL", "pg isready -U ${POSTGRES USER} -d ${POSTGRES DB}" interval: 5s timeout: 5s retries: 10 volumes: - langflow-postgres:/var/lib/postgresql/data networks: - internal networks: proxy: name: proxy internal: volumes: langflow-data: langflow-postgres: The traefik service publishes ports 80 and 443 , discovers only explicitly labeled containers through the read-only Docker socket, and registers a certificate resolver named le that completes the ACME challenge on port 80 and redirects plain HTTP to HTTPS. The langflow service pins the langflowai/langflow:1.11.3 image; the Traefik labels route your domain to port 7860 inside the container, and the langflow-data volume persists LANGFLOW CONFIG DIR across restarts. The postgres service pins postgres:16-trixie , joins only the internal network, and its pg isready health check gates the Langflow start. 3. Start the stack in detached mode: bash $ docker compose up -d 4. Verify that all containers are running: bash $ docker compose ps The output displays three running containers, with Traefik listening on ports 80 and 443 and PostgreSQL reporting a healthy status. 5. Check the Langflow logs to verify that the application started: bash $ docker compose logs -f langflow The first start takes a few minutes because Langflow runs its database migrations against PostgreSQL. The log stream ends with a startup banner when the application is ready. Open Langflow → http://localhost:7860 Press Ctrl+C to stop following the logs. The localhost address applies inside the container only, and Traefik forwards your domain traffic to the same listener. The stack now runs behind HTTPS, so the remaining configuration happens in the browser. https://langflow.example.com . Traefik requests a Let's Encrypt certificate after the stack starts — if the browser shows a certificate warning, wait a minute and reload. Because automatic login is off, Langflow redirects you to the /login page. LANGFLOW SUPERUSER and LANGFLOW SUPERUSER PASSWORD . The Langflow OPENAI API KEY variable at startup. Enable the models you plan to use under A RAG chatbot answers questions from your own documents instead of relying only on the model's training data. Langflow ships a Vector Store RAG template that pairs a retrieval flow with a knowledge base, which chunks a document, embeds it, and stores the vectors locally. A grounded answer in the Playground proves that ingestion, retrieval, and generation all work on the deployed stack. langflow demo , select an OpenAI embedding model, and keep {question} variable. {context} . For the full guide with additional tips, visit the original article on Vultr Docs https://docs.vultr.com/how-to-deploy-langflow-open-source-visual-framework-for-building-ai-applications .