release: repair the catalog 404 and stop the page jumping (#3)
Showstopper. Adding, editing or deleting a dish redirected to /ruoat, which stopped existing when the tab was renamed to Ruuat — every one of those actions ended on a 404. Live in v20260905-4. The tests missed it because they asserted only a 303; a redirect to a dead URL is still a 303. They now assert the target. The page no longer jumps. Deleting a dish partway down the catalog, or opening a day in Kirjaa, sent the browser to the top. Both now patch in place via Datastar — bin, pencil, day rows, dish pills, save, delete, cancel and Näytä lisää. Links stay links and forms stay forms, so it works without JavaScript. Non-production tabs are labelled. ENV=dev gives dev · Foodster. Contributing guide added, and commits now take Conventional Commit types. ⚠️ Breaking: rewrite the server's .env in this deploy. Environment variables lost the FOODSTER_ prefix; the app refuses to start on an unset PASSWORD. REPO=… TAG=latest PASSWORD=… HOST=foodster.kessinen.com ENV=prod PUID=1000 PGID=1000 TZ=Europe/Helsinki PUID/PGID rather than UID/GID — UID is read-only in bash and would be silently overwritten. Co-authored-by: Esa Kataja <[email protected]> Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
@@ -38,7 +38,7 @@ build: generate ## Build ./foodster
|
||||
-ldflags="-s -w -X main.version=dev" -o $(BIN) $(PKG)
|
||||
|
||||
run: generate ## Run locally on :8080 (database in ./data)
|
||||
FOODSTER_PASSWORD=$${FOODSTER_PASSWORD:-dev} go run $(PKG)
|
||||
PASSWORD=$${PASSWORD:-dev} ENV=dev go run $(PKG)
|
||||
|
||||
seed: ## Import a dish bundle (SEED=seeds/testi.json)
|
||||
go run $(PKG) -import $(SEED)
|
||||
@@ -85,7 +85,7 @@ fix: ## Format Go and templ sources, tidy go.mod
|
||||
go mod tidy
|
||||
|
||||
image: ## Build and tag an image as vYYYYMMDD-N. Creates a git tag.
|
||||
@test -n "$(FOODSTER_REPO)" || { echo "set FOODSTER_REPO in .env"; exit 1; }
|
||||
@test -n "$(REPO)" || { echo "set REPO in .env"; exit 1; }
|
||||
@# A release tag must point into main, or the tag records a commit that
|
||||
@# was never released.
|
||||
@branch=$$(git symbolic-ref --short HEAD); \
|
||||
@@ -99,7 +99,7 @@ image: ## Build and tag an image as vYYYYMMDD-N. Creates a git tag.
|
||||
echo "==> $$tag"; \
|
||||
git tag "$$tag"; \
|
||||
podman build --platform linux/amd64 --build-arg VERSION="$$tag" \
|
||||
-t "$(FOODSTER_REPO):$$tag" -t "$(FOODSTER_REPO):latest" . ; \
|
||||
-t "$(REPO):$$tag" -t "$(REPO):latest" . ; \
|
||||
echo "$$tag" > $(TAGFILE)
|
||||
|
||||
# Pushing reported success while uploading the previous release once, because
|
||||
@@ -107,18 +107,18 @@ image: ## Build and tag an image as vYYYYMMDD-N. Creates a git tag.
|
||||
# registry what it actually serves for each tag and fail if it is not the
|
||||
# image we just built.
|
||||
push: ## Push the newest tag and :latest, then verify the registry
|
||||
@test -n "$(FOODSTER_REPO)" || { echo "set FOODSTER_REPO in .env"; exit 1; }
|
||||
@test -n "$(REPO)" || { echo "set REPO in .env"; exit 1; }
|
||||
@test -f $(TAGFILE) || { echo "nothing built - run make image"; exit 1; }; \
|
||||
tag=$$(cat $(TAGFILE)); \
|
||||
built=$$(podman image inspect "$(FOODSTER_REPO):$$tag" --format '{{.Id}}' 2>/dev/null) || \
|
||||
built=$$(podman image inspect "$(REPO):$$tag" --format '{{.Id}}' 2>/dev/null) || \
|
||||
{ echo "no local image tagged $$tag - run make image"; exit 1; }; \
|
||||
podman push "$(FOODSTER_REPO):$$tag"; \
|
||||
podman push "$(FOODSTER_REPO):latest"; \
|
||||
podman push "$(REPO):$$tag"; \
|
||||
podman push "$(REPO):latest"; \
|
||||
echo "==> verifying $$tag"; \
|
||||
for ref in "$$tag" latest; do \
|
||||
podman pull -q "$(FOODSTER_REPO):$$ref" >/dev/null 2>&1 || \
|
||||
podman pull -q "$(REPO):$$ref" >/dev/null 2>&1 || \
|
||||
{ echo " FAIL $$ref is not in the registry"; exit 1; }; \
|
||||
served=$$(podman image inspect "$(FOODSTER_REPO):$$ref" --format '{{.Id}}'); \
|
||||
served=$$(podman image inspect "$(REPO):$$ref" --format '{{.Id}}'); \
|
||||
if [ "$$served" != "$$built" ]; then \
|
||||
echo " FAIL $$ref serves $$served"; \
|
||||
echo " expected $$built"; \
|
||||
|
||||
Reference in New Issue
Block a user