Skip to content

Commit 9bb4e17

Browse files
committed
update worker Docker
1 parent c283e68 commit 9bb4e17

6 files changed

Lines changed: 209 additions & 10 deletions

File tree

docker/README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,41 @@ Starts Flowise from [DockerHub Image](https://hub.docker.com/r/flowiseai/flowise
1111

1212
## 🌱 Env Variables
1313

14-
If you like to persist your data (flows, logs, apikeys, credentials), set these variables in the `.env` file inside `docker` folder:
14+
If you like to persist your data (flows, logs, credentials, storage), set these variables in the `.env` file inside `docker` folder:
1515

1616
- DATABASE_PATH=/root/.flowise
1717
- LOG_PATH=/root/.flowise/logs
1818
- SECRETKEY_PATH=/root/.flowise
1919
- BLOB_STORAGE_PATH=/root/.flowise/storage
2020

2121
Flowise also support different environment variables to configure your instance. Read [more](https://docs.flowiseai.com/environment-variables)
22+
23+
## Queue Mode:
24+
25+
### Building from source:
26+
27+
You can build the images for worker and main from scratch with:
28+
29+
```
30+
docker compose -f docker-compose-queue-source.yml up -d
31+
```
32+
33+
Monitor Health:
34+
35+
```
36+
docker compose -f docker-compose-queue-source.yml ps
37+
```
38+
39+
### From pre-built images:
40+
41+
You can also use the pre-built images:
42+
43+
```
44+
docker compose -f docker-compose-queue-prebuilt.yml up -d
45+
```
46+
47+
Monitor Health:
48+
49+
```
50+
docker compose -f docker-compose-queue-prebuilt.yml ps
51+
```

docker/worker/.env.example

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
WORKER_PORT=3000
2+
3+
# APIKEY_PATH=/your_apikey_path/.flowise # (will be deprecated by end of 2025)
4+
5+
############################################################################################################
6+
############################################## DATABASE ####################################################
7+
############################################################################################################
8+
9+
DATABASE_PATH=/root/.flowise
10+
# DATABASE_TYPE=postgres
11+
# DATABASE_PORT=5432
12+
# DATABASE_HOST=""
13+
# DATABASE_NAME=flowise
14+
# DATABASE_USER=root
15+
# DATABASE_PASSWORD=mypassword
16+
# DATABASE_SSL=true
17+
# DATABASE_SSL_KEY_BASE64=<Self signed certificate in BASE64>
18+
19+
20+
############################################################################################################
21+
############################################## SECRET KEYS #################################################
22+
############################################################################################################
23+
24+
# SECRETKEY_STORAGE_TYPE=local #(local | aws)
25+
SECRETKEY_PATH=/root/.flowise
26+
# FLOWISE_SECRETKEY_OVERWRITE=myencryptionkey # (if you want to overwrite the secret key)
27+
# SECRETKEY_AWS_ACCESS_KEY=<your-access-key>
28+
# SECRETKEY_AWS_SECRET_KEY=<your-secret-key>
29+
# SECRETKEY_AWS_REGION=us-west-2
30+
# SECRETKEY_AWS_NAME=FlowiseEncryptionKey
31+
32+
33+
############################################################################################################
34+
############################################## LOGGING #####################################################
35+
############################################################################################################
36+
37+
# DEBUG=true
38+
LOG_PATH=/root/.flowise/logs
39+
# LOG_LEVEL=info #(error | warn | info | verbose | debug)
40+
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs
41+
# TOOL_FUNCTION_EXTERNAL_DEP=moment,lodash
42+
43+
44+
############################################################################################################
45+
############################################## STORAGE #####################################################
46+
############################################################################################################
47+
48+
# STORAGE_TYPE=local (local | s3 | gcs)
49+
BLOB_STORAGE_PATH=/root/.flowise/storage
50+
# S3_STORAGE_BUCKET_NAME=flowise
51+
# S3_STORAGE_ACCESS_KEY_ID=<your-access-key>
52+
# S3_STORAGE_SECRET_ACCESS_KEY=<your-secret-key>
53+
# S3_STORAGE_REGION=us-west-2
54+
# S3_ENDPOINT_URL=<custom-s3-endpoint-url>
55+
# S3_FORCE_PATH_STYLE=false
56+
# GOOGLE_CLOUD_STORAGE_CREDENTIAL=/the/keyfilename/path
57+
# GOOGLE_CLOUD_STORAGE_PROJ_ID=<your-gcp-project-id>
58+
# GOOGLE_CLOUD_STORAGE_BUCKET_NAME=<the-bucket-name>
59+
# GOOGLE_CLOUD_UNIFORM_BUCKET_ACCESS=true
60+
61+
62+
############################################################################################################
63+
############################################## SETTINGS ####################################################
64+
############################################################################################################
65+
66+
# NUMBER_OF_PROXIES= 1
67+
# CORS_ORIGINS=*
68+
# IFRAME_ORIGINS=*
69+
# FLOWISE_FILE_SIZE_LIMIT=50mb
70+
# SHOW_COMMUNITY_NODES=true
71+
# DISABLE_FLOWISE_TELEMETRY=true
72+
# DISABLED_NODES=bufferMemory,chatOpenAI (comma separated list of node names to disable)
73+
# Uncomment the following line to enable model list config, load the list of models from your local config file
74+
# see https://raw.githubusercontent.com/FlowiseAI/Flowise/main/packages/components/models.json for the format
75+
# MODEL_LIST_CONFIG_JSON=/your_model_list_config_file_path
76+
77+
78+
############################################################################################################
79+
############################################ AUTH PARAMETERS ###############################################
80+
############################################################################################################
81+
82+
# APP_URL=http://localhost:3000
83+
84+
# SMTP_HOST=smtp.host.com
85+
# SMTP_PORT=465
86+
# SMTP_USER=smtp_user
87+
# SMTP_PASSWORD=smtp_password
88+
# SMTP_SECURE=true
89+
# ALLOW_UNAUTHORIZED_CERTS=false
90+
# SENDER_EMAIL=team@example.com
91+
92+
JWT_AUTH_TOKEN_SECRET='AABBCCDDAABBCCDDAABBCCDDAABBCCDDAABBCCDD'
93+
JWT_REFRESH_TOKEN_SECRET='AABBCCDDAABBCCDDAABBCCDDAABBCCDDAABBCCDD'
94+
JWT_ISSUER='ISSUER'
95+
JWT_AUDIENCE='AUDIENCE'
96+
JWT_TOKEN_EXPIRY_IN_MINUTES=360
97+
JWT_REFRESH_TOKEN_EXPIRY_IN_MINUTES=43200
98+
# EXPIRE_AUTH_TOKENS_ON_RESTART=true # (if you need to expire all tokens on app restart)
99+
# EXPRESS_SESSION_SECRET=flowise
100+
101+
# INVITE_TOKEN_EXPIRY_IN_HOURS=24
102+
# PASSWORD_RESET_TOKEN_EXPIRY_IN_MINS=15
103+
# PASSWORD_SALT_HASH_ROUNDS=10
104+
# TOKEN_HASH_SECRET='popcorn'
105+
106+
# WORKSPACE_INVITE_TEMPLATE_PATH=/path/to/custom/workspace_invite.hbs
107+
108+
109+
############################################################################################################
110+
############################################# ENTERPRISE ###################################################
111+
############################################################################################################
112+
113+
# LICENSE_URL=
114+
# FLOWISE_EE_LICENSE_KEY=
115+
# OFFLINE=
116+
117+
118+
############################################################################################################
119+
########################################### METRICS COLLECTION #############################################
120+
############################################################################################################
121+
122+
# POSTHOG_PUBLIC_API_KEY=your_posthog_public_api_key
123+
124+
# ENABLE_METRICS=false
125+
# METRICS_PROVIDER=prometheus # prometheus | open_telemetry
126+
# METRICS_INCLUDE_NODE_METRICS=true # default is true
127+
# METRICS_SERVICE_NAME=FlowiseAI
128+
129+
# ONLY NEEDED if METRICS_PROVIDER=open_telemetry
130+
# METRICS_OPEN_TELEMETRY_METRIC_ENDPOINT=http://localhost:4318/v1/metrics
131+
# METRICS_OPEN_TELEMETRY_PROTOCOL=http # http | grpc | proto (default is http)
132+
# METRICS_OPEN_TELEMETRY_DEBUG=true # default is false
133+
134+
135+
############################################################################################################
136+
############################################### PROXY ######################################################
137+
############################################################################################################
138+
139+
# Uncomment the following lines to enable global agent proxy, see https://www.npmjs.com/package/global-agent for more details
140+
# GLOBAL_AGENT_HTTP_PROXY=CorporateHttpProxyUrl
141+
# GLOBAL_AGENT_HTTPS_PROXY=CorporateHttpsProxyUrl
142+
# GLOBAL_AGENT_NO_PROXY=ExceptionHostsToBypassProxyIfNeeded
143+
144+
145+
############################################################################################################
146+
########################################### QUEUE CONFIGURATION ############################################
147+
############################################################################################################
148+
149+
# MODE=queue #(queue | main)
150+
# QUEUE_NAME=flowise-queue
151+
# QUEUE_REDIS_EVENT_STREAM_MAX_LEN=100000
152+
# WORKER_CONCURRENCY=100000
153+
# REMOVE_ON_AGE=86400
154+
# REMOVE_ON_COUNT=10000
155+
# REDIS_URL=
156+
# REDIS_HOST=localhost
157+
# REDIS_PORT=6379
158+
# REDIS_USERNAME=
159+
# REDIS_PASSWORD=
160+
# REDIS_TLS=
161+
# REDIS_CERT=
162+
# REDIS_KEY=
163+
# REDIS_CA=
164+
# REDIS_KEEP_ALIVE=
165+
# ENABLE_BULLMQ_DASHBOARD=

docker/worker/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN pnpm install
2525
RUN pnpm build
2626

2727
# --- Healthcheck Setup ---
28-
28+
2929
WORKDIR /app/healthcheck
3030

3131
COPY docker/worker/healthcheck/package.json .
@@ -40,10 +40,10 @@ COPY docker/worker/healthcheck/healthcheck.js .
4040
WORKDIR /usr/src
4141

4242
# Environment variables for port configuration
43-
ENV PORT=3000
43+
ENV WORKER_PORT=5566
4444

4545
# Expose port (can be overridden by env var)
46-
EXPOSE ${PORT}
46+
EXPOSE ${WORKER_PORT}
4747

4848
# Start healthcheck in background and flowise worker in foreground
4949
CMD ["/bin/sh", "-c", "node /app/healthcheck/healthcheck.js & sleep 5 && pnpm run start-worker"]

docker/worker/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ Here’s an overview of the process:
1818

1919
## Setting up Worker:
2020

21-
1. Navigat to `docker/worker` folder
22-
2. Copy paste the same `.env` file used to setup main server. Change the `PORT` to other available port numbers. Ex: 5566
21+
1. Navigate to `docker/worker` folder
22+
2. In the `.env.example`, setup all the necessary env variables for `QUEUE CONFIGURATION`. Env variables for worker must match the one for main server. Change the `WORKER_PORT` to other available port numbers to listen for healthcheck. Ex: 5566
2323
3. `docker compose up -d`
2424
4. You can bring the worker container down by `docker compose stop`
25+
26+
## Entrypoint:
27+
28+
Different from main server image which is using `flowise start`, entrypoint for worker is `pnpm run start-worker`. This is because the worker's [Dockerfile](./Dockerfile) build the image via `pnpm build` instead of `RUN npm install -g flowise`.

docker/worker/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
image: flowiseai/flowise-bullmq-worker:latest
66
restart: always
77
environment:
8-
- PORT=${PORT}
8+
- WORKER_PORT=${WORKER_PORT:-5566}
99

1010
# DATABASE
1111
- DATABASE_PATH=${DATABASE_PATH}
@@ -124,9 +124,9 @@ services:
124124
- REDIS_KEEP_ALIVE=${REDIS_KEEP_ALIVE}
125125
- ENABLE_BULLMQ_DASHBOARD=${ENABLE_BULLMQ_DASHBOARD}
126126
ports:
127-
- '${PORT}:${PORT}'
127+
- '${WORKER_PORT}:${WORKER_PORT}'
128128
healthcheck:
129-
test: ['CMD', 'curl', '-f', 'http://localhost:${PORT}/healthz']
129+
test: ['CMD', 'curl', '-f', 'http://localhost:${WORKER_PORT}/healthz']
130130
interval: 10s
131131
timeout: 5s
132132
retries: 5

docker/worker/healthcheck/healthcheck.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const express = require('express')
22
const app = express()
33

4-
const port = process.env.PORT || 3000
4+
const port = process.env.WORKER_PORT || 5566
55

66
app.get('/healthz', (req, res) => {
77
res.status(200).send('OK')

0 commit comments

Comments
 (0)