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:
ssh root@your-server-ipapt update && apt upgrade -y
Install the required tools with:
apt install curl git ufw -y
Open the required ports and enable the firewall:
ufw allow OpenSSHufw allow 80/tcpufw allow 443/tcpufw enable
You can use the Docker script to install Docker and Docker Compose:
curl -fsSL https://get.docker.com | shusermod -aG docker $USER
Log out and back in, then verify:
docker --versiondocker compose version
If both return version numbers, your server is ready to self-host Flowise with Docker Compose.
Note: For production use, it is better to install Docker by adding the official repository.
Step 2. Create the Project Folder
Now you must create a project folder and the required files for a clean setup:
mkdir -p ~/flowise-stackcd ~/flowise-stackmkdir -p data/flowise data/postgres data/redis data/caddy
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:
Paste the following content with your values:
FLOWISE_PORT=3000FLOWISE_USERNAME=adminFLOWISE_PASSWORD=ChangeThisPassword123! POSTGRES_DB=flowisedbPOSTGRES_USER=flowiseuserPOSTGRES_PASSWORD=ChangeThisDbPassword123! REDIS_PASSWORD=ChangeThisRedisPassword123! MODE=queueQUEUE_NAME=flowise-queueWORKER_CONCURRENCY=5 DOMAIN=flowise.yourdomain.com
Once you are done, save and close the 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:
Add this with your domain:
flowise.yourdomain.com { reverse_proxy flowise-main:3000 encode gzip}
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:
1services:2 postgres:3 image: postgres:164 container_name: flowise-postgres5 restart: always6 environment:7 POSTGRES_DB: ${POSTGRES_DB}8 POSTGRES_USER: ${POSTGRES_USER}9 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}10 volumes:11 - ./data/postgres:/var/lib/postgresql/data12 healthcheck:13 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]14 interval: 10s15 timeout: 5s16 retries: 517 networks:18 - flowise-net19 20 redis:21 image: redis:7-alpine22 container_name: flowise-redis23 restart: always24 command: redis-server --requirepass ${REDIS_PASSWORD}25 volumes:26 - ./data/redis:/data27 healthcheck:28 test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]29 interval: 10s30 timeout: 5s31 retries: 532 networks:33 - flowise-net34 35 flowise:36 image: flowiseai/flowise:latest37 container_name: flowise-main38 restart: always39 depends_on:40 postgres:41 condition: service_healthy42 redis:43 condition: service_healthy44 ports:45 - "127.0.0.1:${FLOWISE_PORT}:3000"46 environment:47 PORT: 300048 FLOWISE_USERNAME: ${FLOWISE_USERNAME}49 FLOWISE_PASSWORD: ${FLOWISE_PASSWORD}50 DATABASE_TYPE: postgres51 DATABASE_HOST: postgres52 DATABASE_PORT: 543253 DATABASE_NAME: ${POSTGRES_DB}54 DATABASE_USER: ${POSTGRES_USER}55 DATABASE_PASSWORD: ${POSTGRES_PASSWORD}56 MODE: ${MODE}57 QUEUE_NAME: ${QUEUE_NAME}58 REDIS_HOST: redis59 REDIS_PORT: 637960 REDIS_PASSWORD: ${REDIS_PASSWORD}61 volumes:62 - ./data/flowise:/root/.flowise63 healthcheck:64 test: ["CMD-SHELL", "wget -qO- http://localhost:3000/api/v1/ping || exit 1"]65 interval: 15s66 timeout: 5s67 retries: 568 networks:69 - flowise-net70 71 flowise-worker:72 image: flowiseai/flowise:latest73 restart: always74 entrypoint: /bin/sh -c "sleep 5; flowise worker"75 depends_on:76 postgres:77 condition: service_healthy78 redis:79 condition: service_healthy80 environment:81 DATABASE_TYPE: postgres82 DATABASE_HOST: postgres83 DATABASE_PORT: 543284 DATABASE_NAME: ${POSTGRES_DB}85 DATABASE_USER: ${POSTGRES_USER}86 DATABASE_PASSWORD: ${POSTGRES_PASSWORD}87 MODE: ${MODE}88 QUEUE_NAME: ${QUEUE_NAME}89 WORKER_CONCURRENCY: ${WORKER_CONCURRENCY}90 REDIS_HOST: redis91 REDIS_PORT: 637992 REDIS_PASSWORD: ${REDIS_PASSWORD}93 volumes:94 - ./data/flowise:/root/.flowise95 networks:96 - flowise-net97 98 caddy:99 image: caddy:2-alpine100 container_name: flowise-caddy101 restart: always102 ports:103 - "80:80"104 - "443:443"105 volumes:106 - ./Caddyfile:/etc/caddy/Caddyfile107 - ./data/caddy:/data108 depends_on:109 - flowise110 networks:111 - flowise-net112 113networks:114 flowise-net:115 driver: bridge
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:
docker compose up -d --scale flowise-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:
Every service should show healthy.
Step 9. Launch the Full Stack
Use the commands below to launch the full Flowise stack:
docker compose up -ddocker compose logs -f flowise flowise-worker
Once healthy, open your browser and visit:
https://flowise.yourdomain.com
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:
curl https://flowise.yourdomain.com/api/v1/prediction/<your-chatflow-id> \ -X POST \ -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 :
docker exec -it flowise-postgres psql -U flowiseuser -d flowisedb -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"docker compose restart flowise flowise-worker
Flowise Backups and Persistent Storage
All data lives in data/postgres, data/redis, and data/flowise, so backing up is simple:
tar -czvf flowise-backup-$(date +%F).tar.gz data/ .env docker-compose.yml Caddyfile
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 hope you enjoy this guide.
For deeper detail on queue mode and worker configuration straight from the source, see the official Flowise documentation on running Flowise using queue.