clean rig

This commit is contained in:
2026-09-17 01:12:15 -03:00
parent de5b1b7ea8
commit 1dc9d38c80
12 changed files with 98 additions and 312 deletions

View File

@@ -1,16 +1,18 @@
# Thin control Makefile — one target per ctrl/ script, and the subcommand is an
# argument rather than a second target: `make cluster down`, not `make cluster-down`.
# Thin control Makefile — few targets, and the subcommand is an argument rather
# than a second target: `make cluster down`, not `make cluster-down`.
#
# The logic lives in the scripts, never here. Each target maps to exactly one
# bash file, and that file holds the variants:
# make check is this machine ready? (never changes anything)
# make deps install the toolchain
# make cluster up cluster + registry + addons (ports derive by themselves)
# make tilt / docs work on it, read about it
#
# make cluster up -> ctrl/cluster.sh up
# The logic lives in the scripts, never here: `make cluster up` -> ctrl/cluster.sh up.
#
# Config layers, weakest first: built-in defaults < ctrl/versions.env (pinned
# toolchain) < ctrl/env.d/<profile>.env (optional) < ctrl/.env (local,
# gitignored) < the environment. So `make cluster up PROFILE=<name>` beats them all.
#
# Start with: make setup (then: make cluster up && make docs)
# Start with: make check && make deps && make cluster up
# Identity follows the FOLDER NAME, so this directory can be copied elsewhere,
# renamed, and run as a separate environment with no edits. ctrl/.env overrides
@@ -24,7 +26,7 @@
#
# This used to be sed over ctrl/.env plus a slug computed here, which is a
# SECOND derivation of values lib/config.sh already owns — and the two could
# disagree about the port after `make ports persist`, or about the name for any
# disagree about the port after `ports.sh persist`, or about the name for any
# directory whose sanitised form differs from its raw one. One source now; the
# Tiltfile reads the same line.
FACTS := $(shell bash ctrl/ports.sh active 2>/dev/null)
@@ -50,59 +52,39 @@ $(eval $(ARGS):;@:)
.PHONY: $(ARGS)
endif
.PHONY: help setup check selftest mem deps deps-image standalone cluster registry addons ports \
docs tilt \
.PHONY: help check deps cluster tilt docs selftest standalone \
kind-up kind-down kind-reset tilt-up tilt-down
help: ## list targets
@grep -hE '^[a-z][a-z-]*:.*?##' $(MAKEFILE_LIST) | sed 's/:.*##/\t/' | expand -t16
# ── setup ──────────────────────────────────────────────────────────────────
# ── this machine ───────────────────────────────────────────────────────────
setup: ## prepare this machine [core] [--cluster]
bash ctrl/setup.sh $(ARGS)
# Everything that looks and never changes anything: host, docker, toolchain,
# config, memory, ports, registry, addons. `check mem` goes deeper on memory —
# how far it really climbs, and the WSL .wslconfig backup/restore.
check: ## is this machine ready? [mem [status|push|all|backup|restore]]
bash ctrl/check.sh $(ARGS)
check: ## is this machine ready? reports, never fixes
bash ctrl/check.sh
# The counterpart to check: that one asks about the MACHINE and never fails,
# this one asks about RIG and exits 1, as `make standalone check` does. Checks are written
# as the decisions they defend, so a failure names what is being undone.
selftest: ## does rig still do what it says? exits 1 if not
bash ctrl/selftest.sh
mem: ## memory, its caps, what it survives [status|push|all|backup|restore]
bash ctrl/mem.sh $(or $(ARGS),status)
deps: ## install the toolchain [core|dev] (default dev)
bash ctrl/deps.sh install $(or $(ARGS),dev)
# The one-file versions of rig's tools, one folder per profile, for machines the
# full rig is not going to. Generated from rig as it is, never edited by hand;
# `check` is what selftest runs to catch a kit left behind by a change to rig.
standalone: ## single-file kits [write|check|export DIR] (default write)
bash ctrl/standalone.sh $(or $(ARGS),write)
deps-image: ## build the installer image [full]
# `deps image` is for a machine with nothing but Docker: the installer runs from
# the image instead — see BOOTSTRAP.md. `full` bakes every binary in.
deps: ## install the toolchain [core|dev] [image [full]]
ifeq ($(word 1,$(ARGS)),image)
docker build -f ctrl/Dockerfile.deps \
--target $(if $(filter full,$(ARGS)),deps-full,deps) \
-t $(DEPSIMG):$(if $(filter full,$(ARGS)),full,deps) .
else
bash ctrl/deps.sh install $(or $(ARGS),dev)
endif
# ── cluster ────────────────────────────────────────────────────────────────
# ── the cluster ────────────────────────────────────────────────────────────
# up also starts the registry and installs the profile's addons, and the ports
# derive from the folder name — there is nothing else to run first.
cluster: ## this env + the machine [up|down|reset|list|free]
bash ctrl/cluster.sh $(or $(ARGS),up)
registry: ## registry wiring [up|down|status] (default status)
bash ctrl/registry.sh $(or $(ARGS),status)
addons: ## profile addons [install|list] (default list)
bash ctrl/addons.sh $(or $(ARGS),list)
ports: ## this environment's port block [show|persist]
bash ctrl/ports.sh $(or $(ARGS),show)
# ── docs + dev loop ────────────────────────────────────────────────────────
# ── dev loop + docs ────────────────────────────────────────────────────────
docs: ## documentation [serve|graphs] (default serve)
bash ctrl/docs.sh $(or $(ARGS),serve)
@@ -120,6 +102,20 @@ docs: ## documentation [serve|graphs] (default
tilt: ## dev loop [up|down] (default up)
cd ctrl && tilt $(or $(ARGS),up) $(KCTX) $(if $(filter down,$(ARGS)),,$(if $(TILT_PORT),--port $(TILT_PORT)))
# ── maintaining rig ────────────────────────────────────────────────────────
# The counterpart to check: that one asks about the MACHINE and never fails,
# this one asks about RIG and exits 1. Checks are written as the decisions they
# defend, so a failure names what is being undone.
selftest: ## does rig still do what it says? exits 1 if not
bash ctrl/selftest.sh
# The one-file versions of rig's tools, one folder per profile, for machines the
# full rig is not going to. Generated from rig as it is, never edited by hand;
# `check` is what selftest runs to catch a kit left behind by a change to rig.
standalone: ## single-file kits [write|check|export DIR] (default write)
bash ctrl/standalone.sh $(or $(ARGS),write)
# ── the shape every other project uses ─────────────────────────────────────
# Aliases, not a second implementation: each one calls the same script the
# canonical target does.