Racks, notes and to-do, OS support, suggested dependencies, Nginx Proxy Manager and Home Assistant
- Racks page and a network diagram (UniFi tree with servers, printable) - Notes on servers and devices; To do list shown in Coming up and My work - Agents report the operating system (Linux 7, Windows 6); end-of-life badge and alert - Suggested dependencies from where a service is reached - Nginx Proxy Manager integration: proxy hosts page, certificate and host alerts, suggested checks - Home Assistant integration: watch chosen entities, history chart, limit and unavailable alerts - TimeChart gets a "value" scale that fits negatives; docs updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68b41b5586
commit
18ceed62e8
77 files changed
+20432
-35
No files matched your search
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* - A web port a server's agent sees open (80, 443, 8080, 8443), with a name that points at it in DNS if there is one — "git.example.lan answers on
|
||||
* 443 on nas" — as a web check, linked to that server so its maintenance silences the alerts.
|
||||
* - A host Nginx Proxy Manager serves ("wiki.example.com" forwarding to a server the app knows), as a web check on the name people really use, linked to the
|
||||
* server it forwards to.
|
||||
* - A secret that already has a host to read the certificate from, as a certificate check: the secret only warns about the expiry, this also hears
|
||||
* when the service stops answering.
|
||||
*
|
||||
@@ -12,6 +14,8 @@
|
||||
import { db } from "../db/client.js";
|
||||
import { dnsRecordsCache, endpointChecks, secrets, servers } from "../db/schema.js";
|
||||
import { isLoopback } from "./agentPorts.js";
|
||||
import { npmIntegrationIds, readNpm } from "./npmReader.js";
|
||||
import { matchServerForTarget } from "./uptimeKumaMatch.js";
|
||||
import { getInternalFlag, setInternalFlag } from "./settingsStore.js";
|
||||
|
||||
export interface Suggestion {
|
||||
@@ -33,6 +37,8 @@ export interface SuggestionInput {
|
||||
secrets: { name: string; checkHost: string | null; checkPort: number | null }[];
|
||||
existing: { kind: string; target: string; port: number | null }[];
|
||||
dismissed: Set<string>;
|
||||
/** Hosts an Nginx Proxy Manager serves, with the server they forward to when the app knows it. */
|
||||
proxied?: { domain: string; secure: boolean; serverId: number | null; serverName: string | null; integrationName: string }[];
|
||||
}
|
||||
|
||||
/** The web ports worth offering, and what they speak. */
|
||||
@@ -112,6 +118,25 @@ export function suggestChecks(input: SuggestionInput): { suggestions: Suggestion
|
||||
}
|
||||
}
|
||||
|
||||
for (const p of input.proxied ?? []) {
|
||||
const host = cleanHost(p.domain);
|
||||
if (!host.includes(".") || host.startsWith("*") || /s/.test(host) || isIPv4(host)) continue;
|
||||
const port = p.secure ? 443 : 80;
|
||||
if (covered.has(`web:${host}:${port}`)) continue;
|
||||
const key = `http|${p.secure ? "https" : "http"}://${host}/`;
|
||||
if (all.has(key)) continue;
|
||||
all.set(key, {
|
||||
key,
|
||||
kind: "http",
|
||||
name: host,
|
||||
target: `${p.secure ? "https" : "http"}://${host}/`,
|
||||
port: null,
|
||||
serverId: p.serverId,
|
||||
serverName: p.serverName,
|
||||
reason: `${p.integrationName} serves ${host}${p.serverName ? `, forwarding to ${p.serverName}` : ""}.`,
|
||||
});
|
||||
}
|
||||
|
||||
for (const sec of input.secrets) {
|
||||
if (!sec.checkHost || sec.checkPort === null) continue;
|
||||
const host = cleanHost(sec.checkHost);
|
||||
@@ -176,7 +201,19 @@ export async function loadSuggestions(): Promise<{ suggestions: Suggestion[]; di
|
||||
db.select({ kind: endpointChecks.kind, target: endpointChecks.target, port: endpointChecks.port }).from(endpointChecks),
|
||||
loadDismissed(),
|
||||
]);
|
||||
// What Nginx Proxy Manager serves (a read is kept for a minute, and an NPM that can't be reached just adds nothing).
|
||||
const matchable = serverRows.map((s) => ({ id: s.id, name: s.name, hostname: s.hostname, ips: jsonArray<string>(s.ipAddresses).filter((i) => typeof i === "string") }));
|
||||
const proxied: NonNullable<SuggestionInput["proxied"]> = [];
|
||||
for (const i of await npmIntegrationIds()) {
|
||||
const read = await readNpm(i.id);
|
||||
for (const h of read.snapshot?.hosts ?? []) {
|
||||
if (!h.enabled) continue;
|
||||
const server = matchServerForTarget(h.forwardHost, matchable);
|
||||
for (const domain of h.domains) proxied.push({ domain, secure: h.sslForced || h.certificate !== null, serverId: server?.id ?? null, serverName: server?.name ?? null, integrationName: i.name });
|
||||
}
|
||||
}
|
||||
return suggestChecks({
|
||||
proxied,
|
||||
servers: serverRows.map((s) => ({ id: s.id, name: s.name, hostname: s.hostname, ips: jsonArray<string>(s.ipAddresses).filter((i) => typeof i === "string"), ports: jsonArray<{ protocol?: string; port: number; address?: string }>(s.listeningPorts).filter((p) => p && Number.isInteger(p.port)) })),
|
||||
dns: dnsRows,
|
||||
secrets: secretRows,
|
||||
|
||||
Reference in new issue
Block a user