- Service templates now use WorkingDirectory for config loading - Config is read from .dbbackup.conf in /var/lib/dbbackup - Updated SYSTEMD.md documentation to match actual CLI - Removed non-existent --config flag from ExecStart
51 lines
1.2 KiB
Desktop File
51 lines
1.2 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
|
|
|
|
# Working directory (config is loaded from .dbbackup.conf here)
|
|
WorkingDirectory=/var/lib/dbbackup
|
|
|
|
# Execution - cluster backup (all databases)
|
|
ExecStart={{.BinaryPath}} backup cluster --backup-dir {{.BackupDir}}
|
|
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
|