Skip to content

ci: query the database once a day so Supabase never pauses it - #15

Merged
devinder-dev merged 1 commit into
mainfrom
chore/keep-database-awake
Oct 21, 2026
Merged

devinder-dev merged 1 commit into
mainfrom
chore/keep-database-awake

Conversation

@devinder-dev

Copy link
Copy Markdown
Owner

Why

Supabase paused the free project on 2026-10-05 (about a week without database activity). The API then crash-looped: docker-entrypoint.sh runs prisma migrate deploy first, and that failed against the paused database.

The docs said the nightly cron jobs (02:00 overdue check, 03:00 demo reset) keep the database awake. They run inside the API process with node-cron, so they only fire if Render's instance is awake at that moment — a dependency nobody had written down.

What

  • .github/workflows/keep-database-awake.yml — once a day (07:23 UTC) curl calls /health/ready, which runs SELECT 1. It runs on GitHub's scheduler, so it does not depend on Render or UptimeRobot.
    • No checkout, no third-party actions, permissions: {}
    • --max-time 90 covers Render's cold start; 3 retries; --fail so a 503 fails the run, and GitHub emails the failure
  • docs/deployment.md and ADR 53 amended with what actually happened

Cost

Supabase's free database runs 24/7 whether it is queried or not, so one SELECT 1 a day uses nothing that counts. This does not repeat the Neon problem from ADR 51 — that was a query every few seconds against an hourly compute quota. GitHub Actions minutes are free for public repos.

Verified

  • The exact curl command run against the live API: {"status":"ready","database":"up","redis":"up"}, exit 0
  • Against a non-existent path: retries, then exits non-zero
  • Workflow YAML parses; the folded run: line is that same single command
  • After merge: start it once with Actions → Keep database awake → Run workflow

Supabase paused the free project on 2026-10-05 and the API crash-looped,
because the entrypoint's migrate deploy could not reach the database.
The docs assumed the nightly cron jobs kept it awake, but they run inside
the API process and only fire if Render is awake at 02:00.

A scheduled workflow now calls /health/ready once a day: one SELECT 1
from GitHub's scheduler, independent of Render and the uptime pinger.
No checkout, no third-party actions, empty permissions. A failed run
emails the owner, so it doubles as an early warning.

Docs: deployment.md caveat and ADR 53 amended with what actually happened.
@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fakturly-app Ready Ready Preview Oct 5, 2026 12:19pm UTC

@devinder-dev
devinder-dev merged commit c7f3762 into main Oct 21, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — 62a79cd1 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant