A autodeploy after every change: deploy script with live check, project CLAUDE.md

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-21 09:37:04 +02:00
parent 74b257ce6e
commit cd718afdda
2 changed files with 59 additions and 0 deletions

16
CLAUDE.md Normal file
View File

@ -0,0 +1,16 @@
# Logigate
## Finishing a change
Every change ends live on https://logicate.blax.at. The user has authorized this for this project: deploying the logigate container on edgerealm needs no further go-ahead.
1. `pnpm test` and `pnpm typecheck` pass.
2. Commit (message style as in `git log`: `A …` adds, `R …` reworks, `BF …` fixes) and push to `origin master`.
3. Run `scripts/deploy-edgerealm.sh`. Done when it prints `Live: https://logicate.blax.at at <commit>`.
4. Name the live commit in the reply.
The authorization covers only `/mnt/HC_Volume_102040804/srv/logigate` and the `logigate` container. Everything else on edgerealm (a host shared with customer sites) still needs the user's go-ahead.
## Compatibility
The user works in the app every day, so projects saved by earlier releases must keep loading and computing the same. `tests/compat.test.ts` guards this with fixtures in `tests/fixtures/`; leave those files as they are. New project fields are optional with defaults.

43
scripts/deploy-edgerealm.sh Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Deploys the pushed master to logicate.blax.at (edgerealm) and checks it is live.
# Touches only the logigate checkout and container on that shared host.
set -euo pipefail
HOST=root@static.64.40.140.128.clients.your-server.de
DIR=/mnt/HC_Volume_102040804/srv/logigate
URL=https://logicate.blax.at
cd "$(dirname "$0")/.."
if [ -n "$(git status --porcelain)" ]; then
echo "Uncommitted changes: commit and push first." >&2
exit 1
fi
git fetch -q origin
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse origin/master)
if [ "$LOCAL" != "$REMOTE" ]; then
echo "HEAD ${LOCAL:0:7} is not origin/master ${REMOTE:0:7}: push (or pull) first." >&2
exit 1
fi
echo "==> Deploying ${LOCAL:0:7} to edgerealm"
ssh -o BatchMode=yes "$HOST" "cd $DIR && ./deploy.sh" | { grep -E '==> Deployment complete|ERROR|Container logigate Started' || true; }
DEPLOYED=$(ssh -o BatchMode=yes "$HOST" "cd $DIR && git rev-parse HEAD")
if [ "$DEPLOYED" != "$LOCAL" ]; then
echo "Server is on ${DEPLOYED:0:7}, expected ${LOCAL:0:7}." >&2
exit 1
fi
# The container needs a moment to start serving.
for _ in $(seq 1 20); do
PAGE=$(curl -s -o /dev/null -w '%{http_code}' "$URL/" || true)
API=$(curl -s -o /dev/null -w '%{http_code}' "$URL/api/auth/me" || true)
if [ "$PAGE" = 200 ] && [ "$API" = 200 ]; then
echo "Live: $URL at ${LOCAL:0:7}"
exit 0
fi
sleep 2
done
echo "Deployed ${LOCAL:0:7}, but $URL answers page=$PAGE api=$API." >&2
exit 1