#2 feat: add systemd config file

Closed
opened 9 months ago by fszontagh · 2 comments
  • add a systemd config file to allow to run the project as service
  • keep attention to allow to run the project as unprivileged user (for example local UNIX user claude)
  • enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)
- add a systemd config file to allow to run the project as service - keep attention to allow to run the project as unprivileged user (for example local UNIX user claude) - enhanche the logging to allow to systemd to handle the logging output (for example journalctl -u agent-manager -f -n100)
Claude Coding Agent commented 9 months ago
Collaborator

Starting work on this issue. I'll implement:

  1. ✅ Systemd service file configured for unprivileged user (claude)
  2. ✅ Enhanced logging system that detects systemd environment
  3. ✅ Documentation for installation and usage

Working on it now...

Starting work on this issue. I'll implement: 1. ✅ Systemd service file configured for unprivileged user (claude) 2. ✅ Enhanced logging system that detects systemd environment 3. ✅ Documentation for installation and usage Working on it now...
Claude Coding Agent commented 9 months ago
Collaborator

Implementation completed and pushed! Here's what was done:

Changes

1. Systemd Service File (agent-manager.service)

  • Configured to run as unprivileged user claude
  • Includes security hardening: NoNewPrivileges, PrivateTmp, ProtectSystem=strict
  • Automatic restart on failure with 10-second delay
  • Logs to journalctl via StandardOutput/StandardError

2. Enhanced Logger (src/logger.js:6-14)

  • Auto-detects systemd environment via JOURNAL_STREAM and INVOCATION_ID env vars
  • Automatically disables colors and timestamps when running under systemd
  • journalctl already provides timestamps and doesn't render ANSI colors well
  • Still supports colored output with timestamps for regular console usage

3. Comprehensive Documentation (SYSTEMD.md)

  • Complete installation guide
  • Service management commands
  • Logging examples with journalctl
  • Troubleshooting section
  • Security features explanation
  • Advanced configuration options

4. Updated README

  • Added systemd service section with quick start
  • Links to detailed SYSTEMD.md documentation

Testing

Tested and verified:

  • Project starts and runs correctly
  • Logger auto-detection works (tested with JOURNAL_STREAM=test env var)
  • Output is clean without colors/timestamps in systemd mode
  • All changes committed and pushed

Usage

# Install the service
sudo cp agent-manager.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable agent-manager
sudo systemctl start agent-manager

# View logs
journalctl -u agent-manager -f -n100

Ready for review!

Implementation completed and pushed! Here's what was done: ## Changes ### 1. Systemd Service File (`agent-manager.service`) - Configured to run as unprivileged user `claude` - Includes security hardening: `NoNewPrivileges`, `PrivateTmp`, `ProtectSystem=strict` - Automatic restart on failure with 10-second delay - Logs to journalctl via StandardOutput/StandardError ### 2. Enhanced Logger (src/logger.js:6-14) - Auto-detects systemd environment via `JOURNAL_STREAM` and `INVOCATION_ID` env vars - Automatically disables colors and timestamps when running under systemd - journalctl already provides timestamps and doesn't render ANSI colors well - Still supports colored output with timestamps for regular console usage ### 3. Comprehensive Documentation (`SYSTEMD.md`) - Complete installation guide - Service management commands - Logging examples with journalctl - Troubleshooting section - Security features explanation - Advanced configuration options ### 4. Updated README - Added systemd service section with quick start - Links to detailed SYSTEMD.md documentation ## Testing Tested and verified: - Project starts and runs correctly - Logger auto-detection works (tested with `JOURNAL_STREAM=test` env var) - Output is clean without colors/timestamps in systemd mode - All changes committed and pushed ## Usage ```bash # Install the service sudo cp agent-manager.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable agent-manager sudo systemctl start agent-manager # View logs journalctl -u agent-manager -f -n100 ``` Ready for review!
Sign in to join this conversation.
No Milestone
2 Participants
Loading...
Cancel
Save
There is no content yet.