Skip to content

chore(homelink): script the Home Link web deploy#666

Merged
frahlg merged 2 commits into
masterfrom
chore/home-link-web-deploy-script
Jul 25, 2026
Merged

chore(homelink): script the Home Link web deploy#666
frahlg merged 2 commits into
masterfrom
chore/home-link-web-deploy-script

Conversation

@frahlg

@frahlg frahlg commented Jul 25, 2026

Copy link
Copy Markdown
Member

home.sourceful.energy had no pipeline and no script. Both the page and the
relay were shipped by hand, so the only way to learn what production ran was to
curl it and diff against master. That gap cost real time while debugging
#665.

This captures the layout that already exists rather than replacing it:

  • a versioned release directory under /srv/ftw-home-link/releases/<commit>,
  • the three files the page actually serves (home-link.html,
    home-link-session.js, components/theme.css),
  • the caddy binary copied from the running container,
  • the previous release left in place, so a rollback is 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. 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 aws
CLI 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

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>
@frahlg frahlg added the no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping) label Jul 25, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +57 to +58
CADDY=\$(sudo docker inspect $CONTAINER --format '{{range .Mounts}}{{if eq .Destination \"/ftw-bin/caddy\"}}{{.Source}}{{end}}{{end}}')
sudo cp \"\$CADDY\" \$REL/bin/caddy

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +18 to +20
SHA=$(git rev-parse --short=7 HEAD)
LABEL="${1:-$SHA}"
REL="/srv/ftw-home-link/releases/${LABEL}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@frahlg
frahlg merged commit b297b37 into master Jul 25, 2026
11 checks passed
@frahlg
frahlg deleted the chore/home-link-web-deploy-script branch July 25, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant