Files
docs/publishing/webhook-receiver.service
T
inference-bot 20d384be87 publishing: one canonical build venv; drift check; deploy-failure alerting
The poller's private venv (.docs-publisher/.venv-docs) diverged from the
canonical one twice, each time silently delaying a deploy. Consolidate:

- poll-watcher.sh builds with the ONE canonical venv
  (~/repos/docs/.venv-docs) while keeping its dedicated checkout (uncommitted
  edits in a working clone must never block or leak into a deploy).
- New drift check: publishing/ + mkdocs.yml are compared with the canonical
  checkout before every build; a mismatch fails the deploy loudly instead of
  shipping logic the canonical source cannot reproduce.
- Pre-deploy gate: build.sh --check-only verifies the pinned toolchain and
  every configured plugin (self-heals missing pins, fails loudly naming an
  unpinned plugin).
- Alerting: 3 consecutive deploy failures -> marker file + ONE Matrix message
  to the InferenceBot HQ room (hourly cap); counter resets on next success.
- The watcher re-execs itself when a deploy changed poll-watcher.sh, so the
  running loop always matches the deployed one.
- webhook receiver (dormant) repointed at the canonical venv too; unit files
  and README document the layout.
2026-11-12 03:23:33 +00:00

32 lines
1.7 KiB
Desktop File

# systemd unit for the docs deploy webhook receiver (agent host).
#
# Install:
# sudo cp publishing/webhook-receiver.service /etc/systemd/system/
# sudo systemctl daemon-reload && sudo systemctl enable --now docs-deploy-webhook
#
# The ExecStartPre lines narrow the webhook port to the Cloudron box (which
# hosts git.inference.coop); the receiver additionally checks the source address
# and the payload signature, so a scanner hitting the port gets nothing.
[Unit]
Description=Inference docs: Gitea webhook -> build -> Surfer deploy
After=network-online.target
Wants=network-online.target
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/.docs-publisher
Environment=DOCS_REPO_DIR=/home/ubuntu/.docs-publisher
ExecStartPre=+/bin/sh -c '/usr/sbin/iptables -C INPUT -i lo -p tcp --dport 8787 -j ACCEPT 2>/dev/null || /usr/sbin/iptables -I INPUT 1 -i lo -p tcp --dport 8787 -j ACCEPT'
ExecStartPre=+/bin/sh -c '/usr/sbin/iptables -C INPUT -p tcp --dport 8787 -s 179.237.86.116 -j ACCEPT 2>/dev/null || /usr/sbin/iptables -I INPUT 2 -p tcp --dport 8787 -s 179.237.86.116 -j ACCEPT'
ExecStartPre=+/bin/sh -c '/usr/sbin/iptables -C INPUT -p tcp --dport 8787 ! -s 179.237.86.116 -j DROP 2>/dev/null || /usr/sbin/iptables -I INPUT 3 -p tcp --dport 8787 ! -s 179.237.86.116 -j DROP'
ExecStartPre=+/bin/sh -c '/usr/sbin/ip6tables -C INPUT -p tcp --dport 8787 -j DROP 2>/dev/null || /usr/sbin/ip6tables -I INPUT -p tcp --dport 8787 -j DROP'
# The receiver runs on the ONE canonical build venv (the canonical checkout's
# .venv-docs), like every other trigger of this publishing layer.
ExecStart=/home/ubuntu/repos/docs/.venv-docs/bin/python /home/ubuntu/.docs-publisher/publishing/webhook-receiver.py
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target