app: backups of the database and the uploaded images (APP-1.0-PLAN §10)
As the Website's: a gzipped pg_dump into backend/backups every night (02:40, after Accounts' and the Website's) and on Back up now, named as the crosscode script names them (app-YYYYMMDD-HHMMSS.sql.gz); a failed dump leaves no file; the newest kept (14 by default). After each, a snapshot of backend/uploads, hard-linking what hasn't changed. Settings → Backups lists both, backs up now, downloads (audited) and sets how many to keep and what's nightly; Owner and Church admin only. The heartbeat reports the newest backup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
* The Hub heartbeat, the event feed, Cross Code's devotionals (the next 2 weeks, today included, once
|
||||
* a night, §6), the House of Prayer's reminders and renewal notices (prayer/jobs.ts), tidying prayer
|
||||
* requests, and email and WhatsApp (§8, messaging/send.ts): sending what's queued, and queuing
|
||||
* announcements and the day's devotional. The nightly backup comes with the admin (§10).
|
||||
* announcements and the day's devotional; and the nightly backup of the database and the uploaded
|
||||
* images (§10, backups/).
|
||||
*
|
||||
* Settings → Background jobs (§10) shows each job's schedule and last runs, runs one now, and
|
||||
* switches one on or off or changes its schedule. That choice is kept in the database
|
||||
@@ -23,6 +24,7 @@ import { nightlySync } from './content/devotionals.js';
|
||||
import { syncAll } from './events/feed.js';
|
||||
import { DELETE_AFTER_CLOSED_DAYS } from './requests/settings.js';
|
||||
import { queueAnnouncements, queueDevotionals, sendOutbox } from './messaging/send.js';
|
||||
import { runNightlyBackups } from './backups/uploads.js';
|
||||
|
||||
export type Job = { name: string; label: string; cron: string; env: string | null; run: (ctx: Ctx) => Promise<unknown> };
|
||||
|
||||
@@ -35,6 +37,8 @@ export const JOBS: Job[] = [
|
||||
{ name: 'messages-send', label: 'Email and WhatsApp: send what\'s queued (reminders, notices, announcements, devotionals)', cron: '* * * * *', env: 'MESSAGES_ENABLED', run: (ctx) => sendOutbox(ctx) },
|
||||
{ name: 'announcement-sends', label: 'Announcements: queue "Also send it" at the publish time', cron: '* * * * *', env: null, run: (ctx) => queueAnnouncements(ctx) },
|
||||
{ name: 'devotional-sends', label: 'Today\'s devotional: queue it at each member\'s time', cron: '*/5 * * * *', env: null, run: (ctx) => queueDevotionals(ctx) },
|
||||
// After Accounts' (02:00) and the Website's (02:20) on the same server.
|
||||
{ name: 'backup', label: 'Backup: the database, and the uploaded images', cron: '40 2 * * *', env: 'BACKUP_ENABLED', run: (ctx) => runNightlyBackups(ctx) },
|
||||
{ name: 'prayer-renewals', label: 'House of Prayer: renewal notices (14 and 3 days before the end)', cron: '0 9 * * *', env: 'PRAYER_RENEWALS_ENABLED', run: (ctx) => sendRenewalNotices(ctx) },
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user