feat: add systemd user services and timer units
- Create systemd user service files for both Go and Rust implementations - Add comprehensive timer configurations: 30-minute, hourly, and daily schedules - Include security settings, resource limits, and proper service dependencies - Add justfile recipes for service management (install, enable, disable, status) - Remove deprecated Makefile in favor of just-based build system - Fix Rust compilation warnings in imap.rs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
cf41a8c1c5
commit
e6ab28bc9e
12 changed files with 267 additions and 128 deletions
17
systemd/mail2couch-go-daily.timer
Normal file
17
systemd/mail2couch-go-daily.timer
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Run mail2couch Go Implementation daily
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
Requires=mail2couch-go.service
|
||||
|
||||
[Timer]
|
||||
# Run daily at 2:30 AM with some randomization
|
||||
OnCalendar=*-*-* 02:30:00
|
||||
# Run 10 minutes after boot if we missed a scheduled run
|
||||
OnBootSec=10min
|
||||
# If the system was off, run shortly after startup
|
||||
Persistent=true
|
||||
# Add up to 30 minutes randomization to spread load
|
||||
RandomizedDelaySec=1800
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
17
systemd/mail2couch-go-hourly.timer
Normal file
17
systemd/mail2couch-go-hourly.timer
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Run mail2couch Go Implementation every hour
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
Requires=mail2couch-go.service
|
||||
|
||||
[Timer]
|
||||
# Run every hour at a random minute to spread load
|
||||
OnCalendar=hourly
|
||||
# Run 5 minutes after boot if we missed a scheduled run
|
||||
OnBootSec=5min
|
||||
# If the system was off, run shortly after startup
|
||||
Persistent=true
|
||||
# Add randomization to avoid all users hitting servers simultaneously
|
||||
RandomizedDelaySec=600
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
35
systemd/mail2couch-go.service
Normal file
35
systemd/mail2couch-go.service
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[Unit]
|
||||
Description=mail2couch Go Implementation - Email backup to CouchDB
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=%i
|
||||
ExecStart=%h/bin/mail2couch-go
|
||||
WorkingDirectory=%h/.config/mail2couch
|
||||
|
||||
# Environment
|
||||
Environment=PATH=%h/bin:/usr/local/bin:/usr/bin:/bin
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=mail2couch-go
|
||||
|
||||
# Security settings
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=read-only
|
||||
ReadOnlyPaths=/
|
||||
ReadWritePaths=%h/.config/mail2couch %h/.local/share/mail2couch
|
||||
|
||||
# Resource limits
|
||||
MemoryHigh=512M
|
||||
MemoryMax=1G
|
||||
CPUQuota=50%
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
17
systemd/mail2couch-go.timer
Normal file
17
systemd/mail2couch-go.timer
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Run mail2couch Go Implementation every 30 minutes
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
Requires=mail2couch-go.service
|
||||
|
||||
[Timer]
|
||||
# Run every 30 minutes
|
||||
OnCalendar=*:0/30
|
||||
# Run 2 minutes after boot if we missed a scheduled run
|
||||
OnBootSec=2min
|
||||
# If the system was off, run shortly after startup
|
||||
Persistent=true
|
||||
# Add some randomization to avoid all users hitting servers simultaneously
|
||||
RandomizedDelaySec=300
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
17
systemd/mail2couch-rs-daily.timer
Normal file
17
systemd/mail2couch-rs-daily.timer
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Run mail2couch Rust Implementation daily
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
Requires=mail2couch-rs.service
|
||||
|
||||
[Timer]
|
||||
# Run daily at 2:30 AM with some randomization
|
||||
OnCalendar=*-*-* 02:30:00
|
||||
# Run 10 minutes after boot if we missed a scheduled run
|
||||
OnBootSec=10min
|
||||
# If the system was off, run shortly after startup
|
||||
Persistent=true
|
||||
# Add up to 30 minutes randomization to spread load
|
||||
RandomizedDelaySec=1800
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
17
systemd/mail2couch-rs-hourly.timer
Normal file
17
systemd/mail2couch-rs-hourly.timer
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Run mail2couch Rust Implementation every hour
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
Requires=mail2couch-rs.service
|
||||
|
||||
[Timer]
|
||||
# Run every hour at a random minute to spread load
|
||||
OnCalendar=hourly
|
||||
# Run 5 minutes after boot if we missed a scheduled run
|
||||
OnBootSec=5min
|
||||
# If the system was off, run shortly after startup
|
||||
Persistent=true
|
||||
# Add randomization to avoid all users hitting servers simultaneously
|
||||
RandomizedDelaySec=600
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
36
systemd/mail2couch-rs.service
Normal file
36
systemd/mail2couch-rs.service
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[Unit]
|
||||
Description=mail2couch Rust Implementation - Email backup to CouchDB
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=%i
|
||||
ExecStart=%h/bin/mail2couch-rs
|
||||
WorkingDirectory=%h/.config/mail2couch
|
||||
|
||||
# Environment
|
||||
Environment=PATH=%h/bin:/usr/local/bin:/usr/bin:/bin
|
||||
Environment=RUST_LOG=info
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=mail2couch-rs
|
||||
|
||||
# Security settings
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=read-only
|
||||
ReadOnlyPaths=/
|
||||
ReadWritePaths=%h/.config/mail2couch %h/.local/share/mail2couch
|
||||
|
||||
# Resource limits
|
||||
MemoryHigh=512M
|
||||
MemoryMax=1G
|
||||
CPUQuota=50%
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
17
systemd/mail2couch-rs.timer
Normal file
17
systemd/mail2couch-rs.timer
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Run mail2couch Rust Implementation every 30 minutes
|
||||
Documentation=https://kode.naiv.no/olemd/mail2couch
|
||||
Requires=mail2couch-rs.service
|
||||
|
||||
[Timer]
|
||||
# Run every 30 minutes
|
||||
OnCalendar=*:0/30
|
||||
# Run 2 minutes after boot if we missed a scheduled run
|
||||
OnBootSec=2min
|
||||
# If the system was off, run shortly after startup
|
||||
Persistent=true
|
||||
# Add some randomization to avoid all users hitting servers simultaneously
|
||||
RandomizedDelaySec=300
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue