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.
This commit is contained in:
Natalie 2026-06-28 10:46:18 -04:00
parent 2dfbf2a2fe
commit 320d17995d
2 changed files with 14 additions and 6 deletions

View file

@ -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() {

View file

@ -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)