Skip to content

Free ports 80/443 on magebox global stop (#108) - #143

Merged
jakwinkler merged 1 commit into
qoliber:mainfrom
Aquive:fix/global-stop-frees-web-ports
Sep 22, 2026
Merged

jakwinkler merged 1 commit into
qoliber:mainfrom
Aquive:fix/global-stop-frees-web-ports

Conversation

@Aquive

@Aquive Aquive commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #108.

magebox global stop stopped Nginx and the Docker services but left the port forwarding LaunchDaemon (com.magebox.portforward) loaded, so ports 80 and 443 stayed occupied and other local dev tools could not bind them.

Changes

  • global stop unloads the daemon and waits until port 80 is actually released.
  • global start loads it again (falls back to kickstart when launchd already knows the service).
  • global status shows the port forwarding state on macOS.
  • The plist stays installed, so forwarding comes back without running magebox bootstrap; a reboot restores it too.
  • macOS-only — on Linux all three are no-ops.

Tests cover the new waitFor poll helper, IsSupported, and the Linux no-op paths. make lint and make test pass. Not verified end-to-end on macOS (needs sudo/launchctl) — @LouisdeLooze could you check?

`global stop` stopped Nginx and Docker but left the port forwarding
LaunchDaemon loaded, so ports 80 and 443 stayed occupied. It now unloads
the daemon and waits until port 80 is released; `global start` loads it
again and `global status` reports the forwarding state on macOS.

The plist stays installed, so forwarding returns without a bootstrap.

Claude-Session: https://claude.ai/code/session_01Wr5Hs4AEodX65PAKimjZ58
@Aquive
Aquive force-pushed the fix/global-stop-frees-web-ports branch from f5026bc to b7784a6 Compare September 1, 2026 11:00
@jakwinkler jakwinkler self-assigned this Sep 22, 2026
@jakwinkler
jakwinkler merged commit f2f207c into qoliber:main Sep 22, 2026
10 checks passed
@jakwinkler jakwinkler mentioned this pull request Sep 22, 2026
jakwinkler added a commit that referenced this pull request Sep 22, 2026
Follow-up to #143, which freed ports 80/443 on `magebox global stop`.

`Start` had its own daemon-starting path that skipped the plist version
check, so it could load an outdated daemon; it now delegates to
`EnsureRulesActive`, the single reconciler that installs, upgrades and
kickstarts.

`Stop` reported failure whenever port 80 was still busy after the daemon
was unloaded, even though an unrelated local service is free to take the
port — which is the whole point of releasing it. `stopVerdict` now fails
only while MageBox's own daemon is still loaded. `Stop` also returns
early when nothing is listening, so an already-stopped environment no
longer prompts for a sudo password, and the unload path wires stdin and
stderr so that prompt and any launchctl error are visible.

Docs: document the sudo requirement in the command reference, correct the
FAQ claim that no daily operation needs sudo, and note the macOS step in
the testing matrix.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

magebox global stop does not free web ports on macOS

2 participants