From d515cc626e4185e1cf7626778b288e25c345a277 Mon Sep 17 00:00:00 2001 From: Adeel Ahmad Date: Tue, 6 Oct 2026 10:18:39 +0000 Subject: [PATCH] fix(docker): publish the dev sensor ports on this machine only Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01W42z4FbekWr33b6791svQQ --- docker-compose.yml | 7 ++++--- docs/sensors.md | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e56c5dc31..acc1777f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -79,10 +79,11 @@ services: command: lens worker # the sensor hub (docs/sensors.md): MQTT and syslog, listened on only once sensors are turned on in the app. # Something else on this machine using 1883 or 5514? Set LENS_MQTT_PORT / LENS_SYSLOG_PORT to other ports. + # Only this machine reaches them while developing; LENS_SENSOR_BIND=0.0.0.0 lets devices on the network in. ports: - - "${LENS_MQTT_PORT:-1883}:1883" - - "${LENS_SYSLOG_PORT:-5514}:5514/udp" - - "${LENS_SYSLOG_PORT:-5514}:5514/tcp" + - "${LENS_SENSOR_BIND:-127.0.0.1}:${LENS_MQTT_PORT:-1883}:1883" + - "${LENS_SENSOR_BIND:-127.0.0.1}:${LENS_SYSLOG_PORT:-5514}:5514/udp" + - "${LENS_SENSOR_BIND:-127.0.0.1}:${LENS_SYSLOG_PORT:-5514}:5514/tcp" healthcheck: disable: true diff --git a/docs/sensors.md b/docs/sensors.md index 7f5c23e5f..716e7ab75 100644 --- a/docs/sensors.md +++ b/docs/sensors.md @@ -40,7 +40,9 @@ on its own, waiting longer each time up to five minutes. Change its connection w pause it to disconnect. One process runs each bridge. In Docker, the hub runs in the `worker` container, which publishes 1883 and 5514; set `LENS_MQTT_PORT` or -`LENS_SYSLOG_PORT` when something else on the machine has those ports. Run natively, it runs in `lens worker` (and in +`LENS_SYSLOG_PORT` when something else on the machine has those ports. The development compose file +(`docker-compose.yml`) publishes them on this machine only; set `LENS_SENSOR_BIND=0.0.0.0` to let devices on the +network reach them. Run natively, it runs in `lens worker` (and in the API when it runs background work). Several processes can run it: the first to get the port serves it, and the others try again every minute.