From b1398056108b73fea4c2e15cada2e8c56a63a3cd Mon Sep 17 00:00:00 2001 From: Fredrik Ahlgren Date: Sat, 25 Jul 2026 09:14:41 +0200 Subject: [PATCH 1/2] chore(homelink): script the Home Link web deploy home.sourceful.energy had no pipeline and no script. Both the page and the relay were shipped by hand, so the only way to know what production ran was to curl it and diff against master. That gap cost real debugging time. This captures the existing release layout instead of replacing it: a versioned directory under /srv/ftw-home-link/releases, the three files the page actually serves, and the caddy binary copied from the running container. The previous release is left in place, so a rollback stays one container recreate. The swap is the only destructive step, so it restores the previous release if the new container fails to start or does not serve the page. Co-Authored-By: Claude Opus 5 --- Makefile | 2 +- scripts/deploy-home-link-web.sh | 119 ++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 1 deletion(-) create mode 100755 scripts/deploy-home-link-web.sh diff --git a/Makefile b/Makefile index 6fcdaad7..8793763a 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ optimizer-test: optimizer/.venv/.installed optimizer/.venv/bin/pytest -q optimizer/tests compose-migration-test: - bash -n scripts/enable-modular-stack.sh scripts/migrate-legacy-compose.sh scripts/install-macos.sh + bash -n scripts/enable-modular-stack.sh scripts/migrate-legacy-compose.sh scripts/install-macos.sh scripts/deploy-home-link-web.sh bash scripts/test-modular-compose.sh container-boundary-test: diff --git a/scripts/deploy-home-link-web.sh b/scripts/deploy-home-link-web.sh new file mode 100755 index 00000000..4c619fc7 --- /dev/null +++ b/scripts/deploy-home-link-web.sh @@ -0,0 +1,119 @@ +#!/bin/bash +# Deploy web/home-link.html + home-link-session.js + components/theme.css to +# home.sourceful.energy. Run from the forty-two-watts repo root, on the commit +# you want live. Mirrors the existing hand-rolled release layout; the previous +# release directory is left in place so a rollback is one container recreate. +set -euo pipefail + +INSTANCE=i-08351b29352efc64e +REGION=eu-central-1 +IMAGE=sha256:5f5c8640aae01df9654968d946d8f1a56c497f1dd5c5cda4cf95ab7c14d58648 +NETWORK=buzz-prod_buzz-net +CONTAINER=ftw-home-link-web + +for f in web/home-link.html web/home-link-session.js web/components/theme.css; do + test -f "$f" || { echo "run me from the repo root; missing $f" >&2; exit 1; } +done + +SHA=$(git rev-parse --short=7 HEAD) +LABEL="${1:-$SHA}" +REL="/srv/ftw-home-link/releases/${LABEL}" +WORK=$(mktemp -d) +trap 'rm -rf "$WORK"' EXIT + +echo "==> packaging $LABEL" +mkdir -p "$WORK/bundle/components" +cp web/home-link.html web/home-link-session.js "$WORK/bundle/" +cp web/components/theme.css "$WORK/bundle/components/" +tar -czf "$WORK/web.tgz" -C "$WORK/bundle" . + +run_ssm() { # run_ssm