From 320d17995d02a1116621a6adebebd62045d14e99 Mon Sep 17 00:00:00 2001 From: Natalie Date: Sun, 28 Jun 2026 10:46:18 -0400 Subject: [PATCH] feat(dx): make mcforge part of net-tools infra installers (symmetric to ctforge) - scripts/run/forge.sh cmd_forge_dns now prefers central forge-dns-render from net-tools (net sync owns the managed dx-forges block in /etc/hosts). - Updated cloud-dx-do.md table entry. - Both forges now converge via the shared DX infra layer. --- scripts/run/forge.sh | 18 +++++++++++++----- .../dot-claude/instructions/cloud-dx-do.md | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/run/forge.sh b/scripts/run/forge.sh index 6f020565..ea63c72b 100755 --- a/scripts/run/forge.sh +++ b/scripts/run/forge.sh @@ -56,18 +56,26 @@ cmd_forge() { Forgejo origin lifecycle (DigitalOcean). Needs ~/.vault/do_pat_mc. ./run forge:down stop + snapshot + destroy (~$6/mo -> ~$0.30/mo idle) ./run forge:up restore from newest snapshot, refresh vault creds - ./run forge:dns point the 'mcforge' hostname at the current forge IP (sudo; macOS /etc/hosts) + ./run forge:dns ensure 'mcforge' /etc/hosts shortcut (now via net-tools DX infra + net sync; fallback local) EOF } cmd_forge_dns() { - # Map a friendly hostname to the current forge IP in /etc/hosts (macOS). - # Re-run after forge:up (the IP changes). Browse the forge at http://mcforge:3000. + # Map a friendly hostname (mcforge) to the current forge IP in /etc/hosts. + # This is now part of the shared net-tools DX infra installers: + # - `net sync` (or net-tools/bin/forge-dns-render --install) owns the managed block + # - Per-project ./run forge:dns prefers the central renderer when present (fallback below). + # Re-run (or `net sync`) after ./run forge:up (the droplet IP rotates). local name="${1:-mcforge}" ip ip="$(grep -E '^FORGE_IP=' "$_VAULT_CREDS" 2>/dev/null | cut -d= -f2)" [ -n "$ip" ] || { echo "no FORGE_IP in $_VAULT_CREDS" >&2; return 1; } - sudo sh -c "sed -i '' '/[[:space:]]${name}\$/d' /etc/hosts 2>/dev/null; printf '%s\t%s\n' '$ip' '$name' >> /etc/hosts" - echo "/etc/hosts: $name -> $ip → http://$name:3000" + if command -v forge-dns-render >/dev/null 2>&1; then + sudo forge-dns-render --install || echo "(central forge-dns-render had issues; local edit may still have run)" >&2 + else + # Fallback for machines without net-tools DX layer installed yet. + sudo sh -c "sed -i '' '/[[:space:]]${name}\$/d' /etc/hosts 2>/dev/null; printf '%s\t%s\n' '$ip' '$name' >> /etc/hosts" + fi + echo "/etc/hosts: $name -> $ip → http://$name:3000 (also via 'net sync')" } cmd_forge_down() { diff --git a/tooling/claude/dot-claude/instructions/cloud-dx-do.md b/tooling/claude/dot-claude/instructions/cloud-dx-do.md index 78beaa32..61939c17 100644 --- a/tooling/claude/dot-claude/instructions/cloud-dx-do.md +++ b/tooling/claude/dot-claude/instructions/cloud-dx-do.md @@ -20,7 +20,7 @@ | `./run dist:prune [keep=2]` | delete superseded golden snapshots (~$0.40/mo each); keeps the newest N | | `./run dist:down` | tear the fleet down → **$0** | | `./run forge:up` / `forge:down` | Forgejo origin: restore-from-snapshot / snapshot+destroy (~$6/mo or ~$0.30 idle) | -| `./run forge:dns` | `/etc/hosts` shortcut → `http://mcforge:3000` | +| `./run forge:dns` or `net sync` | DX infra: managed `mcforge` (and `ctforge`) /etc/hosts shortcuts via net-tools/forge-dns-render. After `forge:up`. | ## Standing setup (already built — proven 2026-06-27)