Add server-side health checks for service online status
- update-health.js: pings every service URL from script.js (single source of truth) in parallel every minute via cron and writes health.json; any HTTP response below 500 counts as online, 5xx as error, timeouts/DNS failures as offline; TLS validity ignored - Card badges now show real state instead of a static Online label: grey Checking, green Online (with latency tooltip), amber Error (HTTP code), red Offline (reason); refreshed every 30 s - Entrypoint runs a first sweep at boot; nginx serves /health.json with no-cache; README documents the behavior
This commit is contained in:
+2
-2
@@ -12,8 +12,8 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
# Backend scripts (node_modules included so the build works offline).
|
||||
COPY api /opt/dashboard
|
||||
|
||||
# Cron refreshes the data feed every 15 minutes.
|
||||
RUN echo '*/15 * * * * cd /opt/dashboard && node update-data.js' > /etc/crontabs/root
|
||||
# Cron refreshes the data feed every 15 minutes and health checks every minute.
|
||||
RUN printf '*/15 * * * * cd /opt/dashboard && node update-data.js\n* * * * * cd /opt/dashboard && node update-health.js\n' > /etc/crontabs/root
|
||||
|
||||
# Entrypoint: run updater once, start API proxy + cron, then nginx.
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
Reference in New Issue
Block a user