Files
EJClaw f5554a9499 docs: reflect A1-A5 answers, real game maps/icons in mockups (v0.4); add gvr placeholder deploy
- A1: .5 Docker placeholder on port 2972, NPMplus proxy gvr.tkrmagid.kr, cert script
- A2/A3: delete only audio after 7 days, keep training data
- A4: bot token verified (stored outside repo)
- A5: LoL in-game chat via screen OCR (methods compared), M4 +0.5w
- Mockups: Ascent minimap, agents, weapons (valorant-api.com); SR map, champions,
  objective icons (Data Dragon / Community Dragon) with game->map coordinate transforms

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 13:09:35 +09:00

35 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# gvr.tkrmagid.kr: once DNS points at the home IP, get a Let's Encrypt cert in NPMplus (192.168.10.3)
# and turn on Force SSL / HTTP2 / HSTS for the gvr proxy host (id 13 -> 192.168.10.5:2972). Safe to re-run.
# Exit 0 + "DONE" = https works; exit 3 = DNS not ready yet; other = error.
set -euo pipefail
DOMAIN=gvr.tkrmagid.kr
WANT_IP=211.213.11.141
# Every authoritative NS must answer; Let's Encrypt fails on a single NXDOMAIN (and failures are rate-limited).
for ns in ns1 ns2 ns3 ns4; do
ip=$(dig +short +time=3 +tries=2 "$DOMAIN" A @$ns.hosting.co.kr | tail -1 || true)
if [ "$ip" != "$WANT_IP" ]; then echo "DNS not ready ($DOMAIN @$ns -> '${ip}')"; exit 3; fi
done
ssh -o BatchMode=yes root@192.168.10.3 bash -s -- "$DOMAIN" <<'REMOTE'
set -euo pipefail
DOMAIN=$1
T=$(docker exec -w /app npmplus node --input-type=module -e 'import TokenModel from "./models/token.js"; const t = await TokenModel().create({iss:"api", attrs:{id:1}, scope:["user"], expiresIn:"30m"}); console.log(t.token);' | tail -1)
api() { curl -sk -b "token=$T" -H 'Content-Type: application/json' "$@"; }
HOST_ID=$(api https://127.0.0.1:81/api/nginx/proxy-hosts | python3 -c "import json,sys;print(next((h['id'] for h in json.load(sys.stdin) if '$DOMAIN' in h['domain_names']),0))")
[ "$HOST_ID" = 0 ] && { echo "no proxy host for $DOMAIN"; exit 1; }
host=$(api https://127.0.0.1:81/api/nginx/proxy-hosts/$HOST_ID)
cid=$(echo "$host" | python3 -c 'import json,sys;print(json.load(sys.stdin).get("certificate_id") or 0)')
if [ "$cid" = 0 ]; then
cid=$(api https://127.0.0.1:81/api/nginx/certificates | python3 -c "import json,sys;print(next((c['id'] for c in json.load(sys.stdin) if '$DOMAIN' in c['domain_names']),0))")
fi
if [ "$cid" = 0 ]; then
res=$(api -X POST https://127.0.0.1:81/api/nginx/certificates --data "{\"provider\":\"letsencrypt\",\"domain_names\":[\"$DOMAIN\"],\"meta\":{\"dns_challenge\":false}}")
cid=$(echo "$res" | python3 -c 'import json,sys;print(json.load(sys.stdin).get("id") or 0)')
[ "$cid" = 0 ] && { echo "cert request failed: $res" | head -c 600; exit 1; }
fi
api -X PUT https://127.0.0.1:81/api/nginx/proxy-hosts/$HOST_ID --data "{\"certificate_id\":$cid,\"ssl_forced\":true,\"http2_support\":true,\"hsts_enabled\":true,\"hsts_subdomains\":false}" | python3 -c 'import json,sys;d=json.load(sys.stdin);print("host", d.get("id"), "cert", d.get("certificate_id"), d.get("meta"), d.get("error"))'
REMOTE
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 10 "https://$DOMAIN/healthz" || true)
echo "https://$DOMAIN/healthz -> $code"
[ "$code" = 200 ] && echo DONE