Pull-based GitOps-style Docker Compose deployer: polls a (private) Git repo, detects changed stacks and reconciles only the affected

feat: add systemd example for automatic exec

Signed-off-by: A. Ottr <alex@otter.foo>

+67
+38
README.md
··· 83 83 ./compose-sync -config /path/to/config.yml 84 84 ``` 85 85 86 + ### Systemd Service and Timer (Automatic Execution) 87 + 88 + To run compose-sync automatically using systemd: 89 + 90 + 1. **Install the binary** (if not already installed): 91 + ```bash 92 + sudo cp compose-sync /usr/local/bin/ 93 + ``` 94 + 95 + 2. **Edit the service file** (`compose-sync.service`): 96 + - Replace `youruser` with the actual user that should run compose-sync (make sure this user has the correct permissions) 97 + - Adjust paths if needed (binary location, config file, etc.) 98 + 99 + 3. **Copy the service and timer files**: 100 + ```bash 101 + sudo cp compose-sync.service compose-sync.timer /etc/systemd/system/ 102 + ``` 103 + 104 + 4. **Reload systemd and enable the timer**: 105 + ```bash 106 + sudo systemctl daemon-reload 107 + sudo systemctl enable compose-sync.timer 108 + sudo systemctl start compose-sync.timer 109 + ``` 110 + 111 + 5. **Check status**: 112 + ```bash 113 + sudo systemctl status compose-sync.timer 114 + sudo systemctl status compose-sync.service 115 + ``` 116 + 117 + 6. **View logs**: 118 + ```bash 119 + sudo journalctl -u compose-sync.service -f 120 + ``` 121 + 122 + The timer will run compose-sync every 5 minutes. To change the interval, edit `compose-sync.timer` and modify the `OnUnitActiveSec` value. 123 + 86 124 ## How It Works 87 125 88 126 1. **Host Detection**: The tool uses the system hostname to identify the current host
+17
systemd/compose-sync.service
··· 1 + [Unit] 2 + Description=compose-sync - Sync and deploy Docker Compose stacks from git 3 + After=network-online.target docker.service 4 + Wants=network-online.target 5 + 6 + [Service] 7 + Type=oneshot 8 + # Replace 'youruser' with the actual user that should run compose-sync 9 + User=youruser 10 + # Path to compose-sync binary (adjust if installed elsewhere) 11 + # If config.yml is not in the default location, add: -config /path/to/config.yml 12 + ExecStart=/usr/local/bin/compose-sync 13 + Environment="HOME=/home/youruser" 14 + WorkingDirectory=/home/youruser 15 + StandardOutput=journal 16 + StandardError=journal 17 +
+12
systemd/compose-sync.timer
··· 1 + [Unit] 2 + Description=Run compose-sync every 5 minutes 3 + Requires=compose-sync.service 4 + 5 + [Timer] 6 + OnBootSec=5min 7 + OnUnitActiveSec=5min 8 + AccuracySec=1min 9 + 10 + [Install] 11 + WantedBy=timers.target 12 +