Name ports after the Docker containers that publish them

The health pass keeps the host ports Dockhand says running containers
publish (new table server_container_ports, migration 0080), matched to a
server by its Docker host's name. They name the port on the server's Ports
card and the network Ports table, ahead of a port preset and behind a
label somebody wrote, and in the new-port alert ("8096/tcp jellyfin
(container)"). Never written onto port notes, so a container's port is
still a new port; an unreadable host keeps its names, a day-old name is
dropped. Dockhand is now read on the health pass even with container
alerts off.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-31 22:45:50 +01:00
1 parent 75f060049f
commit 9ca83994fb
18 files changed
+9026 -29

No files matched your search

+20 -3
View File
@@ -23,8 +23,8 @@ what the app actually creates.
|---|---|
| **File** | `DATABASE_PATH`, default `../data/homelab-manager.sqlite` (relative to `server/`; `/app/data/...` in Docker). The folder is created if missing. |
| **Foreign keys** | Switched on for every connection (`PRAGMA foreign_keys = ON`), so the `ON DELETE` rules below are enforced. |
| **Migrations** | SQL files in [`server/drizzle/`](server/drizzle) (`0000` … `0079`), applied automatically when the server starts. Which ones have run is recorded in the table `__drizzle_migrations`. |
| **Tables** | 89 application tables, plus drizzle's own `__drizzle_migrations`. |
| **Migrations** | SQL files in [`server/drizzle/`](server/drizzle) (`0000` … `0080`), applied automatically when the server starts. Which ones have run is recorded in the table `__drizzle_migrations`. |
| **Tables** | 90 application tables, plus drizzle's own `__drizzle_migrations`. |
**Not in the database, but beside it in the data folder:** the backups of the database itself (`backups/homelab-manager-….sqlite`, taken daily and on request; see [BACKUP.md](BACKUP.md)), and, only while a restore is waiting or has just happened, `restore-pending.sqlite` / `restore-pending.json` and `restore-result.json`.
@@ -95,6 +95,7 @@ erDiagram
servers ||--o{ server_links : "cascade"
servers ||--o{ server_metrics : "cascade"
servers ||--o{ server_ports : "cascade"
servers ||--o{ server_container_ports : "cascade"
servers ||--o{ port_forwards : "optional (set null)"
integrations ||--o{ servers : "proxmox link (app clears it)"
integrations ||--o{ alert_tickets : "osTicket used (set null)"
@@ -348,6 +349,22 @@ sees is stored on the server row instead (`servers.listening_ports`).
Unique index **`server_ports_unique`** on (`server_id`, `port`, `protocol`).
#### `server_container_ports`
The host ports the containers on a server publish, as Dockhand last said: one row per port, replaced for a server each time its Docker host is read on the health pass (the Docker host is matched to a server by its name there, as Uptime Kuma targets are). It only names a port — on the Ports pages (ahead of a port preset's name, behind a label somebody wrote) and in the new-port alert — and is never copied into `server_ports`, so it does not make a port "expected". A host Dockhand can't read keeps its rows; rows not refreshed for a day are ignored and deleted.
| Column | Type | Notes |
|---|---|---|
| `id` | integer PK | |
| `server_id` | integer NOT NULL → `servers.id`, **cascade** | |
| `port` | integer NOT NULL | The port on the host. |
| `protocol` | text NOT NULL, default `tcp` | `tcp` | `udp`. |
| `container` | text NOT NULL | The container's name. |
| `image` | text NOT NULL, default `''` | Its image, for the hover text. |
| `updated_at` | text NOT NULL | ISO; when it was last read. |
Unique index **`server_container_ports_unique`** on (`server_id`, `port`, `protocol`).
#### `port_forwards`
Manually recorded port openings on something this app doesn't monitor — a
@@ -1546,7 +1563,7 @@ settings, and aren't part of the app's settings object:
| Deleting… | Effect |
|---|---|
| a **server** | Its `scheduled_tasks`, `server_links`, `server_ports`, `server_metrics`, `server_metrics_rollup`, `update_runs` and `network_server_links` are deleted with it. Port forwards that pointed at it stay, with `server_id` cleared. Things that refer to it by id only (notes, to-do items, endpoint checks, heartbeats, alert rules, dependencies, runbooks, maintenance windows) stay, pointing at nothing — see below. |
| a **server** | Its `scheduled_tasks`, `server_links`, `server_ports`, `server_container_ports`, `server_metrics`, `server_metrics_rollup`, `update_runs` and `network_server_links` are deleted with it. Port forwards that pointed at it stay, with `server_id` cleared. Things that refer to it by id only (notes, to-do items, endpoint checks, heartbeats, alert rules, dependencies, runbooks, maintenance windows) stay, pointing at nothing — see below. |
| a **DNS provider** | Its cached zones and records are deleted. |
| an **integration** | What was read from it is deleted with it: UniFi devices, networks and server links, Home Assistant watched entities and readings, a UPS's state and readings, and the history of its storage pools (`storage_series`, `storage_samples`). |
| an **endpoint check**, a **heartbeat**, an **incident**, a **patch plan**, a **share link**, an **event webhook** | Their results and summaries (`endpoint_results`, `_hourly`, `_daily`), pings, notes, runs, status-page items and delivery log (`webhook_deliveries`). |