mirror of
https://dev.azure.com/tstanciu94/PhantomMind/_git/Bitip
synced 2025-10-13 01:52:19 +03:00
refactor: update healthcheck command to use wget and reduce shutdown timeout from 10 to 5 seconds
This commit is contained in:
parent
edb38f034e
commit
0b3e37926a
@ -51,8 +51,8 @@ ENV APP_VERSION=${APP_VERSION} \
|
|||||||
GIT_REVISION=${GIT_REVISION} \
|
GIT_REVISION=${GIT_REVISION} \
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
|
|
||||||
# Install dumb-init for proper signal handling
|
# Install dumb-init for proper signal handling and wget for healthcheck
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init wget
|
||||||
|
|
||||||
# Create app directory
|
# Create app directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -92,8 +92,8 @@ USER bitip
|
|||||||
EXPOSE 5172
|
EXPOSE 5172
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=60s --timeout=3s --start-period=20s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||||
CMD node -e "require('http').get('http://localhost:5172/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => { process.exit(1) })"
|
CMD wget --no-verbose --tries=1 --spider http://localhost:5172/api/health || exit 1
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
ENTRYPOINT ["dumb-init", "--"]
|
ENTRYPOINT ["dumb-init", "--"]
|
||||||
|
@ -136,11 +136,11 @@ const gracefulShutdown = async (signal: string): Promise<void> => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Force close after 10 seconds
|
// Force close after 5 seconds
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
logger.error('Forced shutdown after timeout');
|
logger.error('Forced shutdown after timeout');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}, 10000);
|
}, 5000);
|
||||||
};
|
};
|
||||||
|
|
||||||
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
|
process.on('SIGTERM', () => gracefulShutdown('SIGTERM'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user