CI modelled on Pulse, deploy script with rollback, bootstrap, README

- .gitea/workflows/ci.yml: flake8 + dash check, pytest (90% coverage floor), MariaDB
  integration tests, bandit, pip-audit, gitleaks, actionlint, shellcheck, zizmor, semgrep;
  main deploys through a signed webhook and waits for /health to report the commit.
- deploy/thor_deploy.sh: deploys an exact sha, installs units and nginx site when changed,
  rolls back unless /health reports the sha with a working database. Sandbox-tested.
- deploy/bootstrap.sh: idempotent first install on CT 173.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-25 22:35:28 -05:00
1 parent eecb24297a
commit 379570bbdc
14 files changed
+689

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
[
{
"id": "thor-deploy",
"execute-command": "/usr/bin/sudo",
"pass-arguments-to-command": [
{"source": "string", "name": "/usr/local/bin/thor_deploy.sh"},
{"source": "payload", "name": "sha"},
{"source": "payload", "name": "ts"}
],
"command-working-directory": "/",
"include-command-output-in-response": false,
"trigger-rule": {
"and": [
{"match": {"type": "payload-hmac-sha256", "secret": "REPLACE_WITH_WEBHOOK_SECRET",
"parameter": {"source": "header", "name": "X-Gitea-Signature"}}},
{"match": {"type": "value", "value": "refs/heads/main",
"parameter": {"source": "payload", "name": "ref"}}}
]
}
}
]
+2
View File
@@ -0,0 +1,2 @@
# /etc/sudoers.d/thor-deploy (mode 0440): the webhook user may run the deploy script only.
webhook ALL=(root) NOPASSWD: /usr/local/bin/thor_deploy.sh
+14
View File
@@ -0,0 +1,14 @@
[Unit]
Description=Webhook listener for Thor deploys
After=network-online.target
Wants=network-online.target
[Service]
User=webhook
Group=webhook
ExecStart=/usr/bin/webhook -hooks /etc/webhook/hooks.json -port 9000 -verbose
Restart=always
# No NoNewPrivileges here: the hook runs the deploy script through sudo.
[Install]
WantedBy=multi-user.target