Servers and the agent, backend (2.1.0): join, jobs, schedules, port list, stats, alerts
- Agent API /api/agent/v1: join with a one-time token, then poll, stats, report and export upload, all signed with the server's Ed25519 key. - Jobs signed with a separate job key (HUB_JOB_SIGNING_KEY_FILE) when delivered, config sealed to the server; one at a time per server; missed when not picked up in their window. - New install (licence, ports, preflight against the release's env template), Proxy done with public URL checks, scheduled / emergency (2FA, reason) / batch updates with email and banner, uninstall with an encrypted export first (the key is never stored), adopt and linking existing installs, purge after 30 days. - Port list, install defaults, server configuration (encrypted), stats per minute / hour with roll-up, server alerts. contracts 1.3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,15 @@ const { runAlerts, rollupHeartbeats } = require('./utils/alerts');
|
||||
const { importSmtpFromEnv } = require('./utils/settings');
|
||||
const { syncReleases } = require('./utils/releaseSync');
|
||||
const { runBilling } = require('./utils/billing');
|
||||
const servers = require('./utils/servers');
|
||||
const jobs = require('./utils/jobs');
|
||||
|
||||
// The job-signing key (2.1.0) is optional until the first server joins; warn if it's missing.
|
||||
try {
|
||||
servers.jobSigningKey();
|
||||
} catch (e) {
|
||||
console.warn(`[hub] ${e.message} Servers can't join until it's set.`);
|
||||
}
|
||||
|
||||
// Fail early if the licence signing key is missing or wrong.
|
||||
try {
|
||||
@@ -38,6 +47,10 @@ if (String(process.env.JOBS_ENABLED || 'true').toLowerCase() !== 'false') {
|
||||
every(15 * 60 * 1000, 'release sync', () => syncReleases());
|
||||
every(24 * 60 * 60 * 1000, 'heartbeat roll-up', () => rollupHeartbeats());
|
||||
every(15 * 60 * 1000, 'billing', () => runBilling());
|
||||
// Servers (2.1.0): the job scheduler (missed jobs, reminders, exports), server alerts, stats roll-up.
|
||||
every(30 * 1000, 'jobs', () => jobs.tick());
|
||||
every(60 * 1000, 'server alerts', () => servers.runServerAlerts());
|
||||
every(24 * 60 * 60 * 1000, 'stats roll-up', () => servers.rollupStats());
|
||||
setTimeout(() => runBilling().catch(e => console.warn('[hub] billing failed:', e?.message || e)), 60 * 1000);
|
||||
setTimeout(() => runAlerts().catch(() => {}), 30 * 1000);
|
||||
setTimeout(() => syncReleases().catch(e => console.warn('[hub] release sync failed:', e?.message || e)), 20 * 1000);
|
||||
|
||||
Reference in New Issue
Block a user