git-supervisor: central controller to manage git repos deployments on remote hosts
Pre-built git-supervisor binaries are published on GitHub Releases for:
- Linux (x86_64):
git-supervisor-x86_64-unknown-linux-gnu-<tag>.tar.gz - macOS (Apple Silicon):
git-supervisor-aarch64-apple-darwin-<tag>.tar.gz
macOS: If the binary is blocked or you see a security warning, clear extended attributes once after download:
xattr -c git-supervisorRun git-supervisor cli to watch status of repos on multiple hosts
- Specify the command as
/git-supervisor watch ...for docker-run - Additional args can be appended in above line
- To prepare the proper defined deployments.yaml for the target repos
Webhook serving is now part of watch command, to enable it by:
Use watch with --webhook-port and a secret (--webhook-secret or GITHUB_WEBHOOK_SECRET).
# Watch loop + webhook server on :9870
/git-supervisor watch --webhook-port 9870 --webhook-secret MY_SECRET
# Secret from env var
GITHUB_WEBHOOK_SECRET=MY_SECRET /git-supervisor watch --webhook-port 8080If --webhook-port is set without a secret, the command exits with an argument error.
When watch cannot find a config file (--config, ~/.config/git-supervisor/deployments.yaml,
or ./deployments.yaml), it automatically falls back to local mode:
- Runs embedded
check-push.shlocally (no SSH) - Reuses
watchflags:--intervaland--timeout --interval 0means run once and exit- Inherits
check-push.shenv vars from current process (for exampleDIR_BASE,BR_WHITELIST,LOGLEVEL) - If
REPO_WHITELISTis exported but empty, it is treated as unset
# Local one-shot run (no config file present)
/git-supervisor watch --interval 0
# Local loop every 60s, stop after 10 minutes
/git-supervisor watch --interval 60 --timeout 600- Sample settings in docker-compose.yml in the code tree.
- Volume to store all the data: git_repos, (code)copies, scripts.
- Volumn to store the ssh keys to access github.com repos.
- Must set SLEEP_TIME env for docker-run, to specify the timeout values(seconds)
- Specify the command as
/srcripts/check-push.shfor docker-run - If no SLEEP_TIME env, the script will be run as one-shot checking.
- ENV BR_WHITELIST: Space-separated branch names to track and copy by default (e.g.
main master dev). Override via env; default in script:main master dev test alpha. Whitelisted branches get their copy dir created and populated on first run; other branches are only tracked if a copy dir already exists (and then start with a.skippingflag until you remove it).
When a copy path has a docker restart config file (*.docker), check-push.sh can run optional hook jobs around restart:
- Pre hook:
*.docker.preruns beforedocker restart - Post hook:
*.docker.postruns after a successfuldocker restart
Examples:
- Branch copy:
/work/copies/webapp.main.docker+ optional/work/copies/webapp.main.docker.pre//work/copies/webapp.main.docker.post - Latest release copy:
/work/copies/webapp.prod.docker+ optional/work/copies/webapp.prod.docker.pre//work/copies/webapp.prod.docker.post
Hook job scripts are executed with bash, from the copy directory as working directory, and receive:
DOCKER_HOOK_STAGE(preorpost)DOCKER_NAME(container name from*.docker)DOCKER_HOOK_FILE(resolved hook script path)
The logic in the central check-push.sh script:
Flow
Sequence
The project uses a single source of truth for version: the VERSION file at the repo root (e.g. 1.0.0).
- Scripts: Run
check-push.sh --version/-Vprints it. In the Docker image,VERSIONis copied to/scripts/VERSION. - supervisor (Rust): Build reads
VERSIONfrom the repo root and sets the binary version;supervisor --versionshows it. Thegh-webhooksubcommand servesGET /versionand includesversionin webhook responses. IfVERSIONis missing,Cargo.tomlpackage version is used.
To set the version everywhere (e.g. for a release), run:
./scripts/set-version.sh 1.2.3This updates VERSION, supervisor/Cargo.toml, etc.
- first time to launch all tests:
./tests/launch-testing.sh - if testing env is ready, to run:
./tests/scripts/test-check-push.sh - to clean up test env, to run:
./tests/cleanup-test.sh
After everytime to run the test scripts, the results can be checked in ./tests/work.test/copies/

