-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Is your feature request related to a problem? Please describe.
First off, thank you for the awesome work on Capture, it’s a great project and really easy to use. One area I’ve run into some difficulty is managing Capture as a background service on Linux. Right now, users need to create their own systemd service file, and it’s easy to get details wrong (ExecStart paths, backgrounding, environment variables, or logging). This can make setup less smooth for newcomers.
Describe the solution you'd like
It would be really helpful if Capture shipped with an official systemd service unit file (for example, in the repo under contrib/ or as part of a package).
The service could:
- Run the binary directly from /usr/local/bin/capture (or /usr/bin/capture if packaged).
- Use WorkingDirectory=/opt/capture for configs and state.
- Reference /etc/capture.env for environment variables like API_SECRET, PORT, and GIN_MODE.
- Handle logging (via journald or /var/log/capture.log).
- Include restart policies and optional hardening directives (NoNewPrivileges, ProtectSystem, etc.).
With such a file, users could get Capture running persistently with: sudo systemctl enable --now capture
Describe alternatives you've considered
- Writing my own systemd unit from scratch (works, but easy to misconfigure).
- Using wrapper scripts (functional, but unnecessary if systemd manages the binary directly).
- Relying only on documentation snippets (helpful, but less user-friendly than having a tested, official file).
Additional context
Many monitoring agents (like Prometheus node_exporter and Telegraf) include official systemd service files. Having one for Capture would be a nice quality-of-life improvement and help new users get started quickly.
This is working for me:
[Unit]
Description=Checkmate Capture Client
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=/opt/capture
ExecStart=/opt/capture/capture
# REQUIRED: set your real secret here
Environment=API_SECRET=REPLACE_ME
# Optional tunables
Environment=PORT=59232
Environment=GIN_MODE=release
# Log to file (optional)
StandardOutput=append:/var/log/capture.log
StandardError=append:/var/log/capture.log
# Auto-restart on crashes
Restart=on-failure
RestartSec=2s
# Run as root unless you’ve set up caps/ports otherwise
User=root
[Install]
WantedBy=multi-user.target
then:
sudo touch /var/log/capture.log
sudo chmod 644 /var/log/capture.log
sudo systemctl daemon-reload
sudo systemctl reset-failed capture
sudo systemctl enable --now capture
sudo systemctl status capture
Also suggest setting up log rotation for this.