chore(homelink): script the Home Link web deploy#666
Conversation
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 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b139805610
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| CADDY=\$(sudo docker inspect $CONTAINER --format '{{range .Mounts}}{{if eq .Destination \"/ftw-bin/caddy\"}}{{.Source}}{{end}}{{end}}') | ||
| sudo cp \"\$CADDY\" \$REL/bin/caddy |
There was a problem hiding this comment.
Allow redeploying the active label
When this label is already active—such as when retrying after the post-swap public verification failed—CADDY and $REL/bin/caddy resolve to the same host file. GNU cp then exits with “are the same file,” and set -e aborts staging, so the default same-commit retry cannot complete. Skip the copy when the paths match or stage the binary through a distinct temporary path.
Useful? React with 👍 / 👎.
| SHA=$(git rev-parse --short=7 HEAD) | ||
| LABEL="${1:-$SHA}" | ||
| REL="/srv/ftw-home-link/releases/${LABEL}" |
There was a problem hiding this comment.
Derive release bytes from the labeled commit
If any packaged web file has uncommitted changes, the default label still names HEAD, while the bundle is copied from the working tree. Production can therefore contain bytes that do not exist in the commit named by its release directory, defeating the script's traceability and making that label impossible to reproduce. Refuse relevant dirty files or package them directly from the selected commit.
Useful? React with 👍 / 👎.
home.sourceful.energyhad no pipeline and no script. Both the page and therelay were shipped by hand, so the only way to learn what production ran was to
curlit and diff against master. That gap cost real time while debugging#665.
This captures the layout that already exists rather than replacing it:
/srv/ftw-home-link/releases/<commit>,home-link.html,home-link-session.js,components/theme.css),caddybinary copied from the running container,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. After the swap it
verifies the live bytes against the local checkout and fails on any drift.
Reaching the host needs
aws ssm send-command— it has no ssh key and no awsCLI of its own.
Used to ship
1efb08e; the live files now match master byte for byte.no-changeset: an operator script that ships nothing to users.🤖 Generated with Claude Code