#!/bin/bash # First-time setup for the homelab-mcp deploy webhook. Generates a secret, # installs the systemd unit, and starts it. Re-run is safe (won't regenerate # the secret if one exists). set -euo pipefail SECRET_DIR=/etc/homelab-mcp-deploy SECRET=$SECRET_DIR/secret UNIT=homelab-mcp-deploy.service install -d -m 700 "$SECRET_DIR" if [ ! -s "$SECRET" ]; then head -c 32 /dev/urandom | base64 > "$SECRET" chmod 600 "$SECRET" echo "[install] generated webhook secret at $SECRET" fi systemctl daemon-reload systemctl enable --now "$UNIT" systemctl status "$UNIT" --no-pager | head -10 cat <:9811/deploy HTTP Method: POST Content-Type: application/json Secret: $(cat $SECRET) Trigger: Push events EOF