oikos-web: extract the client stack from dtoro/oikos
Phase 1 of the hexagonal-architecture plan (dtoro/oikos plans/2026-08-15-hexagonal-architecture.md). Moves the delivery stack for the control-room UI into its own repo with its own pipeline: - web/ — Svelte 5 SPA, verbatim (vendor/ included) - desktop/ — Wails v3 wrapper, updateURL repointed to dtoro/oikos-web releases - compose/ — Dockerfile + Caddyfile, verbatim (the /wails/* 404 and asset no-fallback quirks are load-bearing) - docker-compose.yml — single web service, same 8091:80 publish, mem/cpu limits, and restart policy as the oikos stack's web service - scripts/deploy.sh — mirrors oikos deploy essentials: CI-green gate, TOCTOU guard, version-tagged oikos-web:v$VERSION, prune to 3 - cmd/webhook + scripts/install-webhook.sh — standalone push-to-deploy receiver on :9798 (env-only secrets, no Infisical dependency) - CI: the web job from oikos's ci.yml + the desktop build/release workflow, path-adjusted Own VERSION (0.33.0) with the same bump-on-main rule; starts above oikos's 0.32.x so the desktop updater sees an upgrade.
This commit is contained in:
86
scripts/install-webhook.sh
Executable file
86
scripts/install-webhook.sh
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
# Install the oikos-web deploy-webhook launchd unit on the mac-mini.
|
||||
#
|
||||
# Renders scripts/oikos-web-deploy-webhook.plist with real secret values and
|
||||
# loads it. Values come from env; when absent, the HMAC secret and API token
|
||||
# are resolved from the oikos stack's Infisical via the oikos CLI (only
|
||||
# available on the mac-mini with the oikos checkout + .env).
|
||||
#
|
||||
# Usage:
|
||||
# WEBHOOK_HMAC_SECRET=... GITEA_TOKEN=... ./scripts/install-webhook.sh
|
||||
set -e
|
||||
|
||||
REPO_DIR="${REPO_DIR:-$(cd "$(dirname "$0")/.." && pwd)}"
|
||||
PLIST_DST="$HOME/Library/LaunchAgents/network.hubris.oikos-web-deploy-webhook.plist"
|
||||
LABEL="network.hubris.oikos-web-deploy-webhook"
|
||||
|
||||
OIKOS_CLI="${OIKOS_CLI:-$HOME/Projects/oikos/oikos}"
|
||||
infisical_get() {
|
||||
[ -x "$OIKOS_CLI" ] || return 1
|
||||
(cd "$HOME/Projects/oikos" && set -a && . ./.env 2>/dev/null && set +a \
|
||||
&& OIKOS_INFISICAL_SITE_URL=http://localhost:8080 "$OIKOS_CLI" secret get "$1" 2>/dev/null) \
|
||||
| grep -E '^[0-9a-f]{40,}$' | head -n1
|
||||
}
|
||||
|
||||
HMAC="${WEBHOOK_HMAC_SECRET:-$(infisical_get webhook_hmac-secret || true)}"
|
||||
GITEA_TOKEN="${GITEA_TOKEN:-$(infisical_get gitea-pat_token || true)}"
|
||||
API_TOKEN="${OIKOS_API_TOKEN:-$(infisical_get api_token || true)}"
|
||||
|
||||
if [ -z "$HMAC" ]; then
|
||||
echo "ERROR: WEBHOOK_HMAC_SECRET not set and could not resolve from Infisical" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build the webhook binary first
|
||||
(cd "$REPO_DIR" && make webhook)
|
||||
|
||||
launchctl bootout "gui/$(id -u)" "$PLIST_DST" 2>/dev/null || true
|
||||
|
||||
cat > "$PLIST_DST" <<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>$LABEL</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>$REPO_DIR/webhook</string>
|
||||
</array>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>$REPO_DIR</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>HOME</key>
|
||||
<string>$HOME</string>
|
||||
<key>PATH</key>
|
||||
<string>/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
||||
<key>WEBHOOK_LISTEN</key>
|
||||
<string>:9798</string>
|
||||
<key>WEBHOOK_REPO_DIR</key>
|
||||
<string>$REPO_DIR</string>
|
||||
<key>WEBHOOK_HMAC_SECRET</key>
|
||||
<string>$HMAC</string>
|
||||
<key>GITEA_URL</key>
|
||||
<string>https://git.hubris.network</string>
|
||||
<key>GITEA_TOKEN</key>
|
||||
<string>$GITEA_TOKEN</string>
|
||||
<key>OIKOS_API_TOKEN</key>
|
||||
<string>$API_TOKEN</string>
|
||||
</dict>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>StandardOutPath</key>
|
||||
<string>$HOME/Library/Logs/oikos-web-webhook.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>$HOME/Library/Logs/oikos-web-webhook.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
chmod 600 "$PLIST_DST"
|
||||
|
||||
launchctl bootstrap "gui/$(id -u)" "$PLIST_DST"
|
||||
sleep 1
|
||||
launchctl print "gui/$(id -u)/$LABEL" >/dev/null && echo "installed: $LABEL (listening :9798)"
|
||||
Reference in New Issue
Block a user