Public: anyone can read this; nobody can change it.
seed: versioned packages with a holistic integration spec #127
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
seed/packages-integration-spec → main 5 commits
7 files
changed +210
−7
README.md +5 −2
| @@ -80,8 +80,11 @@ chair). | ||
| 80 | 80 | ## Reproduce it |
| 81 | 81 | |
| 82 | 82 | Your platform can have children: `PLAT_PAT=<forgejo-pat> nix run .#seed` |
| 83 | snapshots it; anyone with the result and this repo grows their **own** sovereign | |
| 84 | platform — fresh keys, fresh secrets, its own identity, lineage recorded. One | |
| 83 | snapshots it (add `PUBLISH=1` to version it into your platform's package | |
| 84 | registry — then `SEED=latest nix run .#up` grows a child with no file to | |
| 85 | carry, integrity-checked against the seed's own integration spec); anyone | |
| 86 | with a seed and this repo grows their **own** sovereign platform — fresh | |
| 87 | keys, fresh secrets, its own identity, lineage recorded. One | |
| 85 | 88 | command puts a platform on **AWS, Azure, or DigitalOcean** — bare VMs, single |
| 86 | 89 | or 3-VM HA, one DNS record to finish: [](deploy/). For any other VPS, a |
| 87 | 90 | tunnel edge, or adding machines: |
bin/germinate +27 −2
| @@ -23,7 +23,10 @@ set -euo pipefail | ||
| 23 | 23 | export GIT_TERMINAL_PROMPT=0 |
| 24 | 24 | source "${MITOSIS_LIB:-$(dirname "$0")/lib.sh}" |
| 25 | 25 | |
| 26 | : "${SEED:?SEED=path-to-seed.tar.gz required}" | |
| 26 | : "${SEED:?SEED=path-to-seed.tar.gz (or latest / r<serial> from the seed package registry) required}" | |
| 27 | if [ ! -f "$SEED" ]; then | |
| 28 | SEED=$(resolve_seed "$SEED") || { echo "FATAL: could not resolve SEED '$SEED'"; exit 1; } | |
| 29 | fi | |
| 27 | 30 | : "${DOMAIN:=plat.local}" # the daughter's sovereign identity (git.$DOMAIN) |
| 28 | 31 | : "${FORGEJO_NS:=forgejo}"; : "${FORGEJO_RELEASE:=forgejo}" |
| 29 | 32 | : "${FORGEJO_USER:=plat}"; : "${FORGEJO_PASSWORD:=platplatplat}"; : "${FORGEJO_EMAIL:[email protected]}" |
| @@ -53,7 +56,18 @@ STEP="startup" | ||
| 53 | 56 | CLUSTER_CTX=$(kubectl config current-context 2>/dev/null || echo '?') |
| 54 | 57 | echo "==> germinate (fork) seed=$SEED domain=$DOMAIN target=$CLUSTER_CTX" |
| 55 | 58 | WORK=$(mktemp -d); PF="" |
| 56 | cleanup(){ [ -n "$PF" ] && kill "$PF" 2>/dev/null || true; rm -rf "$WORK"; } | |
| 59 | # On any failing exit, print the cluster state that explains it. The FATAL | |
| 60 | # paths exit without firing the ERR trap (their failures are ||-handled), so | |
| 61 | # this lives on EXIT — the one hook every path crosses. Three CI runs died at | |
| 62 | # the forgejo handoff with nothing but the FATAL line to autopsy; never again. | |
| 63 | diag(){ | |
| 64 | echo "── cluster state at failure (best-effort) ──" >&2 | |
| 65 | kubectl get pods -A --no-headers --request-timeout=5s 2>/dev/null \ | |
| 66 | | awk '{split($3,a,"/"); if (a[1]!=a[2] || ($4!="Running" && $4!="Completed")) print}' | head -15 >&2 || true | |
| 67 | kubectl get events -A --field-selector type=Warning --sort-by=.lastTimestamp --request-timeout=5s 2>/dev/null | tail -15 >&2 || true | |
| 68 | kubectl get helmrelease,kustomization -A --request-timeout=5s 2>/dev/null | grep -v " True " | head -15 >&2 || true | |
| 69 | } | |
| 70 | cleanup(){ rc=$?; [ "$rc" -ne 0 ] && diag; [ -n "$PF" ] && kill "$PF" 2>/dev/null || true; rm -rf "$WORK"; } | |
| 57 | 71 | trap cleanup EXIT |
| 58 | 72 | # trap ERR — name the failed phase and the honest recovery. germinate is one-shot |
| 59 | 73 | # (it forges fresh keys/passwords each run); there is no partial resume, so the |
| @@ -68,6 +82,12 @@ on_err(){ local rc=$? | ||
| 68 | 82 | } |
| 69 | 83 | trap on_err ERR |
| 70 | 84 | mkdir -p "$WORK/seed"; tar -xzf "$SEED" -C "$WORK/seed" |
| 85 | # v2 seeds are tamper-evident: every bundle must match its manifest sha256, | |
| 86 | # and the manifest's integration block says exactly what this seed builds. | |
| 87 | verify_seed_bundles "$WORK/seed" || exit 1 | |
| 88 | if grep -q '^integration:' "$WORK/seed/manifest.yaml" 2>/dev/null; then | |
| 89 | echo " integrating: $(sed -n '/^integration:/,/^[a-z]/p' "$WORK/seed/manifest.yaml" | sed -n 's/^ \([a-zA-Z]*\): \(.*\)/\1=\2/p' | tr '\n' ' ')" | |
| 90 | fi | |
| 71 | 91 | PROFILE=$(sed -n 's/^profile:[[:space:]]*//p' "$WORK/seed/manifest.yaml") |
| 72 | 92 | RECIP=$(sed -n 's/^sopsRecipient:[[:space:]]*//p' "$WORK/seed/manifest.yaml") |
| 73 | 93 | echo " profile=$PROFILE repos=$(ls "$WORK/seed/repos"|wc -l|tr -d ' ')" |
| @@ -470,6 +490,11 @@ if fork_register_grafana_oauth "$GITOPS_DIR" "$FJ" "$FJA" "$DOMAIN"; then | ||
| 470 | 490 | else |
| 471 | 491 | echo " WARN: Grafana OAuth registration failed — admin login still works; 'Sign in with Forgejo' errors until re-registered" |
| 472 | 492 | fi |
| 493 | ||
| 494 | STEP="register fleet-edge (plat-auth) OAuth app" | |
| 495 | if fork_register_edge_oauth "$GITOPS_DIR" "$FJ" "$FJA" "$DOMAIN"; then | |
| 496 | echo " fleet-edge OAuth app registered (auth.$DOMAIN)" | |
| 497 | fi | |
| 473 | 498 | # Chart tags come from the gitops pins VERBATIM — including pre-release strings |
| 474 | 499 | # ("0.7.6-rc.1"): the daughter's CI must build exactly the version the |
| 475 | 500 | # HelmRelease/OCIRepository pin or Flux never resolves it. Extraction is |
bin/lib.sh +103
| @@ -259,6 +259,71 @@ trim_gitops_lean() { # $1 = path to a working gitops clone | ||
| 259 | 259 | git -C "" -c user.email=mitosis@plat -c user.name=mitosis commit -q -m "mitosis: lean profile (derive from the tree; monitoring+dashboards SHIP; strip flow/legacy-observability + parent apps; keda split; podMonitor ordering-guard off)" || true |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | # ── Seed resolution (packages) ─────────────────────────────────────────────── | |
| 263 | # resolve_seed — turn a SEED value into a local tarball path, echoed on stdout. | |
| 264 | # a readable file -> itself (unchanged behavior) | |
| 265 | # latest | r<serial> -> fetched from the seed package registry: | |
| 266 | # <SEED_REGISTRY>/api/packages/plat/generic/seed/<ver>/ | |
| 267 | # (SEED_REGISTRY defaults to the root forge) | |
| 268 | # Seeds published by bin/seed carry per-bundle sha256 in their manifest; the | |
| 269 | # consumer (germinate) verifies them after extraction. The registry itself | |
| 270 | # authenticates transport; the manifest hashes make the CONTENT tamper-evident. | |
| 271 | resolve_seed() { | |
| 272 | local spec="$1" reg ver files tarball dest | |
| 273 | [ -f "" ] && { printf '%s\n' ""; return 0; } | |
| 274 | case "" in latest|r[0-9]*) ;; *) return 1 ;; esac | |
| 275 | reg="" | |
| 276 | ver="" | |
| 277 | if [ "" = latest ]; then | |
| 278 | ver= | |
| 279 | [ -n "" ] || { echo "resolve_seed: no published seed found at " >&2; return 1; } | |
| 280 | fi | |
| 281 | files= | |
| 282 | [ -n "" ] || { echo "resolve_seed: seed has no tarball at " >&2; return 1; } | |
| 283 | dest="$(mktemp -d)/" | |
| 284 | echo "==> fetching seed from (package plat/seed)" >&2 | |
| 285 | curl -fsS -o "" "/api/packages/plat/generic/seed//" || { echo "resolve_seed: download failed" >&2; return 1; } | |
| 286 | printf '%s\n' "" | |
| 287 | } | |
| 288 | ||
| 289 | # publish_seed — upload a built seed (tarball + its inner manifest, readable | |
| 290 | # standalone) as the generic package plat/seed/<version>. Publishing is a | |
| 291 | # SEPARATE verb from building so reseed can verify a candidate by germinating | |
| 292 | # it BEFORE anything reaches the registry — the registry only ever serves | |
| 293 | # seeds that passed their gate. $1 = tarball $2 = version (needs PLAT_PAT) | |
| 294 | publish_seed() { | |
| 295 | local tarball="$1" ver="$2" forge="" | |
| 296 | local user="" pkg t code f dst | |
| 297 | : "" | |
| 298 | pkg="/api/packages/plat/generic/seed/" | |
| 299 | t= | |
| 300 | tar -xzf "" -C "" ./manifest.yaml 2>/dev/null || tar -xzf "" -C "" manifest.yaml | |
| 301 | for f in ":$(basename "")" "/manifest.yaml:manifest.yaml"; do | |
| 302 | dst="" | |
| 303 | code= | |
| 304 | case "" in | |
| 305 | 201) echo " published -> /" ;; | |
| 306 | 409) echo "FATAL: seed version already published"; rm -rf ""; return 1 ;; | |
| 307 | *) echo "FATAL: seed package upload of failed (HTTP )"; rm -rf ""; return 1 ;; | |
| 308 | esac | |
| 309 | done | |
| 310 | rm -rf "" | |
| 311 | echo " fetch: SEED= nix run .#up (or SEED=latest)" | |
| 312 | } | |
| 313 | ||
| 314 | # verify_seed_bundles — for a mitosisVersion>=2 extracted seed, check every | |
| 315 | # bundle against the sha256 its manifest records. $1 = extracted seed dir. | |
| 316 | # A v1 seed (no hashes) passes untouched; a MISMATCH is fatal to the caller. | |
| 317 | verify_seed_bundles() { | |
| 318 | local dir="$1" f h | |
| 319 | grep -q '^mitosisVersion: *[2-9]' "/manifest.yaml" 2>/dev/null || return 0 | |
| 320 | for f in ""/repos/*.bundle; do | |
| 321 | h= | |
| 322 | grep -q "sha256: " "/manifest.yaml" || { echo "FATAL: seed bundle $(basename "") does not match its manifest sha256 — refusing a tampered/corrupt seed" >&2; return 1; } | |
| 323 | done | |
| 324 | echo " seed integrity: every bundle matches its manifest sha256" | |
| 325 | } | |
| 326 | ||
| 262 | 327 | # publish_wiki — materialize the in-repo wiki/ source as the NATIVE Forgejo wiki |
| 263 | 328 | # of <owner>/mitosis. The wiki is documentation-as-an-organ: it ships inside the |
| 264 | 329 | # mitosis repo (reviewable, versioned with the code it documents), and every |
| @@ -520,6 +585,19 @@ EOF | ||
| 520 | 585 | # CA fields are filled post-Forgejo via fork_postforgejo_secrets/_register_oauth/ |
| 521 | 586 | # _seal_ca. We seal a manifest carrying every key so later `sops set` only mutates |
| 522 | 587 | # existing paths. GITOPS_REMOTE embeds the fresh admin password (in-cluster URL). |
| 588 | # forwardAuth edge (fleet-edge, gitops ≥ r187): OAuth pair is registered | |
| 589 | # post-Forgejo (fork_register_edge_oauth); PLAT_PAT here is the "user:token" | |
| 590 | # Basic form auth-service expects, minted with the daughter PAT in | |
| 591 | # fork_postforgejo_secrets. Placeholders keep the manifest decryptable NOW — | |
| 592 | # an unsealed leftover parent secret is exactly what kills a fork's Flux. | |
| 593 | if [ -f "//mcp/plat-auth-secrets.yaml" ]; then | |
| 594 | _fork_seal "" "/mcp/plat-auth-secrets.yaml" plat-auth-secrets mcp "" << | |
| 595 | PLAT_AUTH_OAUTH_CLIENT_ID: pending-registration | |
| 596 | PLAT_AUTH_OAUTH_CLIENT_SECRET: pending-registration | |
| 597 | PLAT_PAT: PLACEHOLDER | |
| 598 | ||
| 599 | fi | |
| 600 | ||
| 523 | 601 | _fork_seal "" "/mcp/plat-mcp-secrets.yaml" plat-mcp-secrets mcp "" << |
| 524 | 602 | MCP_BEARER_TOKEN: |
| 525 | 603 | MCP_SESSION_KEY: |
| @@ -659,6 +737,10 @@ fork_postforgejo_secrets() { | ||
| 659 | 737 | dcj= |
| 660 | 738 | sops set "" '["stringData"][".dockerconfigjson"]' "$(printf '%s' "" | jq -Rs .)" |
| 661 | 739 | fi |
| 740 | # forwardAuth edge: auth-service builds its Forgejo probe as Basic | |
| 741 | # base64($PLAT_PAT) expecting "user:token" — this override is that form. | |
| 742 | local pas="$1/clusters/local/platform/mcp/plat-auth-secrets.yaml" | |
| 743 | [ -f "" ] && sops set "" '["stringData"]["PLAT_PAT"]' "\"plat:\"" | |
| 662 | 744 | # Agents dispatcher PLAT_TOKEN — the daughter's fresh PAT (the regen'd placeholder). |
| 663 | 745 | # Same DPAT germinate mints with admin scopes, so the dispatcher self-registers |
| 664 | 746 | # the system webhook (POST /admin/hooks) and self-provisions the QA user (POST |
| @@ -689,6 +771,27 @@ fork_register_oauth() { # $1=gitops $2=forgejo_url $3=basicauth $4=DOMAIN | ||
| 689 | 771 | git -C "" -c user.email=mitosis@plat -c user.name=mitosis commit -aqm "mitosis fork: plat-mcp OAuth client ()" || true |
| 690 | 772 | } |
| 691 | 773 | |
| 774 | # fork_register_edge_oauth — register the fleet edge's 'plat-auth' OAuth app on | |
| 775 | # the DAUGHTER Forgejo (redirect https://auth.<domain>/callback) and seal the | |
| 776 | # pair into plat-auth-secrets. No-op when the seed predates the fleet edge. | |
| 777 | fork_register_edge_oauth() { # $1=gitops $2=forgejo_url $3=basicauth $4=DOMAIN | |
| 778 | local g="$1" fj="$2" auth="$3" dom="$4" | |
| 779 | local pas="$1/clusters/local/platform/mcp/plat-auth-secrets.yaml" resp cid csec | |
| 780 | [ -f "" ] || return 0 | |
| 781 | resp= | |
| 782 | -d "{\"name\":\"plat-auth\",\"redirect_uris\":[\"https://auth./callback\"],\"confidential_client\":true}" \ | |
| 783 | "/api/v1/user/applications/oauth2" 2>/dev/null) || true | |
| 784 | cid= | |
| 785 | csec= | |
| 786 | if [ -z "" ] || [ -z "" ]; then | |
| 787 | echo " WARN: plat-auth OAuth registration failed — the fleet edge will 503 until registered by hand" >&2 | |
| 788 | return 1 | |
| 789 | fi | |
| 790 | sops set "" '["stringData"]["PLAT_AUTH_OAUTH_CLIENT_ID"]' "\"\"" | |
| 791 | sops set "" '["stringData"]["PLAT_AUTH_OAUTH_CLIENT_SECRET"]' "\"\"" | |
| 792 | git -C "" -c user.email=mitosis@plat -c user.name=mitosis commit -aqm "mitosis fork: fleet-edge (plat-auth) OAuth registered" || true | |
| 793 | } | |
| 794 | ||
| 692 | 795 | # fork_register_grafana_oauth — register the daughter's own Grafana OAuth app on |
| 693 | 796 | # its Forgejo and sops-set the client id/secret into grafana-oauth (replacing the |
| 694 | 797 | # pending-registration placeholders fork_regen_secrets sealed). Mirrors |
bin/seed +47 −2
| @@ -12,6 +12,17 @@ export GIT_TERMINAL_PROMPT=0 | ||
| 12 | 12 | : "${PROFILE:=lean}" # lean | full |
| 13 | 13 | : "${PLAT_PAT:?PLAT_PAT required (source Forgejo PAT with repo read)}" |
| 14 | 14 | : "${OUT:=seed-$(date +%Y%m%d-%H%M%S)-${PROFILE}.tar.gz}" |
| 15 | # PUBLISH=1 uploads the seed (tarball + its manifest, separately readable) to | |
| 16 | # the platform's own package registry as a GENERIC package — seeds become | |
| 17 | # versioned, fetchable artifacts instead of blobs a repo has to carry: | |
| 18 | # <forge>/api/packages/plat/generic/seed/<version>/<files> | |
| 19 | # `up`/`germinate` resolve SEED=latest or SEED=r<serial> from there (lib.sh | |
| 20 | # resolve_seed). The genesis/ blob remains the air-gap fallback. | |
| 21 | : "${PUBLISH:=0}" | |
| 22 | : "${SEED_VERSION:=r$(date -u +%Y%m%d%H%M%S)}" | |
| 23 | ||
| 24 | # sha256 of a file, portable (coreutils sha256sum on runners/nix, shasum on mac). | |
| 25 | _sha256(){ sha256sum "$1" 2>/dev/null | cut -d' ' -f1 || shasum -a 256 "$1" | cut -d' ' -f1; } | |
| 15 | 26 | |
| 16 | 27 | # System repos = the platform genome (always seeded). mitosis itself rides along |
| 17 | 28 | # so daughters can spawn in turn. ci-builder is the job-container toolchain |
| @@ -75,8 +86,9 @@ seed_squash_main(){ | ||
| 75 | 86 | git -C "$bare" update-ref "refs/heads/$FLUX_BRANCH" "$c" |
| 76 | 87 | git -C "$bare" symbolic-ref HEAD "refs/heads/$FLUX_BRANCH" |
| 77 | 88 | } |
| 78 | echo "==> mitosis seed profile=$PROFILE out=$OUT domain=${SEED_DOMAIN:-?}" | |
| 79 | { echo "mitosisVersion: 1"; echo "profile: $PROFILE"; echo "createdFrom: $CREATED_FROM"; | |
| 89 | echo "==> mitosis seed profile=$PROFILE out=$OUT domain=${SEED_DOMAIN:-?} version=$SEED_VERSION" | |
| 90 | { echo "mitosisVersion: 2"; echo "seedVersion: $SEED_VERSION"; | |
| 91 | echo "profile: $PROFILE"; echo "createdFrom: $CREATED_FROM"; | |
| 80 | 92 | echo "domain: ${SEED_DOMAIN:-UNKNOWN}"; |
| 81 | 93 | echo "sopsRecipient: ${SOPS_RECIPIENT:-UNKNOWN}"; echo "repos:"; } > "$WORK/seed/manifest.yaml" |
| 82 | 94 | # yq-free JSON string escaper for manifest values (description/website may carry |
| @@ -125,10 +137,43 @@ for r in $REPOS; do | ||
| 125 | 137 | | jq -r '(.topics // []) | join(",")' 2>/dev/null || echo "") |
| 126 | 138 | { |
| 127 | 139 | printf ' - owner: %s\n name: %s\n ref: %s\n tags: "%s"\n' "$owner" "$name" "$ref" "$tags" |
| 140 | printf ' sha256: %s\n' "$(_sha256 "$WORK/seed/repos/${owner}__${name}.bundle")" | |
| 128 | 141 | printf ' description: %s\n' "$(yqstr "$desc")" |
| 129 | 142 | printf ' website: %s\n' "$(yqstr "$website")" |
| 130 | 143 | printf ' topics: "%s"\n' "$topics" |
| 131 | 144 | } >> "$WORK/seed/manifest.yaml" |
| 132 | 145 | done |
| 146 | ||
| 147 | # ── The holistic integration block ─────────────────────────────────────────── | |
| 148 | # One spec describes everything this seed integrates: the platform versions the | |
| 149 | # gitops tree pins (what the daughter will build through its own CI), the | |
| 150 | # toolchain floor, and the acceptance gate the shape is validated by. Read from | |
| 151 | # the SQUASHED gitops bundle itself so the spec can never drift from the tree | |
| 152 | # it ships. Extraction is best-effort ("UNKNOWN" over a dead seed build). | |
| 153 | g(){ git -C "$WORK/gitops.git" show "HEAD:$1" 2>/dev/null || true; } | |
| 154 | # `|| true` on every extraction: pipefail + `head -1` means an early close | |
| 155 | # SIGPIPEs the producer and set -e would kill the whole seed silently. | |
| 156 | MCP_TAG=$(g clusters/local/platform/mcp/ocirepository.yaml | sed -n 's/^[[:space:]]*tag:[[:space:]]*"\{0,1\}\([0-9][^"]*\)"\{0,1\}/\1/p' | head -1 || true) | |
| 157 | AGENTS_TAG=$(g clusters/local/platform/agents/helmrelease.yaml | sed -n 's/^[[:space:]]*tag:[[:space:]]*"\{0,1\}\([0-9][^"]*\)"\{0,1\}/\1/p' | head -1 || true) | |
| 158 | CIR_TAG=$(g clusters/local/platform/forgejo/runner-isolated.yaml | grep -ohE 'ci-runner:[0-9]+\.[0-9]+\.[0-9]+' | head -1 | sed 's/.*://' || true) | |
| 159 | [ -n "$CIR_TAG" ] || CIR_TAG=$(for f in $(git -C "$WORK/gitops.git" ls-tree -r --name-only HEAD -- clusters/local/platform/forgejo/ 2>/dev/null); do g "$f"; done | grep -ohE 'ci-runner:[0-9]+\.[0-9]+\.[0-9]+' | head -1 | sed 's/.*://' || true) | |
| 160 | K3S_PIN=$(sed -n 's/.*K3S_IMAGE:=rancher\/k3s:\(v[^}]*\)}.*/\1/p' "$(dirname "$0")/up" 2>/dev/null | head -1 || true) | |
| 161 | { | |
| 162 | echo "integration:" | |
| 163 | echo " mcp: ${MCP_TAG:-UNKNOWN}" | |
| 164 | echo " agents: ${AGENTS_TAG:-UNKNOWN}" | |
| 165 | echo " ciRunner: ${CIR_TAG:-UNKNOWN}" | |
| 166 | echo " k3s: ${K3S_PIN:-UNKNOWN}" | |
| 167 | echo " fluxMin: 2.6.0" | |
| 168 | echo "gate: scripts/coldstart-assert.sh (A1-A11; nightly adds E1-E8)" | |
| 169 | } >> "$WORK/seed/manifest.yaml" | |
| 170 | ||
| 133 | 171 | tar -czf "$OUT" -C "$WORK/seed" . |
| 134 | 172 | echo "==> wrote $OUT ($(du -h "$OUT" | cut -f1)). manifest:"; sed 's/^/ /' "$WORK/seed/manifest.yaml" |
| 173 | ||
| 174 | if [ "$PUBLISH" = "1" ]; then | |
| 175 | echo "==> publishing seed package $SEED_VERSION" | |
| 176 | # shellcheck disable=SC1091 | |
| 177 | . "${MITOSIS_LIB:-$(dirname "$0")/lib.sh}" | |
| 178 | publish_seed "$OUT" "$SEED_VERSION" | |
| 179 | fi |
bin/up +9
| @@ -35,6 +35,15 @@ done | ||
| 35 | 35 | : "${HTTPS_PORT:=443}" # host port -> traefik :443 (so git.$DOMAIN works via /etc/hosts) |
| 36 | 36 | : "${SEED:=}" |
| 37 | 37 | |
| 38 | # A SEED of `latest` or r<serial> resolves from the platform's seed package | |
| 39 | # registry (bin/seed PUBLISH=1 puts it there; SEED_REGISTRY overrides the | |
| 40 | # forge). Files and the bundled genesis artifact behave exactly as before. | |
| 41 | if [ -n "$SEED" ] && [ ! -f "$SEED" ]; then | |
| 42 | # shellcheck disable=SC1090 | |
| 43 | . "${MITOSIS_LIB:-$HERE/lib.sh}" | |
| 44 | SEED=$(resolve_seed "$SEED") || { echo "up: could not resolve SEED" >&2; exit 1; } | |
| 45 | fi | |
| 46 | ||
| 38 | 47 | # Locate the seed: explicit SEED wins, else the flake-bundled genesis artifact |
| 39 | 48 | # (MITOSIS_GENESIS, set by the flake wrapper when genesis/ rode along), else a |
| 40 | 49 | # genesis/ or newest seed*.tar.gz beside the source or in the CWD you ran from. |
scripts/reseed-run.sh +9
| @@ -26,6 +26,15 @@ if [ -f genesis/seed.tar.gz ] && [ "$(refs "$PWD/seed-new.tar.gz")" = "$(refs ge | ||
| 26 | 26 | exit 0 |
| 27 | 27 | fi |
| 28 | 28 | |
| 29 | # The candidate germinated clean (reseed-verify above) — NOW it may reach the | |
| 30 | # registry: publish the verified tarball as the versioned seed package, so | |
| 31 | # `SEED=latest` always resolves to a gate-passed seed. Failure here is fatal: | |
| 32 | # a reseed whose package half went missing would leave the registry stale | |
| 33 | # while the PR advances the blob. | |
| 34 | # shellcheck disable=SC1091 | |
| 35 | . bin/lib.sh | |
| 36 | publish_seed "/seed-new.tar.gz" "r" | |
| 37 | ||
| 29 | 38 | B="reseed/r" |
| 30 | 39 | git checkout -q -b "" |
| 31 | 40 | mv seed-new.tar.gz genesis/seed.tar.gz |
wiki/Grow-Your-Own-Platform.md +10 −1
| @@ -57,7 +57,16 @@ From a checkout against your running platform, run: | ||
| 57 | 57 | PLAT_PAT=<a Forgejo PAT with repo read> nix run .#seed |
| 58 | 58 | |
| 59 | 59 | |
| 60 | This writes `seed-<timestamp>-lean.tar.gz` and prints its manifest. The seed is git bundles plus a manifest. It carries no age key, so it leaks nothing usable. Hand the seed and this repo to anyone. They run `nix run .#up` and get a platform with a brand-new encryption key and freshly minted secrets. It shares nothing with yours. `PROFILE=full` additionally bundles your app repos. | |
| 60 | This writes `seed-<timestamp>-lean.tar.gz` and prints its manifest — a **holistic integration spec**: every bundled repo with its commit and sha256, plus the platform versions the seed integrates (mcp, agents, the CI runner, the k3s and Flux floor) and the acceptance gate that shape answers to. The seed carries no age key, so it leaks nothing usable. `PROFILE=full` additionally bundles your app repos. | |
| 61 | ||
| 62 | Seeds are also **published artifacts**. `PUBLISH=1` uploads the tarball and its spec to your platform's own package registry (`plat/seed`, a generic package), and anyone growing a child resolves one by version instead of carrying a file: | |
| 63 | ||
| 64 | bash | |
| 65 | SEED=latest nix run .#up # newest published seed | |
| 66 | SEED=r20260814120000 nix run .#up # or an exact version | |
| 67 | ||
| 68 | ||
| 69 | Germination verifies every bundle against the spec's sha256 before it builds — a tampered or corrupt seed refuses loudly. The manifest is fetchable on its own (`…/api/packages/plat/generic/seed/<version>/manifest.yaml`), so you can read exactly what a seed integrates before downloading it. The nightly reseed publishes a fresh version only after germinating it clean — the registry only ever serves gate-passed seeds. A seed file handed over on a USB stick still works exactly as before; the registry is distribution, not a dependency. | |
| 61 | 70 | |
| 62 | 71 | ## Grow one on a cloud |
| 63 | 72 |
new above
offline