fixed monitor api polling
Build and Push Docker Images / detect-changes (push) Successful in 10s
Build and Push Docker Images / build-auth-api (push) Successful in 1m6s
Build and Push Docker Images / build-employee-api (push) Successful in 1m2s
Build and Push Docker Images / build-transit-api (push) Successful in 58s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m10s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m15s
Build and Push Docker Images / build-monitoring-ui (push) Successful in 1m16s
Build and Push Docker Images / deploy-test-node (push) Successful in 4s
Build and Push Docker Images / detect-changes (push) Successful in 10s
Build and Push Docker Images / build-auth-api (push) Successful in 1m6s
Build and Push Docker Images / build-employee-api (push) Successful in 1m2s
Build and Push Docker Images / build-transit-api (push) Successful in 58s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m10s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m15s
Build and Push Docker Images / build-monitoring-ui (push) Successful in 1m16s
Build and Push Docker Images / deploy-test-node (push) Successful in 4s
This commit is contained in:
@@ -129,4 +129,8 @@ app.get("/me", async (req, res) => {
|
|||||||
const PORT = process.env.PORT || 5000;
|
const PORT = process.env.PORT || 5000;
|
||||||
app.listen(PORT, () => console.log(`Auth API listening on ${PORT}`));
|
app.listen(PORT, () => console.log(`Auth API listening on ${PORT}`));
|
||||||
|
|
||||||
|
app.get("/health", (_req, res) => {
|
||||||
|
res.json({ status: "ok", service: "auth_api" });
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
|||||||
@@ -91,18 +91,13 @@ app.post("/createemployee", async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/health", async (_req, res, _next) => {
|
app.get("/health", async (_req, res) => {
|
||||||
try {
|
try {
|
||||||
return res.status(200).json({ endpoint: "reachable" });
|
await db.query("SELECT 1");
|
||||||
|
return res.status(200).json({ endpoint: "reachable", database: "ok" });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
void reportError({
|
|
||||||
partofservice: `${req.method} ${req.originalUrl}`,
|
|
||||||
error: err?.stack || err?.message || String(err),
|
|
||||||
});
|
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res
|
res.status(503).json({ endpoint: "unreachable", database: "down" });
|
||||||
.status(500)
|
|
||||||
.json({ endpoint: "unreachable", error: friendlyErrorMessage(500) });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,13 @@ function verifyAdmin(req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.get("/health", async (_req, res) => {
|
app.get("/health", async (_req, res) => {
|
||||||
res.json({ status: "ok", service: "error_log_api" });
|
try {
|
||||||
|
await db.query("SELECT 1");
|
||||||
|
res.json({ status: "ok", service: "error_log_api", database: "ok" });
|
||||||
|
} catch (err) {
|
||||||
|
console.error("GET /health error:", err);
|
||||||
|
res.status(503).json({ status: "unavailable", service: "error_log_api" });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/error_log", async (req, res) => {
|
app.post("/error_log", async (req, res) => {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const serviceMeta = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const healthPaths = {
|
const healthPaths = {
|
||||||
auth: "/me",
|
auth: "/health",
|
||||||
employee: "/health",
|
employee: "/health",
|
||||||
transit: "/health",
|
transit: "/health",
|
||||||
errors: "/health",
|
errors: "/health",
|
||||||
|
|||||||
Reference in New Issue
Block a user