forked from WikiDeck/wikideck
deploy/night: auto-redeploy watcher and README updates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,10 @@ A 3-node **testnet-only** fixture on poweredge-r350. It is reachable on the LAN
|
|||||||
- It mines to 4 disposable wallets (alice, bob, carol, dave) and writes chain-bound encrypted browser backups to `$STATE_DIR/wallets/`.
|
- It mines to 4 disposable wallets (alice, bob, carol, dave) and writes chain-bound encrypted browser backups to `$STATE_DIR/wallets/`.
|
||||||
- It never changes consensus code. Speed comes from the protocol's own testnet parameters: the initial target accepts 1/16 of hashes, and each 10-block retarget at most quadruples the difficulty.
|
- It never changes consensus code. Speed comes from the protocol's own testnet parameters: the initial target accepts 1/16 of hashes, and each 10-block retarget at most quadruples the difficulty.
|
||||||
- Each template costs several Wikipedia API calls, and Wikipedia rate-limits our egress IP. The miner therefore paces templates (`MIN_GAP`, default 45 s) and backs off exponentially on failure.
|
- Each template costs several Wikipedia API calls, and Wikipedia rate-limits our egress IP. The miner therefore paces templates (`MIN_GAP`, default 45 s) and backs off exponentially on failure.
|
||||||
|
- `compose.lan.yaml` also sets, per node:
|
||||||
|
- `WIKIDECK_USER_AGENT`, a Wikimedia-policy UA with a project URL (#19). Without it, Wikipedia returned 429 to our egress and templates failed.
|
||||||
|
- the game-mode env from #22: A = classic and trending, B = draft, C = all three.
|
||||||
|
- `autodeploy.sh` follows the integration branch. Run it from a dedicated detached worktree: `git worktree add --detach ../deploy-src origin/night/2026-11-16 && cd ../deploy-src && deploy/night/autodeploy.sh`. It polls the Gitea API every 3 min and redeploys whenever the head moves.
|
||||||
- `testnet.sh` has `up`, `mine N [workers]`, `status` and `down`. Run it from the repo root on a checkout of the integration branch. `up` rebuilds the image from that checkout; the ledgers persist in the named volumes.
|
- `testnet.sh` has `up`, `mine N [workers]`, `status` and `down`. Run it from the repo root on a checkout of the integration branch. `up` rebuilds the image from that checkout; the ledgers persist in the named volumes.
|
||||||
|
|
||||||
Never point this at mainnet or the live `wikideck` namespace.
|
Never point this at mainnet or the live `wikideck` namespace.
|
||||||
|
|||||||
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# sim-testnet: keep the wikideck-night testnet on the integration branch head.
|
||||||
|
# Run from the root of a *dedicated* checkout (e.g. a detached git worktree): it checks out
|
||||||
|
# each new head of $BRANCH and runs `deploy/night/testnet.sh up` (ledgers persist in the volumes).
|
||||||
|
# Head detection uses the public Gitea API, which also works where SSH auth isn't available.
|
||||||
|
set -u
|
||||||
|
BRANCH=${BRANCH:-night/2026-11-16}
|
||||||
|
API=${API:-https://gitea.eom.dev/api/v1/repos/claude/wikideck}
|
||||||
|
INTERVAL=${INTERVAL:-180}
|
||||||
|
LOG=${LOG:-/tmp/wikideck-night-autodeploy.log}
|
||||||
|
enc=$(printf %s "$BRANCH" | sed 's#/#%2F#g')
|
||||||
|
while :; do
|
||||||
|
new=$(node -e "fetch('$API/branches/$enc',{signal:AbortSignal.timeout(15000)}).then(r=>r.json()).then(b=>console.log(b.commit.id)).catch(()=>{})")
|
||||||
|
cur=$(git rev-parse HEAD)
|
||||||
|
if [ -z "$new" ]; then echo "WARN branch API failed"
|
||||||
|
elif [ "$new" != "$cur" ]; then
|
||||||
|
if ! git fetch -q origin "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH" 2>"$LOG"; then
|
||||||
|
echo "WARN fetch failed: $(tail -1 "$LOG")"
|
||||||
|
else
|
||||||
|
git checkout -q --detach "$new"
|
||||||
|
echo "DEPLOY start $(git log --oneline -1 | cut -c1-90)"
|
||||||
|
if deploy/night/testnet.sh up >"$LOG" 2>&1; then
|
||||||
|
sleep 20; echo "DEPLOY ok $(git rev-parse --short HEAD): $(deploy/night/testnet.sh status 2>&1 | tr '\n' ' ')"
|
||||||
|
else echo "DEPLOY FAILED $(git rev-parse --short HEAD): $(tail -3 "$LOG" | tr '\n' ' ')"; fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
sleep "$INTERVAL"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user