Some checks failed
CI/CD / Test (push) Successful in 2m42s
CI/CD / Lint (push) Successful in 2m50s
CI/CD / Build (amd64, darwin) (push) Successful in 2m0s
CI/CD / Build (amd64, linux) (push) Successful in 1m58s
CI/CD / Build (arm64, darwin) (push) Successful in 2m1s
CI/CD / Build (arm64, linux) (push) Has been cancelled
Systemd Integration: - New 'dbbackup install' command creates service/timer units - Supports single-database and cluster backup modes - Automatic dbbackup user/group creation with proper permissions - Hardened service units with security features - Template units with configurable OnCalendar schedules - 'dbbackup uninstall' for clean removal Prometheus Metrics: - 'dbbackup metrics export' for textfile collector format - 'dbbackup metrics serve' runs HTTP exporter on port 9399 - Metrics: last_success_timestamp, rpo_seconds, backup_total, etc. - Integration with node_exporter textfile collector - --with-metrics flag during install Technical: - Systemd templates embedded with //go:embed - Service units include ReadWritePaths, OOMScoreAdjust - Metrics exporter caches with 30s TTL - Graceful shutdown on SIGTERM
48 lines
1.1 KiB
Desktop File
48 lines
1.1 KiB
Desktop File
[Unit]
|
|
Description=Database Cluster Backup
|
|
Documentation=https://github.com/PlusOne/dbbackup
|
|
After=network-online.target postgresql.service mysql.service mariadb.service
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User={{.User}}
|
|
Group={{.Group}}
|
|
|
|
# Security hardening
|
|
NoNewPrivileges=yes
|
|
ProtectSystem=strict
|
|
ProtectHome=read-only
|
|
PrivateTmp=yes
|
|
ProtectKernelTunables=yes
|
|
ProtectKernelModules=yes
|
|
ProtectControlGroups=yes
|
|
RestrictSUIDSGID=yes
|
|
RestrictRealtime=yes
|
|
LockPersonality=yes
|
|
RemoveIPC=yes
|
|
CapabilityBoundingSet=
|
|
AmbientCapabilities=
|
|
|
|
# Directories
|
|
ReadWritePaths={{.BackupDir}} /var/lib/dbbackup /var/log/dbbackup
|
|
|
|
# Network access for cloud uploads
|
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
|
|
|
# Environment
|
|
EnvironmentFile=-/etc/dbbackup/env.d/cluster.conf
|
|
|
|
# Execution - cluster backup (all databases)
|
|
ExecStart={{.BinaryPath}} backup cluster --config {{.ConfigPath}}
|
|
TimeoutStartSec={{.TimeoutSeconds}}
|
|
|
|
# Post-backup metrics export
|
|
ExecStopPost=-{{.BinaryPath}} metrics export --instance cluster --output /var/lib/dbbackup/metrics/cluster.prom
|
|
|
|
# OOM protection for large backups
|
|
OOMScoreAdjust=-500
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|