From a5110e93fdf57e30d6e6a1e214d17ad24e64c59c Mon Sep 17 00:00:00 2001 From: Vishwas Tiwari Date: Mon, 19 Oct 2026 18:37:22 +0530 Subject: [PATCH] ci: move the keep-awake ping to cron-job.org GitHub's scheduler never ran keep-warm on time: no scheduled run in the hour after the merge, while the site slept. A cron-job.org job (every 5 minutes, 08:00 to midnight Asia/Kolkata) kept it awake through a 21-minute silent test. The workflow stays as a manual warm-up. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/keep-warm.yml | 16 ++++------------ docs/GAPS.md | 2 +- docs/infra/DEPLOYMENT.md | 23 +++++++++++++---------- docs/infra/INFRA.md | 8 ++++---- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/.github/workflows/keep-warm.yml b/.github/workflows/keep-warm.yml index 2c79855..a382b62 100644 --- a/.github/workflows/keep-warm.yml +++ b/.github/workflows/keep-warm.yml @@ -1,19 +1,11 @@ name: keep-warm -# Keeps the live demo awake from 08:00 to midnight IST: the free Render service -# sleeps after 15 idle minutes. It is left to sleep overnight on purpose, since -# only a boot resets the demo (docs/infra/DEPLOYMENT.md §0), so each morning -# starts fresh. An anonymous GET of the login page, never a sign-in: a sign-in -# writes an audit entry, and the reset only runs once nothing was audited for -# 10 minutes. +# Wakes the live demo on demand. The daily keep-awake ping runs on cron-job.org +# (docs/infra/DEPLOYMENT.md §0): GitHub's scheduler did not fire on time. An +# anonymous GET of the login page, never a sign-in: a sign-in writes an audit +# entry, and the demo only resets once nothing was audited for 10 minutes. on: - schedule: - # Cron is UTC; IST is UTC+5:30. Every 5 minutes, because GitHub can start a - # scheduled run late and 10 minutes would leave no margin before the sleep. - - cron: '30-55/5 2 * * *' # 08:00-08:25 IST - - cron: '*/5 3-17 * * *' # 08:30-23:25 IST - - cron: '0-25/5 18 * * *' # 23:30-23:55 IST workflow_dispatch: permissions: {} diff --git a/docs/GAPS.md b/docs/GAPS.md index 79ff3ec..942f794 100644 --- a/docs/GAPS.md +++ b/docs/GAPS.md @@ -173,7 +173,7 @@ platform. The *action* would not. service, with Redis on Render Key Value and PostgreSQL on Neon. Any process exiting restarts all three; there is no second instance and no failover. - **It sleeps after 15 minutes without a request**, worker included, except - from 08:00 to midnight IST, when `keep-warm.yml` pings it. The first + from 08:00 to midnight IST, when a cron-job.org job pings it. The first visit after a sleep waits for a cold boot (about 2.5 minutes, measured locally under the same 0.1 CPU cap, not on the host). - **The demo resets when idle.** A boot after 10 idle minutes (every wake from diff --git a/docs/infra/DEPLOYMENT.md b/docs/infra/DEPLOYMENT.md index 9186e6b..4dd56e4 100644 --- a/docs/infra/DEPLOYMENT.md +++ b/docs/infra/DEPLOYMENT.md @@ -42,14 +42,17 @@ memory figures below were measured locally under the same caps, not on the host. - **It sleeps after 15 minutes without a request**, worker included. Locally, capped at 0.1 CPU, a boot took about 2.5 minutes to serve the login page (migrate, seed, then Next.js alone about 45 s). -- **It is kept awake from 08:00 to midnight IST.** `.github/workflows/keep-warm.yml` - GETs `/login` every 5 minutes in that window and lets it sleep overnight, so - each morning boots a fresh demo. Never a sign-in: that writes an audit entry, - which would stop the idle reset. About 480 of the 750 free hours a month, and - Neon's compute stays awake too, since the worker queries it on a timer. - GitHub can start a scheduled run late, so an occasional sleep in the window is - possible; a failed ping fails the run, and GitHub emails about it. Two - visitors on the same day share one demo. +- **It is kept awake from 08:00 to midnight IST** by a free cron-job.org job, + configured outside this repository: GET `https://.onrender.com/login`, + every 5 minutes, hours 8-23, timezone Asia/Kolkata, failure email on. It + sleeps overnight, so each morning boots a fresh demo. Never a sign-in: that + writes an audit entry, which would stop the idle reset. About 480 of the 750 + free hours a month, and Neon's compute stays awake too, since the worker + queries it every minute. The 08:00 ping is logged as failed (the boot outlasts + cron-job.org's request timeout) but still wakes it. Two visitors on the same + day share one demo. GitHub Actions was tried first and dropped: its scheduled + runs never fired on time. `.github/workflows/keep-warm.yml` remains as a + manual warm-up (`gh workflow run keep-warm.yml`). - **512 MB and 0.1 CPU** for three Node processes. Measured locally under the same caps: about 145 MB for the whole container, through a full incident journey. Each heap is capped anyway (`API_HEAP_MB`, `WORKER_HEAP_MB`, @@ -153,8 +156,8 @@ so they do not depend on a proxy in front of it. 1. **Access control.** One shared `demo` password. "Known users only" is true only once Google sign-in with an exact-email allow-list is configured (`AGENTS.md` §13a). **This is the real gate.** -2. **Uptime monitoring.** Only the keep-warm ping (§0), whose failed runs - email the workflow's author; nothing alerts on an incident being created. +2. **Uptime monitoring.** Only the cron-job.org ping (§0), whose failures + email its account owner; nothing alerts on an incident being created. 3. **Alerts on long open transactions.** The metric exists; nothing watches it. The rest is in `docs/GAPS.md`. diff --git a/docs/infra/INFRA.md b/docs/infra/INFRA.md index e5ee675..2b90da9 100644 --- a/docs/infra/INFRA.md +++ b/docs/infra/INFRA.md @@ -185,7 +185,7 @@ than the code: the free tier returns 503 under load, and retired models answer Five workflows in `.github/workflows/`. Only `changes.yml` runs on pushes and pull requests to `main`; it calls `api.yml` and `web.yml`. `llm-live.yml` is manual; -`keep-warm.yml` runs on a schedule. +`keep-warm.yml` is manual too. | Workflow | Role | |---|---| @@ -193,7 +193,7 @@ requests to `main`; it calls `api.yml` and `web.yml`. `llm-live.yml` is manual; | `api.yml` | build (`tsc` + `prisma validate`), lint and unit tests in parallel; then integration tests (real Postgres + Redis) and coverage; then the quality gate. Images are built by the compose smoke job whenever api or web changed | | `web.yml` | build, lint and unit tests in parallel; then coverage; then the quality gate. Images are built by the compose smoke job whenever api or web changed | | `llm-live.yml` | Manual only (`workflow_dispatch`): the one job that calls a real model; needs the `GEMINI_API_KEY` repository secret | -| `keep-warm.yml` | Scheduled every 5 minutes from 08:00 to midnight IST (and manual): an anonymous GET of the live `/login`, so the free service does not sleep in that window. No secrets, `permissions: {}` | +| `keep-warm.yml` | Manual only: an anonymous GET of the live `/login`, to wake the free service before showing it. The daily keep-awake runs on cron-job.org (`DEPLOYMENT.md` §0). No secrets, `permissions: {}` | **Quality gate** (each pipeline, `if: always()` so it runs even after a failure): 1. Fails unless every upstream job succeeded. @@ -255,8 +255,8 @@ https://labops.onrender.com. One container runs the API, worker and web app as three processes, with Redis on Render Key Value and PostgreSQL on Neon. It boots by resetting the demo database (`DEMO_RESET_ON_BOOT`), migrating, seeding the `demo` operator and ingesting the demo scenario (`dist/seed-demo.js`), and -it sleeps after 15 minutes idle (kept awake 08:00 to midnight IST by -`keep-warm.yml`). `DEPLOYMENT.md` §0 has the costs and the steps. +it sleeps after 15 minutes idle (kept awake 08:00 to midnight IST by a +cron-job.org ping). `DEPLOYMENT.md` §0 has the costs and the steps. **`APP_ENV=production` changes what the API accepts.** It refuses to boot if `SESSION_COOKIE_SECURE` is not true (a Secure cookie over http is never sent,