Flowise is an open-source and low-code tool for building AI agents, chatbots, and RAG pipelines with a drag-and-drop visual builder. When you self-host Flowise with Docker Compose, you keep full control of your data, API keys, and uptime rather than relying on a third-party cloud plan.
This guide covers PostgreSQL setup instead of the default SQLite file, Redis-backed queue mode, HTTPS, login protection, health checks, and a separate worker process that scales independently from the main app.
Requirements Before You Start
Before you start, you need:
A VPS running Ubuntu 22.04 or newer, with at least 2 vCPUs and 4 GB RAM.
Root or sudo access over SSH.
A domain or subdomain with an A record pointing to your server's IP.
Docker Engine and the Docker Compose plugin.
Ports 80 and 443 open on your firewall.
If you don't have a server yet, you can start with a fresh Linux VPS from PerLod, which gives you clean root access and enough resources to self-host Flowise with Docker Compose alongside PostgreSQL, Redis, and a worker container.
Step 1. Prepare Your Server
First, SSH into your server and run the system update and upgrade:
These folders hold persistent data so nothing is lost on restart, which is a key detail whenever you self-host Flowise with Docker Compose for real use.
Step 3. Configure Environment Variables
At this point, use your desired text editor to create the .env file:
Point your domain's A record to the server now. Managing this is simple if your domain registration is configured with PerLod, since DNS and hosting live in one place while you self-host Flowise with Docker Compose.
Step 4. Add a Domain and Enable HTTPS
Caddy automatically requests and renews a free TLS certificate from Let's Encrypt. Create the Caddyfile:
This step turns a local test into something you can safely self-host Flowise with Docker Compose for real users over the public internet, instead of exposing plain HTTP.
Step 5. Add PostgreSQL Instead of SQLite
By default, Flowise stores everything in a local SQLite file, which is fine for a quick test, but risky for a real team.
Switching to PostgreSQL is the key step that lets you self-host Flowise with Docker Compose for multiple users safely, since Postgres handles concurrent writes and backs up cleanly.
The database is defined directly in the Compose file below, with a persistent volume so data survives restarts.
Step 6. Self-Host Flowise with Docker Compose
Now use the command below to create the Docker Compose file for Flowise:
Save and close the file. The worker entrypoint and MODE/QUEUE_NAME/REDIS_* variables above match the official Flowise queue-mode pattern exactly.
Step 7. Enable Worker Mode for Scaling
The flowise-worker service runs in queue mode, the correct way to self-host Flowise with Docker Compose once more than a few people use it. The main container only accepts requests and queues them in Redis; the worker executes the LLM chains and writes results to PostgreSQL.
Scale workers without touching the main app:
Bash
dockercomposeup-d--scaleflowise-worker=3
This starts three workers pulling from the same queue, one of the biggest reasons teams choose to self-host Flowise with Docker Compose instead of one all-in-one container.
Step 8. Turn On Authentication and Health Checks
Login is already active via FLOWISE_USERNAME/FLOWISE_PASSWORD, visitors see a login screen before reaching the builder. This is required any time you self-host Flowise with Docker Compose on a public server.
Health checks are defined for Postgres, Redis, and Flowise itself, so Compose won't start dependents until each is truly ready:
Bash
dockercomposeps
Every service should show healthy.
Step 9. Launch the Full Stack
Use the commands below to launch the full Flowise stack:
You will see the Flowise admin account setup screen. Create the admin account and sign up:
Now you self-host Flowise with Docker Compose in production, backed by PostgreSQL, Redis queues, HTTPS, and a dedicated worker.
Testing: Build and Run an Agent Flow
From the Flowise dashboard, click Add New to create a chatflow.
Then:
Drag a Chat Model node onto the canvas and add your API key credential.
Connect it to a Conversation Chain node.
Click Save, then test in the built-in chat panel.
A correct reply proves the worker and Redis pipeline work; this way to self-host Flowise with Docker Compose is fully functional.
Grab the endpoint from the chatflow's API tab and test via terminal:
Bash
curlhttps://flowise.yourdomain.com/api/v1/prediction/<your-chatflow-id>\-XPOST\-H"Content-Type: application/json"\-H"Authorization: Bearer <your-api-key>"\-d'{"question": "Hello, are you running through the worker?"}'
A JSON response with your model's answer confirms the API, HTTPS, and worker pipeline all work together, meaning you now self-host Flowise with Docker Compose end to end, from the browser to the API.
Note: the first time Flowise connects to PostgreSQL, it needs the uuid-ossp extension enabled. If you hit a database error on first launch, run :
Bash
dockerexec-itflowise-postgrespsql-Uflowiseuser-dflowisedb-c"CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"dockercomposerestartflowiseflowise-worker
Flowise Backups and Persistent Storage
All data lives in data/postgres, data/redis, and data/flowise, so backing up is simple:
Store this archive off the server, such as object storage or another machine. Backing up regularly is essential once you self-host Flowise with Docker Compose for a team, since chatflows, credentials, and chat history all live in that PostgreSQL volume.
Conclusion
At this point, you have learned to self-host Flowise with Docker Compose. Including, PostgreSQL for reliable storage, Redis-backed queue mode for scaling, HTTPS through Caddy, login protection, health checks, and a separate worker container that keeps heavy AI jobs from blocking the main app.
This setup is ready for real teams, not just a single-user demo, and it grows with you as you add more workers or move to bigger server resources.
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.