diff --git a/modules/unifi/module.json b/modules/unifi/module.json index c6a3912..e508a64 100644 --- a/modules/unifi/module.json +++ b/modules/unifi/module.json @@ -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": [