@yunuseon/kayra 0.21.1 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/ansible/playbooks/edge.yml +7 -2
  2. package/ansible/playbooks/platform.yml +3 -0
  3. package/ansible/roles/backup-check/files/backup-check.service +1 -1
  4. package/ansible/roles/backup-check/tasks/main.yml +18 -4
  5. package/ansible/roles/backup-check/templates/backup-check.sh.j2 +25 -42
  6. package/ansible/roles/monitor/tasks/main.yml +58 -0
  7. package/ansible/roles/monitor/templates/config.yaml.j2 +33 -0
  8. package/ansible/roles/monitor/templates/docker-compose.yml.j2 +17 -0
  9. package/ansible/roles/monitor/templates/env.j2 +4 -0
  10. package/ansible/roles/ntfy/files/docker-compose.yml +25 -0
  11. package/ansible/roles/ntfy/handlers/main.yml +6 -0
  12. package/ansible/roles/ntfy/tasks/main.yml +37 -0
  13. package/ansible/roles/ntfy/templates/server.yml.j2 +23 -0
  14. package/ansible/roles/platform/defaults/main.yml +5 -3
  15. package/ansible/roles/platform/tasks/main.yml +16 -8
  16. package/cli/dist/core/fleet/settings.js +16 -8
  17. package/cli/dist/core/recipes/host.js +2 -1
  18. package/cli/dist/core/recipes/steps.js +7 -0
  19. package/cli/dist/deployer/build/builder.js +17 -1
  20. package/cli/dist/deployer/deployer.js +18 -4
  21. package/cli/dist/deployer/forges/notify.js +8 -8
  22. package/cli/dist/deployer/forges/ntfy.js +35 -0
  23. package/cli/dist/deployer/health.js +42 -0
  24. package/cli/dist/deployer/settings.js +11 -17
  25. package/compose/docker-compose.ci.yml +7 -1
  26. package/package.json +1 -1
  27. package/schema/defaults.json +102 -19
  28. package/schema/vars-edge.json +121 -9
  29. package/schema/vars-platform.json +55 -10
  30. package/scripts/local/monitor-endpoints.sh +98 -0
  31. package/cli/dist/deployer/forges/issues.js +0 -72
@@ -19,13 +19,15 @@ import { spawnLines } from "./process.js";
19
19
  import { appendLog, meta, owners, prune, runsOf, writeMeta } from "./runs/store.js";
20
20
  import { runsDir, settings, token } from "./settings.js";
21
21
  import { typed } from "../lib/typed.js";
22
+ import { assess, gather } from "./health.js";
22
23
  /**
23
24
  * The deployer: the half that holds the docker socket and the app secrets.
24
25
  * Never routed by Traefik. It queues runs, asks the builder for bundles,
25
26
  * admits and starts them, records releases, posts commit statuses, and runs
26
27
  * the platform's scheduled jobs (registry GC, Renovate, the hourly poll).
27
28
  *
28
- * :8090 platform-internal: POST /push/<app> (the builder, after a webhook)
29
+ * :8090 platform-internal: POST /push/<app> (the builder, after a webhook),
30
+ * GET /health (the builder, for deploy.<domain>/health)
29
31
  * :8091 inside the container only: POST /deploy, POST /job (kayra app …, kayra job …)
30
32
  */
31
33
  /** Raises or resolves what the finished run means; a notifier's failure is logged, never the run's. */
@@ -193,7 +195,19 @@ const accept = (s, response, request) => {
193
195
  send(response, 202, `${JSON.stringify({ id: request.id, owner: request.owner, state: started ? "running" : "queued" })}\n`);
194
196
  };
195
197
  /** POST /push/<app>, from the builder once a webhook proved itself: a deploy of the app's own ref. */
196
- const push = (s, request, response) => {
198
+ const health = async (s, response) => {
199
+ const apps = registeredApps(s).map((app) => {
200
+ const dir = join(s.platformDir, "releases", app.name);
201
+ return Object.freeze({ name: app.name, released: existsSync(dir) && readdirSync(dir).length > 0 });
202
+ });
203
+ const assessed = assess(await gather(apps, runsDir(s)));
204
+ send(response, assessed.healthy ? 200 : 503, JSON.stringify(assessed), "application/json");
205
+ };
206
+ const push = async (s, request, response) => {
207
+ if (request.method === "GET" && new URL(request.url ?? "/", "http://deployer").pathname === "/health") {
208
+ await health(s, response);
209
+ return;
210
+ }
197
211
  const name = /^\/push\/([^/]+)$/.exec(new URL(request.url ?? "/", "http://deployer").pathname)?.[1];
198
212
  const app = name === undefined || !appName(name).ok ? undefined : registered(s.platformDir, name);
199
213
  if (request.method !== "POST" || app === undefined) {
@@ -239,9 +253,9 @@ const control = async (s, request, response) => {
239
253
  export const serveDeployer = (env) => {
240
254
  const s = settings(env);
241
255
  abandon(s);
242
- createServer(handle((request, response) => { push(s, request, response); })).listen(8090);
256
+ createServer(handle((request, response) => push(s, request, response))).listen(8090);
243
257
  createServer(handle((request, response) => control(s, request, response))).listen(8091, "127.0.0.1");
244
258
  schedule(s);
245
259
  setTimeout(() => { void restore(s); }, restoreAfter);
246
- console.log(`deployer: :8090 pushes, 127.0.0.1:8091 control; renovate ${s.renovate === undefined ? "off" : "on"}`);
260
+ console.log(`deployer: :8090 pushes and health, 127.0.0.1:8091 control; renovate ${s.renovate === undefined ? "off" : "on"}`);
247
261
  };
@@ -13,15 +13,15 @@ export const parseNotify = (raw) => {
13
13
  if (typeof json !== "object" || json === null)
14
14
  return err("notifier: not an object");
15
15
  const kind = field(json, "kind");
16
- const repository = field(json, "repository");
17
- const appId = field(json, "app_id");
18
- if (kind !== "github-issue")
16
+ const url = field(json, "url");
17
+ const topic = field(json, "topic");
18
+ if (kind !== "ntfy")
19
19
  return err(`notifier: unknown kind ${String(kind)}`);
20
- if (typeof repository !== "string" || !/^[\w.-]+\/[\w.-]+$/.test(repository))
21
- return err(`notifier: repository ${String(repository)}`);
22
- if (typeof appId !== "string" && typeof appId !== "number")
23
- return err("notifier: app_id missing");
24
- return ok({ kind, repository, appId: String(appId) });
20
+ if (typeof url !== "string" || !/^https?:\/\/[^\s/]+\/?$/.test(url))
21
+ return err(`notifier: url ${String(url)}`);
22
+ if (typeof topic !== "string" || !/^[\w-]{1,64}$/.test(topic))
23
+ return err(`notifier: topic ${String(topic)}`);
24
+ return ok({ kind, url: url.replace(/\/$/, ""), topic });
25
25
  }
26
26
  catch {
27
27
  return err("notifier: not JSON");
@@ -0,0 +1,35 @@
1
+ import { err, ok } from "../../lib/result.js";
2
+ import { typed } from "../../lib/typed.js";
3
+ export const ntfy = (url, topic, world) => {
4
+ const publish = async (message) => {
5
+ const token = world.token();
6
+ if (!token.ok)
7
+ return token;
8
+ const response = await world
9
+ .fetch(url, {
10
+ method: "POST",
11
+ headers: { Authorization: `Bearer ${token.value}`, "Content-Type": "application/json" },
12
+ body: JSON.stringify(message),
13
+ })
14
+ .catch((error) => ({ status: 0, error: String(error) }));
15
+ return response.status >= 200 && response.status < 300 ? ok(undefined) : err(`ntfy POST ${url}: ${"error" in response ? response.error : String(response.status)}`);
16
+ };
17
+ const raise = async (alert) => {
18
+ if (world.openAlert(alert.key) !== undefined)
19
+ return ok(undefined);
20
+ const sent = await publish({ topic, title: alert.title, message: alert.body, priority: 4, tags: ["rotating_light"] });
21
+ if (sent.ok)
22
+ world.remember(alert.key, alert.title);
23
+ return sent;
24
+ };
25
+ const resolve = async (key, note) => {
26
+ const title = world.openAlert(key);
27
+ if (title === undefined)
28
+ return ok(undefined);
29
+ const sent = await publish({ topic, title: `Resolved: ${title}`, message: note, priority: 3, tags: ["white_check_mark"] });
30
+ if (sent.ok)
31
+ world.remember(key, undefined);
32
+ return sent;
33
+ };
34
+ return typed({ raise, resolve });
35
+ };
@@ -0,0 +1,42 @@
1
+ import { readFileSync, statfsSync } from "node:fs";
2
+ import { spawnLines } from "./process.js";
3
+ import { typed } from "../lib/typed.js";
4
+ const percent = (fraction) => `${String(Math.round(fraction * 100))}%`;
5
+ /** Like verify: a one-shot container (an init, a migration) exits 0 and stays exited. */
6
+ const unwell = (container) => (container.state !== "running" && !container.status.startsWith("Exited (0)")) || /unhealthy|health: starting/.test(container.status);
7
+ const containerProblems = (containers, apps) => Object.freeze([
8
+ ...["platform", ...apps.map((app) => app.name)].flatMap((project) => Object.freeze(containers.filter((container) => container.project === project && unwell(container)).map((container) => `${project}: ${container.name} ${container.status}`))),
9
+ ...apps.filter((app) => app.released && !containers.some((container) => container.project === app.name)).map((app) => `${app.name}: no containers`),
10
+ ]);
11
+ export const assess = (facts) => {
12
+ const disk = facts.diskUsed >= 0.9 ? [`disk ${percent(facts.diskUsed)} full`] : [];
13
+ const memory = facts.memoryAvailable < 0.05 ? [`memory ${percent(facts.memoryAvailable)} available`] : [];
14
+ const containers = facts.containers === undefined ? ["docker did not answer"] : containerProblems(facts.containers, facts.apps);
15
+ const problems = Object.freeze([...containers, ...disk, ...memory]);
16
+ const warnings = Object.freeze([
17
+ ...(facts.diskUsed >= 0.8 && facts.diskUsed < 0.9 ? [`disk ${percent(facts.diskUsed)} full`] : []),
18
+ ...(facts.memoryAvailable >= 0.05 && facts.memoryAvailable < 0.1 ? [`memory ${percent(facts.memoryAvailable)} available`] : []),
19
+ ]);
20
+ return typed({ healthy: problems.length === 0, problems, warnings });
21
+ };
22
+ export const parseContainers = (stdout) => Object.freeze(stdout.split("\n").flatMap((line) => {
23
+ const [project = "", name = "", state = "", status = ""] = line.split("|");
24
+ return Object.freeze(project === "" ? [] : [typed({ project, name, state, status })]);
25
+ }));
26
+ /** MemAvailable over MemTotal, from /proc/meminfo: the host's, a container sees no other. */
27
+ export const memoryAvailable = (meminfo) => {
28
+ const kib = (key) => Number(new RegExp(`^${key}:\\s+(\\d+)`, "m").exec(meminfo)?.[1] ?? Number.NaN);
29
+ const fraction = kib("MemAvailable") / kib("MemTotal");
30
+ return Number.isFinite(fraction) ? fraction : 1;
31
+ };
32
+ /** The facts on this server: `disk` is a path on the host's disk (a mount of the platform's directory). */
33
+ export const gather = async (apps, disk) => {
34
+ const listed = await spawnLines(["docker", "ps", "-a", "--format", '{{.Label "com.docker.compose.project"}}|{{.Names}}|{{.State}}|{{.Status}}'], { capture: true, timeoutMs: 30_000 }, () => undefined);
35
+ const fs = statfsSync(disk);
36
+ return typed({
37
+ containers: listed.code === 0 ? parseContainers(listed.stdout) : undefined,
38
+ apps,
39
+ diskUsed: 1 - fs.bavail / fs.blocks,
40
+ memoryAvailable: memoryAvailable(readFileSync("/proc/meminfo", "utf8")),
41
+ });
42
+ };
@@ -2,8 +2,8 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
2
2
  import { join } from "node:path";
3
3
  import { err, ok } from "../lib/result.js";
4
4
  import { parseCron } from "./cron.js";
5
- import { githubIssues } from "./forges/issues.js";
6
5
  import { parseNotify, silent } from "./forges/notify.js";
6
+ import { ntfy } from "./forges/ntfy.js";
7
7
  import { typed } from "../lib/typed.js";
8
8
  /** Mounted into the deployer only: the platform's tokens, each app's secrets, the notifier's key. */
9
9
  export const mounts = { platform: "/run/platform-secrets", apps: "/run/app-secrets", deployer: "/run/deployer-secrets" };
@@ -17,31 +17,25 @@ const must = (result) => {
17
17
  throw new Error(result.error);
18
18
  return result.value;
19
19
  };
20
- /** The configured notifier; its open alerts are kept in <platformDir>/alerts/<key>. */
20
+ /** The configured notifier; its open alerts are kept in <platformDir>/alerts/<key>, each holding its title. */
21
21
  const notifierFor = (config, platformDir) => {
22
22
  if (config.kind === "none")
23
23
  return silent;
24
24
  const alerts = join(platformDir, "alerts");
25
- const keyFile = join(mounts.deployer, "NOTIFIER_GITHUB_APP_KEY");
26
- return githubIssues(config.repository, config.appId, {
27
- fetch: async (url, init) => {
28
- const response = await fetch(url, init);
29
- const json = await response.json().catch(() => undefined);
30
- return Object.freeze({ status: response.status, json });
31
- },
32
- privateKey: () => (existsSync(keyFile) ? ok(readFileSync(keyFile, "utf8")) : err(`${keyFile} is missing: notifier_github_app_key in secrets.yml`)),
33
- now: () => Date.now(),
34
- openIssue: (key) => {
25
+ const tokenFile = join(mounts.deployer, "NOTIFIER_NTFY_TOKEN");
26
+ return ntfy(config.url, config.topic, {
27
+ fetch: async (url, init) => Object.freeze({ status: (await fetch(url, init)).status }),
28
+ token: () => (existsSync(tokenFile) ? ok(readFileSync(tokenFile, "utf8").trim()) : err(`${tokenFile} is missing: notifier_ntfy_token in secrets.yml`)),
29
+ openAlert: (key) => {
35
30
  const path = join(alerts, key);
36
- const number = existsSync(path) ? Number(readFileSync(path, "utf8")) : Number.NaN;
37
- return Number.isInteger(number) ? number : undefined;
31
+ return existsSync(path) ? readFileSync(path, "utf8") : undefined;
38
32
  },
39
- remember: (key, issue) => {
33
+ remember: (key, title) => {
40
34
  mkdirSync(alerts, { recursive: true });
41
- if (issue === undefined)
35
+ if (title === undefined)
42
36
  rmSync(join(alerts, key), { force: true });
43
37
  else
44
- writeFileSync(join(alerts, key), String(issue));
38
+ writeFileSync(join(alerts, key), title);
45
39
  },
46
40
  });
47
41
  };
@@ -73,7 +73,7 @@ services:
73
73
  - builder-work:/work
74
74
  - ./apps:/opt/platform/apps:ro
75
75
  - ./runs:/opt/platform/runs:ro
76
- # GIT_TOKEN, to clone. Files, so a new one needs no restart.
76
+ # GIT_TOKEN, to clone; HEALTH_TOKEN, for /health. Files, so a new one needs no restart.
77
77
  - ./platform-secrets:/run/platform-secrets:ro
78
78
  mem_limit: 512m
79
79
  labels:
@@ -90,6 +90,12 @@ services:
90
90
  - "traefik.http.routers.deploy-hook.tls.certresolver=le"
91
91
  - "traefik.http.routers.deploy-hook.priority=100"
92
92
  - "traefik.http.routers.deploy-hook.service=deploy"
93
+ # A monitor cannot log in either; the builder checks health_token.
94
+ - "traefik.http.routers.deploy-health.rule=Host(`deploy.${DOMAIN:-localhost}`) && Path(`/health`)"
95
+ - "traefik.http.routers.deploy-health.entrypoints=websecure"
96
+ - "traefik.http.routers.deploy-health.tls.certresolver=le"
97
+ - "traefik.http.routers.deploy-health.priority=100"
98
+ - "traefik.http.routers.deploy-health.service=deploy"
93
99
  - "traefik.http.services.deploy.loadbalancer.server.port=8080"
94
100
  networks:
95
101
  - internal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yunuseon/kayra",
3
- "version": "0.21.1",
3
+ "version": "0.22.1",
4
4
  "description": "A self-hosted app platform and the CLI that runs it: Traefik, Authelia, a registry, rootless BuildKit and a small deployer per server, set up with OpenTofu and Ansible.",
5
5
  "license": "MIT",
6
6
  "author": "Yunus Öztürk",
@@ -477,6 +477,99 @@
477
477
  },
478
478
  "description": "Public names the edge serves: subdomains of the domain and the upstream inside the tunnel they go to."
479
479
  },
480
+ "ntfy": {
481
+ "type": "object",
482
+ "properties": {
483
+ "base_url": {
484
+ "type": "string"
485
+ },
486
+ "upstream_base_url": {
487
+ "type": "string"
488
+ },
489
+ "access": {
490
+ "type": "array",
491
+ "items": {
492
+ "type": "object",
493
+ "properties": {
494
+ "user": {
495
+ "type": "string"
496
+ },
497
+ "topic": {
498
+ "type": "string"
499
+ },
500
+ "permission": {
501
+ "type": "string",
502
+ "enum": [
503
+ "rw",
504
+ "ro",
505
+ "wo",
506
+ "deny"
507
+ ]
508
+ }
509
+ },
510
+ "required": [
511
+ "user",
512
+ "topic",
513
+ "permission"
514
+ ],
515
+ "additionalProperties": {}
516
+ }
517
+ }
518
+ },
519
+ "required": [
520
+ "base_url",
521
+ "access"
522
+ ],
523
+ "additionalProperties": {},
524
+ "description": "An ntfy server for alerts, behind Caddy (an edge_routes entry to ntfy:80): its public base_url, who may read or publish which topic (everything else denied), and upstream_base_url (https://ntfy.sh) for iPhones, whose instant push only ntfy.sh can wake."
525
+ },
526
+ "monitor": {
527
+ "type": "object",
528
+ "properties": {
529
+ "watch": {
530
+ "type": "array",
531
+ "items": {
532
+ "type": "string"
533
+ }
534
+ },
535
+ "extra": {
536
+ "type": "array",
537
+ "items": {
538
+ "type": "object",
539
+ "properties": {
540
+ "name": {
541
+ "type": "string"
542
+ },
543
+ "url": {
544
+ "type": "string"
545
+ },
546
+ "group": {
547
+ "type": "string"
548
+ },
549
+ "server": {
550
+ "type": "string"
551
+ },
552
+ "conditions": {
553
+ "type": "array",
554
+ "items": {
555
+ "type": "string"
556
+ }
557
+ }
558
+ },
559
+ "required": [
560
+ "name",
561
+ "url"
562
+ ],
563
+ "additionalProperties": {}
564
+ }
565
+ }
566
+ },
567
+ "required": [
568
+ "watch"
569
+ ],
570
+ "additionalProperties": {},
571
+ "description": "Gatus on this server, alerting through the notifier: every minute, what kayra derives for each server in watch (its logins, pages, app routes, deploy.<domain>/health; an edge's routes; certificates) with each name pinned to that server's address, plus extra checks (Gatus conditions, default [STATUS] == 200; server pins the name to that server's address)."
572
+ },
480
573
  "notifier": {
481
574
  "oneOf": [
482
575
  {
@@ -484,27 +577,25 @@
484
577
  "properties": {
485
578
  "kind": {
486
579
  "type": "string",
487
- "const": "github-issue"
580
+ "const": "ntfy"
488
581
  },
489
- "repository": {
582
+ "url": {
490
583
  "type": "string"
491
584
  },
492
- "app_id": {
493
- "type": [
494
- "string",
495
- "number"
496
- ]
585
+ "topic": {
586
+ "type": "string",
587
+ "pattern": "^[\\w-]{1,64}$"
497
588
  }
498
589
  },
499
590
  "required": [
500
591
  "kind",
501
- "repository",
502
- "app_id"
592
+ "url",
593
+ "topic"
503
594
  ],
504
595
  "additionalProperties": false
505
596
  }
506
597
  ],
507
- "description": "Where the deployer raises alerts (a failed deploy of an app's ref, a failed job) and resolves them: kind github-issue, an issue in repository (owner/name) opened by the GitHub App app_id; the key in notifier_github_app_key."
598
+ "description": "Where alerts go — the deployer's (a failed deploy of an app's ref, a failed job) and the backup check's: kind ntfy, a message to topic on the ntfy server at url when an alert opens and when it is resolved; the token in notifier_ntfy_token."
508
599
  },
509
600
  "backup_check": {
510
601
  "type": "object",
@@ -512,12 +603,6 @@
512
603
  "stale_after_hours": {
513
604
  "type": "number"
514
605
  },
515
- "github_repository": {
516
- "type": "string"
517
- },
518
- "github_app_id": {
519
- "type": "string"
520
- },
521
606
  "repositories": {
522
607
  "type": "array",
523
608
  "items": {
@@ -547,12 +632,10 @@
547
632
  },
548
633
  "required": [
549
634
  "stale_after_hours",
550
- "github_repository",
551
- "github_app_id",
552
635
  "repositories"
553
636
  ],
554
637
  "additionalProperties": {},
555
- "description": "The hourly check of the private network's backups: when a snapshot is stale, where issues go, which repositories."
638
+ "description": "The hourly check of the private network's backups: when a snapshot is stale, which repositories. Its alerts go to the notifier."
556
639
  }
557
640
  },
558
641
  "additionalProperties": false,
@@ -67,18 +67,132 @@
67
67
  },
68
68
  "description": "Public names the edge serves: subdomains of the domain and the upstream inside the tunnel they go to."
69
69
  },
70
- "backup_check": {
70
+ "ntfy": {
71
71
  "type": "object",
72
72
  "properties": {
73
- "stale_after_hours": {
74
- "type": "number"
75
- },
76
- "github_repository": {
73
+ "base_url": {
77
74
  "type": "string"
78
75
  },
79
- "github_app_id": {
76
+ "upstream_base_url": {
80
77
  "type": "string"
81
78
  },
79
+ "access": {
80
+ "type": "array",
81
+ "items": {
82
+ "type": "object",
83
+ "properties": {
84
+ "user": {
85
+ "type": "string"
86
+ },
87
+ "topic": {
88
+ "type": "string"
89
+ },
90
+ "permission": {
91
+ "type": "string",
92
+ "enum": [
93
+ "rw",
94
+ "ro",
95
+ "wo",
96
+ "deny"
97
+ ]
98
+ }
99
+ },
100
+ "required": [
101
+ "user",
102
+ "topic",
103
+ "permission"
104
+ ],
105
+ "additionalProperties": {}
106
+ }
107
+ }
108
+ },
109
+ "required": [
110
+ "base_url",
111
+ "access"
112
+ ],
113
+ "additionalProperties": {},
114
+ "description": "An ntfy server for alerts, behind Caddy (an edge_routes entry to ntfy:80): its public base_url, who may read or publish which topic (everything else denied), and upstream_base_url (https://ntfy.sh) for iPhones, whose instant push only ntfy.sh can wake."
115
+ },
116
+ "monitor": {
117
+ "type": "object",
118
+ "properties": {
119
+ "watch": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "string"
123
+ }
124
+ },
125
+ "extra": {
126
+ "type": "array",
127
+ "items": {
128
+ "type": "object",
129
+ "properties": {
130
+ "name": {
131
+ "type": "string"
132
+ },
133
+ "url": {
134
+ "type": "string"
135
+ },
136
+ "group": {
137
+ "type": "string"
138
+ },
139
+ "server": {
140
+ "type": "string"
141
+ },
142
+ "conditions": {
143
+ "type": "array",
144
+ "items": {
145
+ "type": "string"
146
+ }
147
+ }
148
+ },
149
+ "required": [
150
+ "name",
151
+ "url"
152
+ ],
153
+ "additionalProperties": {}
154
+ }
155
+ }
156
+ },
157
+ "required": [
158
+ "watch"
159
+ ],
160
+ "additionalProperties": {},
161
+ "description": "Gatus on this server, alerting through the notifier: every minute, what kayra derives for each server in watch (its logins, pages, app routes, deploy.<domain>/health; an edge's routes; certificates) with each name pinned to that server's address, plus extra checks (Gatus conditions, default [STATUS] == 200; server pins the name to that server's address)."
162
+ },
163
+ "notifier": {
164
+ "oneOf": [
165
+ {
166
+ "type": "object",
167
+ "properties": {
168
+ "kind": {
169
+ "type": "string",
170
+ "const": "ntfy"
171
+ },
172
+ "url": {
173
+ "type": "string"
174
+ },
175
+ "topic": {
176
+ "type": "string",
177
+ "pattern": "^[\\w-]{1,64}$"
178
+ }
179
+ },
180
+ "required": [
181
+ "kind",
182
+ "url",
183
+ "topic"
184
+ ],
185
+ "additionalProperties": false
186
+ }
187
+ ],
188
+ "description": "Where alerts go — the deployer's (a failed deploy of an app's ref, a failed job) and the backup check's: kind ntfy, a message to topic on the ntfy server at url when an alert opens and when it is resolved; the token in notifier_ntfy_token."
189
+ },
190
+ "backup_check": {
191
+ "type": "object",
192
+ "properties": {
193
+ "stale_after_hours": {
194
+ "type": "number"
195
+ },
82
196
  "repositories": {
83
197
  "type": "array",
84
198
  "items": {
@@ -108,12 +222,10 @@
108
222
  },
109
223
  "required": [
110
224
  "stale_after_hours",
111
- "github_repository",
112
- "github_app_id",
113
225
  "repositories"
114
226
  ],
115
227
  "additionalProperties": {},
116
- "description": "The hourly check of the private network's backups: when a snapshot is stale, where issues go, which repositories."
228
+ "description": "The hourly check of the private network's backups: when a snapshot is stale, which repositories. Its alerts go to the notifier."
117
229
  }
118
230
  },
119
231
  "additionalProperties": false,
@@ -324,6 +324,53 @@
324
324
  "additionalProperties": {},
325
325
  "description": "The server's own compose stacks: their directory on the server and the names under stacks/ to run."
326
326
  },
327
+ "monitor": {
328
+ "type": "object",
329
+ "properties": {
330
+ "watch": {
331
+ "type": "array",
332
+ "items": {
333
+ "type": "string"
334
+ }
335
+ },
336
+ "extra": {
337
+ "type": "array",
338
+ "items": {
339
+ "type": "object",
340
+ "properties": {
341
+ "name": {
342
+ "type": "string"
343
+ },
344
+ "url": {
345
+ "type": "string"
346
+ },
347
+ "group": {
348
+ "type": "string"
349
+ },
350
+ "server": {
351
+ "type": "string"
352
+ },
353
+ "conditions": {
354
+ "type": "array",
355
+ "items": {
356
+ "type": "string"
357
+ }
358
+ }
359
+ },
360
+ "required": [
361
+ "name",
362
+ "url"
363
+ ],
364
+ "additionalProperties": {}
365
+ }
366
+ }
367
+ },
368
+ "required": [
369
+ "watch"
370
+ ],
371
+ "additionalProperties": {},
372
+ "description": "Gatus on this server, alerting through the notifier: every minute, what kayra derives for each server in watch (its logins, pages, app routes, deploy.<domain>/health; an edge's routes; certificates) with each name pinned to that server's address, plus extra checks (Gatus conditions, default [STATUS] == 200; server pins the name to that server's address)."
373
+ },
327
374
  "notifier": {
328
375
  "oneOf": [
329
376
  {
@@ -331,27 +378,25 @@
331
378
  "properties": {
332
379
  "kind": {
333
380
  "type": "string",
334
- "const": "github-issue"
381
+ "const": "ntfy"
335
382
  },
336
- "repository": {
383
+ "url": {
337
384
  "type": "string"
338
385
  },
339
- "app_id": {
340
- "type": [
341
- "string",
342
- "number"
343
- ]
386
+ "topic": {
387
+ "type": "string",
388
+ "pattern": "^[\\w-]{1,64}$"
344
389
  }
345
390
  },
346
391
  "required": [
347
392
  "kind",
348
- "repository",
349
- "app_id"
393
+ "url",
394
+ "topic"
350
395
  ],
351
396
  "additionalProperties": false
352
397
  }
353
398
  ],
354
- "description": "Where the deployer raises alerts (a failed deploy of an app's ref, a failed job) and resolves them: kind github-issue, an issue in repository (owner/name) opened by the GitHub App app_id; the key in notifier_github_app_key."
399
+ "description": "Where alerts go — the deployer's (a failed deploy of an app's ref, a failed job) and the backup check's: kind ntfy, a message to topic on the ntfy server at url when an alert opens and when it is resolved; the token in notifier_ntfy_token."
355
400
  }
356
401
  },
357
402
  "additionalProperties": false,