Website 1.4.0: nightly database backups and background jobs
As Accounts and Cross Events: a gzipped pg_dump every night (02:20) into backend/backups/, the same website-*.sql.gz files crosscode makes before updates, with Admin -> Backups (back up now, download, how many to keep). The heartbeat, event feed and YouTube move from plain timers onto pg-boss with the backup, and Admin -> Background jobs switches each on or off, changes its schedule or runs it now. The heartbeat now reports the newest backup (before: always none, so the Hub warned) and the real job state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,40 @@
|
||||
# Changelog — Church Website
|
||||
|
||||
## [1.4.0] — 2026-11-27
|
||||
|
||||
No migration: pg-boss makes its own schema (`pgboss_website`) on first start, as in Accounts. New
|
||||
dependencies `pg-boss` and `cron-parser`. Needs `pg_dump` on the server (it's there: the
|
||||
crosscode script uses it for the backups before updates).
|
||||
|
||||
### Added
|
||||
|
||||
- **Database backups** (`src/backups/backups.ts`, as Accounts 1.3.0): a gzipped `pg_dump` into
|
||||
`backend/backups/` every night at 02:20 (after Accounts' at 02:00 on the same server) and when an
|
||||
admin asks; the newest 14 kept (`backup_retain_count`), nightly on by default
|
||||
(`backup_nightly`), the last failure in `backup_last_error`. Same names as the crosscode
|
||||
script's backups before updates (`website-YYYYMMDD-HHMMSS.sql.gz`), so the list shows both. A
|
||||
dump that fails part-way leaves no file. The database only: the uploads aren't in it (as Events).
|
||||
- **Admin → Backups** (Owners and Admins): back up now, download one (audited, never cached), turn
|
||||
nightly backups off, how many to keep. `GET /api/v1/admin/backups`, `POST …/backups/run`,
|
||||
`PUT …/backups/settings`, `GET …/backups/:file/download`.
|
||||
- **Background jobs on pg-boss** (`src/jobs.ts`, as Accounts 1.4.0): `backup`, `hub-heartbeat`
|
||||
(every 15 minutes), `event-feed` (every 15 minutes) and `youtube` (hourly). One run per
|
||||
schedule however many processes run; timers in the process if the queue can't start;
|
||||
`JOBS_ENABLED=false` turns them all off. Per job: its .env flag (`BACKUP_ENABLED`,
|
||||
`HUB_HEARTBEAT_ENABLED`, `FEED_JOB_ENABLED`, `YOUTUBE_JOB_ENABLED`) and `JOB_SCHEDULE_<NAME>`.
|
||||
- **Admin → Background jobs** (Owners and Admins): each job's schedule, next run and last runs;
|
||||
switch it on or off, change its schedule (kept in `job_overrides`, winning over the .env, live
|
||||
at once), or run it now. Audited (`job_settings_changed`, `job_run`).
|
||||
|
||||
### Changed
|
||||
|
||||
- **The heartbeat reports the newest backup** (`lastBackupAt`; before always null, so the Hub
|
||||
showed "No backup reported" on every Website) **and the real job mode and failed runs in the
|
||||
last 24 hours** (before always "queue" and 0).
|
||||
- The heartbeat, the event feed and YouTube were plain timers (`startHeartbeats`,
|
||||
`startFeedSync`, `startYoutubeSync`, removed); they're jobs now. The first event-feed and
|
||||
YouTube runs are on their schedule rather than 20 and 30 seconds after a start.
|
||||
|
||||
## [1.3.0] — 2026-11-27
|
||||
|
||||
No migration, no new environment settings. Needs contracts 1.19.0 (in this checkout).
|
||||
|
||||
Reference in New Issue
Block a user