Add curl in docker image for native healthchecks (#4170)
* Add curl in docker image for native healthchecks Fixes this issue: https://github.com/FlowiseAI/Flowise/issues/4126 * fix: add container-native healthcheck - Added curl utility in dockerfile - Added healthcheck configuration in docker compose * fix: exclude ping endpoint from logging
This commit is contained in:
parent
145a3bb415
commit
7867489727
|
|
@ -12,6 +12,10 @@ RUN apk add --no-cache build-base cairo-dev pango-dev
|
||||||
# Install Chromium
|
# Install Chromium
|
||||||
RUN apk add --no-cache chromium
|
RUN apk add --no-cache chromium
|
||||||
|
|
||||||
|
# Install curl for container-level health checks
|
||||||
|
# Fixes: https://github.com/FlowiseAI/Flowise/issues/4126
|
||||||
|
RUN apk add --no-cache curl
|
||||||
|
|
||||||
#install PNPM globaly
|
#install PNPM globaly
|
||||||
RUN npm install -g pnpm
|
RUN npm install -g pnpm
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ RUN npm install -g flowise
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN apk add --no-cache chromium git python3 py3-pip make g++ build-base cairo-dev pango-dev
|
RUN apk add --no-cache chromium git python3 py3-pip make g++ build-base cairo-dev pango-dev curl
|
||||||
|
|
||||||
# Set the environment variable for Puppeteer to find Chromium
|
# Set the environment variable for Puppeteer to find Chromium
|
||||||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,12 @@ services:
|
||||||
- REDIS_CA=${REDIS_CA}
|
- REDIS_CA=${REDIS_CA}
|
||||||
ports:
|
ports:
|
||||||
- '${PORT}:${PORT}'
|
- '${PORT}:${PORT}'
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:${PORT}/api/v1/ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 30s
|
||||||
volumes:
|
volumes:
|
||||||
- ~/.flowise:/root/.flowise
|
- ~/.flowise:/root/.flowise
|
||||||
entrypoint: /bin/sh -c "sleep 3; flowise start"
|
entrypoint: /bin/sh -c "sleep 3; flowise start"
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ const logger = createLogger({
|
||||||
})
|
})
|
||||||
|
|
||||||
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
export function expressRequestLogger(req: Request, res: Response, next: NextFunction): void {
|
||||||
const unwantedLogURLs = ['/api/v1/node-icon/', '/api/v1/components-credentials-icon/']
|
const unwantedLogURLs = ['/api/v1/node-icon/', '/api/v1/components-credentials-icon/', '/api/v1/ping']
|
||||||
if (/\/api\/v1\//i.test(req.url) && !unwantedLogURLs.some((url) => new RegExp(url, 'i').test(req.url))) {
|
if (/\/api\/v1\//i.test(req.url) && !unwantedLogURLs.some((url) => new RegExp(url, 'i').test(req.url))) {
|
||||||
const fileLogger = createLogger({
|
const fileLogger = createLogger({
|
||||||
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), format.json(), errors({ stack: true })),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue