Skip to content

v2.6.0: Proxy auto-start and sudo supervisor fixes

Choose a tag to compare

@jdx jdx released this 12 Apr 12:15
· 137 commits to main since this release
Immutable release. Only release title and notes can be modified.
56b07c5

Pitchfork v2.6.0 adds automatic daemon startup when visiting a proxy URL and fixes several issues with port conflict detection and running the supervisor under sudo.

Highlights

  • Proxy auto-start: Visiting a proxy URL for a stopped daemon now triggers an automatic start instead of returning a 502 error. The browser shows a "Starting..." page that auto-refreshes until the daemon is ready.
  • Reliable port conflict detection: Port availability checks now probe loopback addresses (127.0.0.1, ::1) in addition to 0.0.0.0, fixing false negatives on macOS/BSD where SO_REUSEADDR allowed binding wildcard addresses even when the port was occupied on localhost.

Added

  • Proxy auto-start -- When you visit a proxy URL for a daemon that isn't running, pitchfork now automatically starts it. Instead of a 502 error, the browser shows a "Starting..." page that refreshes every 2 seconds until the daemon is ready, then proxies normally. This is enabled by default and requires no extra configuration beyond the normal proxy setup. The timeout for the entire auto-start operation defaults to 30 seconds and is configurable. (#347) - @gaojunran

    [settings.proxy]
    auto_start = true              # default
    auto_start_timeout = "30s"     # default; increase for slow-starting daemons

Fixed

  • Port conflict detection on loopback addresses -- Port availability checks now probe 127.0.0.1 and ::1 in addition to 0.0.0.0. On macOS/BSD, Rust's TcpListener::bind sets SO_REUSEADDR by default, which allowed binding 0.0.0.0:port even when 127.0.0.1:port was already occupied. This caused pitchfork to report a port as available when it was actually in use, leading to daemons silently falling back to a different port. (#345) - @gaojunran

  • ready_port conflict detection -- When ready_port is configured without expected_port, pitchfork now checks whether the port is already in use before starting the daemon. Previously, if another process was listening on that port, the TCP readiness probe would immediately succeed and pitchfork would falsely consider the daemon ready, routing proxy traffic to the wrong process. (#350) - @gaojunran

  • Sudo supervisor issues -- Fixed multiple problems when running the supervisor with sudo (required for binding to ports 80/443 for the HTTPS proxy). The home directory is now resolved from SUDO_USER via the system password database when running as root, ensuring state files, IPC sockets, config paths, and logs remain consistent with non-sudo invocations. IPC socket chown and state directory permission fixes now only trigger when the effective UID is actually 0, preventing stale SUDO_UID/SUDO_GID environment variables from causing issues in non-sudo environments. Process kill operations now properly propagate permission errors with an actionable "Try rerun with sudo" message. (#323) - @gaojunran

Full Changelog: v2.5.0...v2.6.0