Mosquitto moves after all: a port that lives in a config file #12

Manually merged
mi merged 1 commits from mosquitto-port-file into main 2026-09-11 10:21:13 +02:00
Owner

0.9.0 listed mosquitto as the image werkdock cannot move, and that was
true of everything mosquitto offers: -p is ignored once a config file
declares a listener (the manual says so, and it was measured), no
environment variable names the port, and the config file expands none.
What mosquitto does read is the config file — and a config file is the
one thing werkdock can replace that a flag or a variable cannot reach.

A quirk can now name a PortFile: which file the image ships carries the
port and how the line reads. Werkdock copies that file into the instance
directory with the line rewritten to the chosen port and binds the copy
read-only over the image's original, which is never touched. Both of
mosquitto's listeners live in the same file, so the dashboard's HTTP API
on 9883 moves along with MQTT on 1883.

Measured with 2.1.2 through the API socket: two instances at once, each
on its own pair of ports, each accepting an anonymous client and
answering on its dashboard, 1883 left free.

The rewritten copy applies only while the command still names the file
and the client has not bound a file of their own over that path; either
way the copy would not be what the server reads, and the port is then
reported unmoved. An image whose file no longer has the expected line is
refused at create with the line named, not started on a port werkdock
only claimed.

Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

0.9.0 listed mosquitto as the image werkdock cannot move, and that was true of everything mosquitto offers: -p is ignored once a config file declares a listener (the manual says so, and it was measured), no environment variable names the port, and the config file expands none. What mosquitto does read is the config file — and a config file is the one thing werkdock can replace that a flag or a variable cannot reach. A quirk can now name a PortFile: which file the image ships carries the port and how the line reads. Werkdock copies that file into the instance directory with the line rewritten to the chosen port and binds the copy read-only over the image's original, which is never touched. Both of mosquitto's listeners live in the same file, so the dashboard's HTTP API on 9883 moves along with MQTT on 1883. Measured with 2.1.2 through the API socket: two instances at once, each on its own pair of ports, each accepting an anonymous client and answering on its dashboard, 1883 left free. The rewritten copy applies only while the command still names the file and the client has not bound a file of their own over that path; either way the copy would not be what the server reads, and the port is then reported unmoved. An image whose file no longer has the expected line is refused at create with the line named, not started on a port werkdock only claimed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mi added 1 commit 2026-09-11 10:21:08 +02:00
0.9.0 listed mosquitto as the image werkdock cannot move, and that was
true of everything mosquitto offers: -p is ignored once a config file
declares a listener (the manual says so, and it was measured), no
environment variable names the port, and the config file expands none.
What mosquitto does read is the config file — and a config file is the
one thing werkdock can replace that a flag or a variable cannot reach.

A quirk can now name a PortFile: which file the image ships carries the
port and how the line reads. Werkdock copies that file into the instance
directory with the line rewritten to the chosen port and binds the copy
read-only over the image's original, which is never touched. Both of
mosquitto's listeners live in the same file, so the dashboard's HTTP API
on 9883 moves along with MQTT on 1883.

Measured with 2.1.2 through the API socket: two instances at once, each
on its own pair of ports, each accepting an anonymous client and
answering on its dashboard, 1883 left free.

The rewritten copy applies only while the command still names the file
and the client has not bound a file of their own over that path; either
way the copy would not be what the server reads, and the port is then
reported unmoved. An image whose file no longer has the expected line is
refused at create with the line named, not started on a port werkdock
only claimed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mi manually merged commit 24b0a5d628 into main 2026-09-11 10:21:13 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mi/werkdock#12