ec07fb3e
site: publishing the site does not move what the fleet downloads
a73x 2026-08-19 04:17
Commit message
Makefile
| Old | New | ||
|---|---|---|---|
| @@ -186,10 +186,17 @@ site-check: | |||
| 186 | # Build and push the eitri.sh site image (nginx + site + /dl artifacts). | 186 | # Build and push the eitri.sh site image (nginx + site + /dl artifacts). |
| 187 | # Needs SITE_IMAGE in deploy.env. | 187 | # Needs SITE_IMAGE in deploy.env. |
| 188 | # Rollout on k8s is manual and stays outside the repo. | 188 | # Rollout on k8s is manual and stays outside the repo. |
| 189 | # | ||
| 190 | # SITE_DL_VERSION is the release /dl serves, and defaults to this tree's own | ||
| 191 | # version. Publishing site copy between releases pins it to the last release — | ||
| 192 | # `make site-image SITE_DL_VERSION=v0.0.7` — which also skips building one, | ||
| 193 | # because /dl/latest carries the manifest every agent polls. | ||
| 194 | SITE_DL_VERSION ?= $(VERSION) | ||
| 189 | site-image: | 195 | site-image: |
| 190 | $(MAKE) release | 196 | @if [ "$(SITE_DL_VERSION)" = "$(VERSION)" ]; then $(MAKE) release; \ |
| 191 | $(MAKE) site SITE_DIST=dist/$(VERSION) | 197 | else echo "site-image: /dl pinned to $(SITE_DL_VERSION); not building a release"; fi |
| 192 | ./scripts/site-image.sh | 198 | $(MAKE) site SITE_DIST=dist/$(SITE_DL_VERSION) |
| 199 | SITE_DL_VERSION=$(SITE_DL_VERSION) ./scripts/site-image.sh | ||
| 193 | 200 | ||
| 194 | # eitri-server production image (arm64) — the hosted control plane. | 201 | # eitri-server production image (arm64) — the hosted control plane. |
| 195 | server-image: web | 202 | server-image: web |
scripts/site-image.sh
| Old | New | ||
|---|---|---|---|
| @@ -5,6 +5,11 @@ | |||
| 5 | # SITE_IMAGE registry/repo to push, e.g. registry.example/eitri-site (required) | 5 | # SITE_IMAGE registry/repo to push, e.g. registry.example/eitri-site (required) |
| 6 | # SITE_PLATFORM image platform, e.g. linux/arm64 (optional; the Dockerfile | 6 | # SITE_PLATFORM image platform, e.g. linux/arm64 (optional; the Dockerfile |
| 7 | # is COPY-only, so cross-building needs no emulation) | 7 | # is COPY-only, so cross-building needs no emulation) |
| 8 | # SITE_DL_VERSION the release /dl serves (optional; defaults to this tree's | ||
| 9 | # version). Pin it to the last release to publish the site | ||
| 10 | # without moving what the fleet downloads: /dl/latest holds | ||
| 11 | # the manifest every agent polls, so an untagged build staged | ||
| 12 | # there would offer itself to every host. | ||
| 8 | # | 13 | # |
| 9 | # Expects `make release` (dist/<version>) and `make site` (site/dist) to have | 14 | # Expects `make release` (dist/<version>) and `make site` (site/dist) to have |
| 10 | # run — the Makefile's site-image target orders all three. Firmware and the | 15 | # run — the Makefile's site-image target orders all three. Firmware and the |
| @@ -19,15 +24,16 @@ ENV_FILE="${EITRI_DEPLOY_ENV:-$HOME/eitri-deploy/deploy.env}" | |||
| 19 | : "${SITE_IMAGE:?site-image: set SITE_IMAGE in $ENV_FILE}" | 24 | : "${SITE_IMAGE:?site-image: set SITE_IMAGE in $ENV_FILE}" |
| 20 | 25 | ||
| 21 | VERSION="$(git describe --tags --always --dirty 2>/dev/null || echo dev)" | 26 | VERSION="$(git describe --tags --always --dirty 2>/dev/null || echo dev)" |
| 22 | [ -d "dist/$VERSION" ] || { echo "site-image: dist/$VERSION missing — run make release" >&2; exit 1; } | 27 | DL_VERSION="${SITE_DL_VERSION:-$VERSION}" |
| 28 | [ -d "dist/$DL_VERSION" ] || { echo "site-image: dist/$DL_VERSION missing — run make release" >&2; exit 1; } | ||
| 23 | [ -f site/dist/index.html ] || { echo "site-image: site/dist missing — run make site" >&2; exit 1; } | 29 | [ -f site/dist/index.html ] || { echo "site-image: site/dist missing — run make site" >&2; exit 1; } |
| 24 | 30 | ||
| 25 | # Stage /dl: versioned artifacts + the latest symlink. | 31 | # Stage /dl: versioned artifacts + the latest symlink. |
| 26 | rm -rf site/dist/dl/v* site/dist/dl/latest | 32 | rm -rf site/dist/dl/v* site/dist/dl/latest |
| 27 | mkdir -p site/dist/dl | 33 | mkdir -p site/dist/dl |
| 28 | cp -r "dist/$VERSION" "site/dist/dl/$VERSION" | 34 | cp -r "dist/$DL_VERSION" "site/dist/dl/$DL_VERSION" |
| 29 | ln -sfn "$VERSION" site/dist/dl/latest | 35 | ln -sfn "$DL_VERSION" site/dist/dl/latest |
| 30 | 36 | ||
| 31 | docker build ${SITE_PLATFORM:+--platform "$SITE_PLATFORM"} -f site/Dockerfile -t "$SITE_IMAGE:$VERSION" . | 37 | docker build ${SITE_PLATFORM:+--platform "$SITE_PLATFORM"} -f site/Dockerfile -t "$SITE_IMAGE:$VERSION" . |
| 32 | docker push "$SITE_IMAGE:$VERSION" | 38 | docker push "$SITE_IMAGE:$VERSION" |
| 33 | echo "site-image: pushed $SITE_IMAGE:$VERSION — roll it out on k8s manually" | 39 | echo "site-image: pushed $SITE_IMAGE:$VERSION serving /dl/$DL_VERSION — roll it out on k8s manually" |