Lightweight, self‑contained daemon that polls one or many Git repositories and automatically pulls, builds and/or restarts your service whenever the remote branch receives a new commit.
- 📦 Multiple repositories in a single process – add as many [[repos]] blocks as you like
- ⏰ Configurable poll interval per repo (seconds or minutes)
- 🏃♂️ Fast fast‑forward updates using system git commands
- 🪝 Post‑update hook – run any shell command (build, test, systemctl restart …, Docker compose, …)
- 🪶 Tiny footprint: a few MB RAM, near‑zero CPU while idle
- 📥 Installs with one cargo install or a pre‑built static binary
- 🔧 Plays nicely with systemd, journald and container orchestrators
- 🦀 Written in safe Rust 2021, no external runtime
# 1 - Install cargo
apt install cargo# 1 – Grab the code & build a release binary
cargo install --git https://github.com/headStyleColorRed/Rustpdater --locked
# 2 – Create the config file somewhere like /etc/rustpdater.toml (example file below)
vim /etc/rustpdater.toml
# 3 – Run once to verify (stdout shows info logs; errors go to stderr)
# The binary will be installed to ~/.cargo/bin
RUST_LOG=info ~/.cargo/bin/rustpdater --config-file /etc/rustpdater.toml
# 4 – Run the daemon using systemd
# Check the [Running under systemd] section belowAdd a systemd unit to keep it running after reboots (see below).
# rustpdater.toml
[[repos]]
path = "/srv/app_1" # absolute path to an existing clone
branch = "main" # optional (default "master")
interval = 30 # seconds (default 60)
on_change = "cargo run --release"
[[repos]]
path = "/srv/app_2"
branch = "master"
interval = 300 # 5 min
on_change = "systemctl restart app_2.service"| Field | Type | Default | Description |
|---|---|---|---|
path |
Path | required | Local checkout; must already exist & have the remote set |
branch |
String | "master" | Branch ref to watch |
interval |
u64 seconds | 60 | Poll period |
on_change |
String | (none) | Shell snippet executed after a successful fast‑forward |
Note: The command runs with
$PWDset to path via/bin/sh -c "<cmd>".
Create /etc/systemd/system/rustpdater.service:
[Unit]
Description=Rustpdater – Git auto‑updater
After=network.target
[Service]
ExecStart=/usr/local/bin/rustpdater --config-file /etc/rustpdater.toml
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetReload systemd, start the service and watch the logs:
sudo systemctl daemon-reload
sudo systemctl enable --now rustpdater
journalctl -u rustpdater -f📝 stdout shows normal activity; errors go to stderr and are marked red in journalctl.
- 🔑 Private repos – configure SSH deploy keys (the daemon inherits your shell's git and SSH configuration)
| Symptom | Hint |
|---|---|
| watcher error on …: authentication failed | Check SSH keys / OAuth token, test git fetch manually |
| Repo never updates | Confirm interval isn't huge, verify branch name matches remote |
| Local changes overwritten | The watcher forces checkout; deploy from a clean clone, not your dev copy |
🐛 Enable
RUST_LOG=infofor verbose output (integrated via env_logger)
- Adding tests
- 📬 Send notifications when a repo is updated
- 🌐 Webhook mode (listen on HTTP instead of polling)
- 🔄 Back‑pressure / concurrency limit for heavy build hooks
Licensed under MIT
© 2025 TangerineCoding. See LICENSE for details.