Conversation
Enables listening on Unix domain sockets via `socket => $path` option, supporting nginx reverse proxy (`proxy_pass http://unix:/tmp/pagi.sock`) and benchmark scenarios (TechEmpower). - Parse `socket` option in _init, validate mutual exclusivity with host/port - Listen on Unix socket in _listen_singleworker via IO::Async addr family - Clean up socket file on shutdown, remove stale sockets on startup - Add socket_path accessor Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Create Unix listen socket in parent, workers inherit it via fork - Reuseport is N/A for Unix sockets (workers share parent socket) - Clean up socket file in _initiate_multiworker_shutdown - Guard reuseport and bound_port logic for socket mode - Pass socket config to worker server instances Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add --socket to Runner._parse_server_options, suppress host/port when set - Document socket option in Server.pm configuration section - Add UNIX DOMAIN SOCKET SUPPORT (EXPERIMENTAL) POD section - Document socket_path accessor - Add --socket to bin/pagi-server POD Co-Authored-By: Claude Opus 4.6 <[email protected]>
Allow setting file permissions on Unix domain sockets via the socket_mode constructor option (numeric, e.g., 0660) or --socket-mode CLI flag (octal string). chmod is applied after socket creation in both single-worker and multi-worker modes. Silently ignored when socket is not set. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
socket => $pathoption to PAGI::Server for listening on Unix domain sockets instead of TCP, enabling nginx reverse proxy (proxy_pass http://unix:/tmp/pagi.sock) and benchmark (TechEmpower) setups--socket PATHCLI option to pagi-server, with full POD documentation including an experimental feature sectionsocket_mode => $octaloption to set file permissions on the socket after creation (e.g.,0660), useful when the reverse proxy runs as a different user; includes--socket-mode MODECLI flagCloses #26. Supersedes #31 (re-implemented cleanly on current main).
Test plan
prove -l t/43-unix-socket.t— 12 subtests covering option parsing, mutual exclusivity validation, single-worker request/response, multi-worker request/response, socket cleanup, stale socket removal, socket_mode permissions (0660, 0666), default permissions, multi-worker with socket_mode, and socket_mode without socketprove -l t/— full test suite passes (no regressions)pagi-server --socket /tmp/pagi.sock --socket-mode 0660 ./examples/01-hello-http/app.pl+curl --unix-socket /tmp/pagi.sock http://localhost/🤖 Generated with Claude Code