GitHub webhook → queue of deploy jobs → 2-worker async pool that runs
git pull, builds the affected repo, copies/writes artifacts and reloads
nginx. Per-repo lock serializes the same repo; a global _www_lock serializes
the writes under /var/www/html/ so two micros can never race the shell
replace.
A repo poller (see poller.py) runs in the same process on a fixed
interval (default 600 s, set DEPLOYD_POLL_INTERVAL to override). It does
git fetch --quiet origin for every managed repo, compares HEAD with
origin/<branch>, and enqueues a deploy through the same Scheduler when
upstream moved. This closes the gap when GitHub webhooks are lost (replay
late, transient 5xx, NAT we can't see) — max staleness is one poll
interval plus the deploy duration.
This repo is self-hosted: a push to main triggers the deploy webhook
in /root/.deployd/config.yaml, which runs scripts/self-update.sh, which
re-pulls this repo and systemctl restart late-deployd.
See tests/ for the test suite. Endpoints:
- POST
/deploy-webhookpush event from GitHub → enqueue deploy - GET
/healthliveness + configured repo list + poll interval;?poll=1triggers a tick - GET
/logsrecent deploy log filenames - GET
/api/deployd/eventsrecent events (filterable by?repo=and?type=) - WS
/api/deployd/events/wslive stream (super_admin auth)
Poller events (same /api/deployd/events endpoint, filtered by ?type=):
poll.startedpoll loop starting a new cyclepoll.upstream_aheadupstream has commits we don't; a deploy was enqueuedpoll.fetch_failedgit fetch originreturned non-zero (slow upstream, auth, etc)poll.finishedpoll cycle done; payload haschecked/triggeredcounts