🔧 Add path parameter to healthCheck function and update backend health check calls
This commit is contained in:
@@ -162,15 +162,16 @@ function createModifiedDockerCompose(port, sslPort, backendPort) {
|
||||
* Perform HTTP health check
|
||||
* @param {string} host - Host to check
|
||||
* @param {number} port - Port to check
|
||||
* @param {string} path - Path to check (default: /)
|
||||
* @param {number} retries - Number of retries
|
||||
* @returns {Promise<boolean>} True if healthy
|
||||
*/
|
||||
async function healthCheck(host, port, retries = 5) {
|
||||
async function healthCheck(host, port, path = '/', retries = 5) {
|
||||
for (let i = 0; i < retries; i++) {
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
const req = http.get(
|
||||
`http://${host}:${port}`,
|
||||
`http://${host}:${port}${path}`,
|
||||
{ timeout: 5000 },
|
||||
res => {
|
||||
if (res.statusCode === 200) {
|
||||
@@ -250,7 +251,7 @@ async function deployLocal(config) {
|
||||
if (!frontendHealthy) throw new Error('Frontend health check failed');
|
||||
console.log(' ✅ Frontend healthy');
|
||||
|
||||
console.log(' Checking backend...');
|
||||
const backendHealthy = await healthCheck('localhost', config.backendPort, '/health');
|
||||
const backendHealthy = await healthCheck('localhost', config.backendPort);
|
||||
// Backend might need more time
|
||||
if (!backendHealthy) throw new Error('Backend health check failed');
|
||||
@@ -624,7 +625,8 @@ async function deploy() {
|
||||
console.log(' Checking backend...');
|
||||
const backendHealthy = await healthCheck(
|
||||
sshConfig.host,
|
||||
config.backendPort
|
||||
config.backendPort,
|
||||
'/health'
|
||||
);
|
||||
if (!backendHealthy) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user