ApplyLuma has three independent layers of monitoring. They catch different failure modes and none of them substitutes for the others.
| Layer | Catches | Where it runs |
|---|---|---|
| External uptime pinger (UptimeRobot) | The whole app being down/unreachable | Outside the app — the only layer that works when the app itself is dead |
| Internal health watchdog | Degraded dependencies (DB, Redis, stalled scraping, AI job failure spikes) while the app is still up | Celery beat, every 15 minutes |
| Sentry | Unhandled exceptions in the running backend and frontend | In-process, on both backend/ and frontend/ |
A process that has crashed entirely can't email you about itself — that's why the external pinger is the one layer that isn't pure code in this repo.
Set this up once, outside of any deploy:
- Create a free account at uptimerobot.com.
- Add an HTTP(s) monitor:
- URL:
https://applyluma-production.up.railway.app/health?deep=1 - Interval: 5 minutes
- Alert condition: non-2xx response (the endpoint returns
503when the database check fails; a total outage times out or connection-refuses, which also alerts)
- URL:
- Enable email and/or push notifications on the monitor.
/health (no query param) stays a fast, dependency-free liveness check —
that's what Railway's own health check probe should keep using, so a
transient DB blip doesn't cause Railway to restart the container. Only
/health?deep=1 runs a real SELECT 1 and can return 503.
app/tasks/watchdog.py (Celery task run_health_watchdog, scheduled via
app/tasks/celery_app.py beat entry health-watchdog-every-15-min) checks,
every 15 minutes:
db,redis— the same probes as/api/v1/health/detailed. Celery is not probed: the watchdog runs on the only worker (--pool=solo), which cannot answer an inspect ping while running it, so that probe always failed. A worker that runs the watchdog is alive; if the worker dies, the watchdog stops running and sends nothing, so a dead worker shows up only as a crashed service in Railway (/api/v1/health/detailedstill probes it).pipeline— whetherraw_job_postingsscraping is fresh (crud_admin.get_pipeline_health). The nightly job pipeline (app/tasks/job_pipeline.py, 02:00 UTC) writes onepipeline_run_logrow per source (remotive,remoteok,platsbanken,career_pages) plusextracted_keywords,transform_jobsandsalary_analytics; a failed source is logged asfailedwith the error, visible on/admin/pipeline.ai_job_failures— whether failed tailor/cover-letter jobs in the last hour meet or exceedWATCHDOG_FAILURE_SPIKE_THRESHOLD(default5, overridable via env var).
State is persisted in the app_settings table under the key
health_watchdog_state ("ok" or "degraded:<comma-joined checks>"), the
same throttling pattern used by the AI budget alert. An email to
CONTACT_RECIPIENT_EMAIL only fires on a transition:
- healthy → degraded: one alert email.
- degraded with an additional check now failing: one more alert email (the check list is part of the state, so this is detected as a new state).
- degraded → healthy: one recovery email.
- otherwise: silent, so a persistent known issue doesn't spam your inbox.
This layer requires Celery beat to be running: either the separate beat
service (backend/scripts/start-beat.sh / backend/railway.beat.json) or,
with CELERY_EMBED_BEAT=1 on the worker, beat embedded in the worker
(start-worker.sh runs celery worker -B). If beat is down, this layer goes
silent too, which is exactly the gap the external pinger fills.
- Backend: initialized in
backend/app/main.py, gated on theSENTRY_DSNenv var (backend/app/core/config.py). VerifySENTRY_DSNis set in Railway — if it's unset, backend exceptions are only visible in Railway logs. - Frontend: initialized in
frontend/src/main.tsx, gated on theVITE_SENTRY_DSNbuild-time env var.ErrorBoundary.tsxreports caught render errors viaSentry.captureException. VerifyVITE_SENTRY_DSNis set in Vercel.
Every /admin/* page shows a red (unhealthy) or amber (degraded) banner
when GET /api/v1/admin/system/health reports anything other than ok,
polled every 60 seconds (frontend/src/components/layout/AdminStatusBanner.tsx,
mounted in frontend/src/components/AdminRoute.tsx). This is a convenience
for whoever has the admin panel open — it is not a substitute for the
external pinger or the email alerts above, since nobody has to be looking at
the page for those to fire.