Compare commits

...
1 Commits
Author SHA1 Message Date
jschoubben 37c212d5b4 unifi: placed data, mesh-assigned ports, an https route, and its password as a file
The module stated /services/unifi/data and fixed machine ports (8443:8443 and
eight more) — one installation's layout and numbers, which a definition may not
carry (ADR 0038, 0112). Data is now a placed directory (${dir:data}, 1000:1000,
0700), the container publishes its own ports and the mesh assigns the machine
side; an assignment pins them where devices already know them. The L2 endpoint
names the port the software uses (1900), not the one a machine published it on.

The sidecar dialled https://127.0.0.1:8443, true only while the machine port
equals the container's; it now asks for ${port:8443}. Its controller password
was a setting (plaintext in the mesh DB); it is now an own-secret written into
the one mergeable file (ADR 0086). The username stays a setting.

The web UI is contributed as a route to the "web" endpoint over https with
insecure upstream (the controller's own self-signed tls), as mailu's web-tls —
what HAL's hand-written traefik file for unifi does today.

Image pinned to the manifest list ace runs (8.0.24-ls221); the old pin was its
amd64 child, so the image is unchanged.

Verified: catalogue tests pass with MESH_CATALOGUE set; a throwaway container
of the pinned image on a fresh 1000:1000/0700 data dir answers /status (8.0.24,
up) and /inform; the sidecar client built from a config.json carrying site,
password, username and an endpoints key reaches it and is refused only on the
dummy credentials.
2026-09-29 23:39:50 +02:00
+41 -21
View File
@@ -10,35 +10,35 @@
"port": 8443,
"protocol": "tcp",
"from": "mesh",
"why": "the controller web UI, over its own self-signed tls; reaching it from outside is a route grant later"
"why": "the controller web UI and API, over its own self-signed tls; named through the proxy as an https route"
},
{
"name": "inform",
"port": 8080,
"protocol": "tcp",
"from": "mesh",
"why": "device inform \u2014 how APs and switches check in and are adopted"
"why": "device inform, how APs and switches check in and are adopted; the controller tells devices this number, so the machine must publish it on the same one"
},
{
"name": "stun",
"port": 3478,
"protocol": "udp",
"from": "mesh",
"why": "STUN, so managed devices can find the controller through NAT"
"why": "STUN for managed devices; the controller tells devices this number, so the machine must publish it on the same one"
},
{
"name": "discovery",
"port": 10001,
"protocol": "udp",
"from": "mesh",
"why": "device discovery \u2014 the controller finds unadopted devices on the network"
"why": "device discovery broadcasts from unadopted devices and the UniFi apps"
},
{
"name": "discovery-l2",
"port": 1902,
"port": 1900,
"protocol": "udp",
"from": "mesh",
"why": "layer-2 (UBNT) discovery broadcasts; published on 1902, the container listens on 1900"
"why": "make-controller-discoverable-on-L2 (SSDP); the software listens on 1900, which machines commonly have taken by another SSDP speaker"
},
{
"name": "portal-tls",
@@ -76,10 +76,15 @@
"path": "/var/lib/mesh/unifi",
"mode": "0700"
},
{
"id": "state",
"type": "directory",
"mode": "0700",
"place": "."
},
{
"id": "data",
"type": "directory",
"path": "/services/unifi/data",
"mode": "0700",
"owner": "1000:1000"
},
@@ -87,17 +92,17 @@
"id": "server",
"type": "container",
"name": "unifi-controller",
"image": "lscr.io/linuxserver/unifi-controller@sha256:fcd5d8b13a77a588c79c1b49e5fc9ad08115aa3bb1a3576c589c64908a68845f",
"image": "lscr.io/linuxserver/unifi-controller@sha256:0ae315a3a45635e443899e30e86bd507c2c48922cb27f4bc7241777885f4650e",
"ports": [
"8443:8443",
"8080:8080",
"3478:3478/udp",
"10001:10001/udp",
"1902:1900/udp",
"8843:8843",
"8880:8880",
"6789:6789",
"5514:5514/udp"
"8443",
"8080",
"3478/udp",
"10001/udp",
"1900/udp",
"8843",
"8880",
"6789",
"5514/udp"
],
"env": {
"PUID": "1000",
@@ -107,7 +112,7 @@
"MEM_STARTUP": "1024"
},
"volumes": [
"/services/unifi/data:/config"
"${dir:data}:/config"
]
},
{
@@ -115,7 +120,7 @@
"type": "file",
"path": "/var/lib/mesh/unifi/config.json",
"mode": "0600",
"content": "{}\n",
"content": "{\n \"site\": \"default\",\n \"password\": \"${secret:controller}\"\n}\n",
"merge": "json"
},
{
@@ -129,7 +134,7 @@
],
"env": {
"MESH_BROKER_FILE": "/run/secrets/broker",
"MESH_UNIFI_URL": "https://127.0.0.1:8443",
"MESH_UNIFI_URL": "https://127.0.0.1:${port:8443}",
"MESH_UNIFI_CONFIG_FILE": "/run/config/config.json"
},
"restart-on": [
@@ -138,8 +143,23 @@
"artifact": "runtime"
}
],
"requires": [
"route"
],
"contributes": {
"route": {
"label": "unifi",
"endpoint": "web",
"scheme": "https",
"insecure": true
}
},
"binds": {
"route": "${dir:state}/route.json"
},
"own-secrets": {
"broker": "/var/lib/mesh/unifi/broker"
"broker": "/var/lib/mesh/unifi/broker",
"controller": "/var/lib/mesh/unifi/controller"
},
"build": {
"on": [