same dek staging-dev
This commit is contained in:
parent
c266a9d3b3
commit
1d82a6077c
2
.env
2
.env
@ -2,7 +2,7 @@ CORS_ALLOWED_ORIGINS=https://dev1.aptivaai.com,http://34.16.120.118:3000,http://
|
|||||||
SERVER1_PORT=5000
|
SERVER1_PORT=5000
|
||||||
SERVER2_PORT=5001
|
SERVER2_PORT=5001
|
||||||
SERVER3_PORT=5002
|
SERVER3_PORT=5002
|
||||||
IMG_TAG=a9421f5-202508081846
|
IMG_TAG=6a4d533-202508081922
|
||||||
|
|
||||||
ENV_NAME=dev
|
ENV_NAME=dev
|
||||||
PROJECT=aptivaai-dev
|
PROJECT=aptivaai-dev
|
@ -100,13 +100,17 @@ app.use(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get('/healthz', async (req, res) => {
|
// LIVENESS: process is up; no external deps
|
||||||
|
app.get('/healthz', (req, res) => res.type('text').send('OK'));
|
||||||
|
|
||||||
|
// READINESS: KMS/DEK/DB are correct
|
||||||
|
app.get('/readyz', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
await verifyCanary(pool); // throws if bad
|
await verifyCanary(pool); // throws if bad
|
||||||
return res.type('text').send('OK'); // cheap 200 OK
|
return res.type('text').send('READY');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('[HEALTHZ]', e.message);
|
console.error('[READYZ]', e.message);
|
||||||
return res.status(500).type('text').send('FAIL');
|
return res.status(503).type('text').send('NOT_READY');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -67,17 +67,21 @@ await verifyCanary(pool);
|
|||||||
const app = express();
|
const app = express();
|
||||||
const PORT = process.env.SERVER2_PORT || 5001;
|
const PORT = process.env.SERVER2_PORT || 5001;
|
||||||
|
|
||||||
// at top of backend/server.js (do once per server codebase)
|
// LIVENESS: process is up; no external deps
|
||||||
app.get('/healthz', async (req, res) => {
|
app.get('/healthz', (req, res) => res.type('text').send('OK'));
|
||||||
|
|
||||||
|
// READINESS: KMS/DEK/DB are correct
|
||||||
|
app.get('/readyz', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
await verifyCanary(pool); // << just pass the pool
|
await verifyCanary(pool); // throws if bad
|
||||||
return res.type('text').send('OK');
|
return res.type('text').send('READY');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('[HEALTHZ]', e.message);
|
console.error('[READYZ]', e.message);
|
||||||
return res.status(500).type('text').send('FAIL');
|
return res.status(503).type('text').send('NOT_READY');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* DB connections
|
* DB connections
|
||||||
**************************************************/
|
**************************************************/
|
||||||
|
@ -71,17 +71,21 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
|
|||||||
apiVersion: '2024-04-10',
|
apiVersion: '2024-04-10',
|
||||||
});
|
});
|
||||||
|
|
||||||
// at top of backend/server.js (do once per server codebase)
|
// LIVENESS: process is up; no external deps
|
||||||
app.get('/healthz', async (req, res) => {
|
app.get('/healthz', (req, res) => res.type('text').send('OK'));
|
||||||
|
|
||||||
|
// READINESS: KMS/DEK/DB are correct
|
||||||
|
app.get('/readyz', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
await verifyCanary(pool); // << just pass the pool
|
await verifyCanary(pool); // throws if bad
|
||||||
return res.type('text').send('OK');
|
return res.type('text').send('READY');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('[HEALTHZ]', e.message);
|
console.error('[READYZ]', e.message);
|
||||||
return res.status(500).type('text').send('FAIL');
|
return res.status(503).type('text').send('NOT_READY');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function internalFetch(req, urlPath, opts = {}) {
|
function internalFetch(req, urlPath, opts = {}) {
|
||||||
return fetch(`${API_BASE}${urlPath}`, {
|
return fetch(`${API_BASE}${urlPath}`, {
|
||||||
...opts,
|
...opts,
|
||||||
|
Loading…
Reference in New Issue
Block a user