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:
Ole-Morten Duesund 2025-08-03 23:59:34 +02:00
commit e6ab28bc9e
12 changed files with 267 additions and 128 deletions

View file

@ -135,4 +135,95 @@ versions: build
@./rust/target/release/mail2couch-rs --version
# Clean and rebuild everything
rebuild: clean build
rebuild: clean build
# Systemd service management
# Install systemd user service files
install-services:
@echo "Installing systemd user service files..."
mkdir -p ~/.config/systemd/user
cp systemd/*.service ~/.config/systemd/user/
cp systemd/*.timer ~/.config/systemd/user/
systemctl --user daemon-reload
@echo "✅ Installed systemd user services and timers"
@echo "💡 Enable with: systemctl --user enable mail2couch-{go,rs}.service"
@echo "💡 Enable timers with: systemctl --user enable mail2couch-{go,rs}.timer"
# Uninstall systemd user service files
uninstall-services:
@echo "Uninstalling systemd user service files..."
systemctl --user stop mail2couch-go.service mail2couch-rs.service || true
systemctl --user stop mail2couch-go.timer mail2couch-rs.timer || true
systemctl --user stop mail2couch-go-hourly.timer mail2couch-rs-hourly.timer || true
systemctl --user stop mail2couch-go-daily.timer mail2couch-rs-daily.timer || true
systemctl --user disable mail2couch-go.service mail2couch-rs.service || true
systemctl --user disable mail2couch-go.timer mail2couch-rs.timer || true
systemctl --user disable mail2couch-go-hourly.timer mail2couch-rs-hourly.timer || true
systemctl --user disable mail2couch-go-daily.timer mail2couch-rs-daily.timer || true
rm -f ~/.config/systemd/user/mail2couch-*.service
rm -f ~/.config/systemd/user/mail2couch-*.timer
systemctl --user daemon-reload
@echo "✅ Uninstalled systemd user services and timers"
# Show systemd service status
service-status:
@echo "Service status:"
systemctl --user status mail2couch-go.service || true
systemctl --user status mail2couch-rs.service || true
@echo ""
@echo "Timer status:"
systemctl --user list-timers mail2couch-*
# Enable Go implementation with default 30-minute timer
enable-go:
systemctl --user enable mail2couch-go.service
systemctl --user enable mail2couch-go.timer
systemctl --user start mail2couch-go.timer
@echo "✅ Enabled Go implementation with 30-minute timer"
# Enable Rust implementation with default 30-minute timer
enable-rust:
systemctl --user enable mail2couch-rs.service
systemctl --user enable mail2couch-rs.timer
systemctl --user start mail2couch-rs.timer
@echo "✅ Enabled Rust implementation with 30-minute timer"
# Enable Go implementation with hourly timer
enable-go-hourly:
systemctl --user enable mail2couch-go.service
systemctl --user enable mail2couch-go-hourly.timer
systemctl --user start mail2couch-go-hourly.timer
@echo "✅ Enabled Go implementation with hourly timer"
# Enable Rust implementation with hourly timer
enable-rust-hourly:
systemctl --user enable mail2couch-rs.service
systemctl --user enable mail2couch-rs-hourly.timer
systemctl --user start mail2couch-rs-hourly.timer
@echo "✅ Enabled Rust implementation with hourly timer"
# Enable Go implementation with daily timer
enable-go-daily:
systemctl --user enable mail2couch-go.service
systemctl --user enable mail2couch-go-daily.timer
systemctl --user start mail2couch-go-daily.timer
@echo "✅ Enabled Go implementation with daily timer"
# Enable Rust implementation with daily timer
enable-rust-daily:
systemctl --user enable mail2couch-rs.service
systemctl --user enable mail2couch-rs-daily.timer
systemctl --user start mail2couch-rs-daily.timer
@echo "✅ Enabled Rust implementation with daily timer"
# Disable all timers and services
disable-all:
systemctl --user stop mail2couch-go.timer mail2couch-rs.timer || true
systemctl --user stop mail2couch-go-hourly.timer mail2couch-rs-hourly.timer || true
systemctl --user stop mail2couch-go-daily.timer mail2couch-rs-daily.timer || true
systemctl --user disable mail2couch-go.timer mail2couch-rs.timer || true
systemctl --user disable mail2couch-go-hourly.timer mail2couch-rs-hourly.timer || true
systemctl --user disable mail2couch-go-daily.timer mail2couch-rs-daily.timer || true
systemctl --user disable mail2couch-go.service mail2couch-rs.service || true
@echo "✅ Disabled all timers and services"