Conversation
Add --system flag to daemon install command to distinguish between user and
system service installations. This enables running the daemon without root
privileges as a user service, or installing as a privileged system daemon.
Key changes:
• Add --system flag to daemon_install options
• Root privilege enforcement for system service installations on both platforms
• Linux (systemd):
- User services: ~/.config/systemd/user/ with user socket directory creation
- System services: /etc/systemd/system/ (requires root)
- Use --user flag for systemctl commands for user services
- Socket uses %t specifier for runtime directory (resolves to /run or \$XDG_RUNTIME_DIR)
• macOS (launchd):
- User services: ~/Library/LaunchAgents with user-specific directories
- System services: /Library/LaunchDaemons (requires root)
- Use launchctl bootstrap system vs bootstrap gui/{userID}
- Log and socket paths respect UserInfo methods (ConstructStateDir, ConstructRuntimeDir)
• Update service templates with dynamic log and socket paths
• Update createOrUpdateContext to use correct socket paths based on service type
User services use standard XDG and macOS directories via UserInfo methods,
while system services use system-level paths. The daemon maintains the same
functionality with proper privilege separation.
Co-authored-by: construct-agent <noreply@construct.sh>
WalkthroughThe pull request refactors daemon installation and error handling mechanisms. It removes the 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Free 📒 Files selected for processing (16)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Issues attributed to commits in this pull requestThis pull request was merged and Sentry observed the following issues: |
Overview
Introduces systemd daemon service support for Linux and macOS with improved installation, configuration, and error handling.
Key Changes
Daemon Service Management
• Support for both user and system daemon services on Linux and macOS
• Refactored systemd unit files (socket and service units) for improved modularity
• Enhanced daemon_install command with better service configuration
System-specific Improvements
• Linux: Updated socket and service unit files with standardized naming
• macOS: Refactored LaunchAgent configuration (http.xml, unix.xml)
• Corrected ExecStart paths and unit path references
CLI & Output
• Silenced command usage output for cleaner error reporting
• Improved error handling in fail/error.go with better context
• Enhanced terminal session messaging