Skip to content

Commit 7867489

Browse files
authored
Add curl in docker image for native healthchecks (#4170)
* Add curl in docker image for native healthchecks Fixes this issue: #4126 * fix: add container-native healthcheck - Added curl utility in dockerfile - Added healthcheck configuration in docker compose * fix: exclude ping endpoint from logging
1 parent 145a3bb commit 7867489

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Diff for: Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ RUN apk add --no-cache build-base cairo-dev pango-dev
1212
# Install Chromium
1313
RUN apk add --no-cache chromium
1414

15+
# Install curl for container-level health checks
16+
# Fixes: https://github.com/FlowiseAI/Flowise/issues/4126
17+
RUN apk add --no-cache curl
18+
1519
#install PNPM globaly
1620
RUN npm install -g pnpm
1721

Diff for: docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN npm install -g flowise
1313
FROM node:20-alpine
1414

1515
# Install runtime dependencies
16-
RUN apk add --no-cache chromium git python3 py3-pip make g++ build-base cairo-dev pango-dev
16+
RUN apk add --no-cache chromium git python3 py3-pip make g++ build-base cairo-dev pango-dev curl
1717

1818
# Set the environment variable for Puppeteer to find Chromium
1919
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

Diff for: docker/docker-compose.yml

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ services:
4949
- REDIS_CA=${REDIS_CA}
5050
ports:
5151
- '${PORT}:${PORT}'
52+
healthcheck:
53+
test: ["CMD", "curl", "-f", "http://localhost:${PORT}/api/v1/ping"]
54+
interval: 10s
55+
timeout: 5s
56+
retries: 5
57+
start_period: 30s
5258
volumes:
5359
- ~/.flowise:/root/.flowise
5460
entrypoint: /bin/sh -c "sleep 3; flowise start"

Diff for: packages/server/src/utils/logger.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const logger = createLogger({
138138
})
139139

140140
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
141-
const unwantedLogURLs = ['/api/v1/node-icon/', '/api/v1/components-credentials-icon/']
141+
const unwantedLogURLs = ['/api/v1/node-icon/', '/api/v1/components-credentials-icon/', '/api/v1/ping']
142142
if (/\/api\/v1\//i.test(req.url) && !unwantedLogURLs.some((url) => new RegExp(url, 'i').test(req.url))) {
143143
const fileLogger = createLogger({
144144
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),

0 commit comments

Comments
 (0)