@rizom/ops 0.2.0-alpha.6 → 0.2.0-alpha.600
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -4
- package/dist/age-key-bootstrap.d.ts +17 -0
- package/dist/brains-ops.js +790 -166
- package/dist/capability-bundle-migration.d.ts +22 -0
- package/dist/cert-bootstrap.d.ts +6 -4
- package/dist/content-repo-ref.d.ts +10 -0
- package/dist/content-repo.d.ts +13 -0
- package/dist/default-user-runner.d.ts +1 -1
- package/dist/deploy.js +110 -166
- package/dist/directory-sync-stress-system.d.ts +75 -0
- package/dist/directory-sync-stress.d.ts +117 -0
- package/dist/entries/deploy.d.ts +4 -2
- package/dist/health-watchdog-smoke.d.ts +54 -0
- package/dist/image-inventory.d.ts +4 -0
- package/dist/image-types.d.ts +7 -0
- package/dist/images.d.ts +89 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +802 -166
- package/dist/legacy-pilot-migration.d.ts +11 -0
- package/dist/legacy-projection-job-recovery.d.ts +29 -0
- package/dist/load-registry.d.ts +88 -6
- package/dist/observed-status.d.ts +1 -1
- package/dist/onboard-user.d.ts +2 -2
- package/dist/parse-args.d.ts +2 -10
- package/dist/preview-domain.d.ts +9 -0
- package/dist/reconcile-all.d.ts +2 -2
- package/dist/reconcile-cohort.d.ts +2 -2
- package/dist/reconcile-dry-run.d.ts +9 -0
- package/dist/reconcile-lib.d.ts +4 -2
- package/dist/run-command.d.ts +22 -6
- package/dist/runtime-image-lock.d.ts +12 -0
- package/dist/schema.d.ts +147 -69
- package/dist/secrets-encrypt.d.ts +26 -0
- package/dist/secrets-push.d.ts +2 -2
- package/dist/ssh-key-bootstrap.d.ts +1 -26
- package/dist/stage-legacy-crossover.d.ts +25 -0
- package/dist/stress-command.d.ts +14 -0
- package/dist/stress-git-checkout.d.ts +21 -0
- package/dist/stress-health-monitor.d.ts +46 -0
- package/dist/upgrade.d.ts +10 -0
- package/dist/user-add.d.ts +16 -0
- package/dist/user-offboard.d.ts +61 -0
- package/dist/user-runner.d.ts +5 -0
- package/dist/verify-user.d.ts +22 -0
- package/package.json +51 -40
- package/templates/rover-pilot/.env.schema +28 -2
- package/templates/rover-pilot/.github/actions/varlock-env/action.yml +47 -0
- package/templates/rover-pilot/.github/workflows/build.yml +72 -17
- package/templates/rover-pilot/.github/workflows/deploy.yml +118 -49
- package/templates/rover-pilot/.github/workflows/directory-sync-stress.yml +119 -0
- package/templates/rover-pilot/.github/workflows/health-watchdog-smoke.yml +95 -0
- package/templates/rover-pilot/.github/workflows/offboard.yml +107 -0
- package/templates/rover-pilot/.github/workflows/reconcile.yml +23 -3
- package/templates/rover-pilot/.github/workflows/upgrade.yml +104 -0
- package/templates/rover-pilot/README.md +19 -8
- package/templates/rover-pilot/deploy/scripts/create-predeploy-backup.ts +948 -0
- package/templates/rover-pilot/deploy/scripts/decrypt-user-secrets.ts +139 -0
- package/templates/rover-pilot/deploy/scripts/helpers.ts +3 -0
- package/templates/rover-pilot/deploy/scripts/install-health-watchdog.ts +144 -0
- package/templates/rover-pilot/deploy/scripts/provision-server.ts +52 -22
- package/templates/rover-pilot/deploy/scripts/resolve-deploy-handles.ts +19 -4
- package/templates/rover-pilot/deploy/scripts/resolve-missing-images.ts +13 -0
- package/templates/rover-pilot/deploy/scripts/resolve-user-config.ts +56 -14
- package/templates/rover-pilot/deploy/scripts/sync-content-repo.ts +183 -0
- package/templates/rover-pilot/deploy/scripts/update-dns.ts +72 -16
- package/templates/rover-pilot/deploy/scripts/validate-secrets.ts +12 -1
- package/templates/rover-pilot/deploy/scripts/verify-runtime-image.ts +18 -0
- package/templates/rover-pilot/docs/canonical-crossover-record.md +107 -0
- package/templates/rover-pilot/docs/onboarding-checklist.md +39 -13
- package/templates/rover-pilot/docs/operator-playbook.md +421 -22
- package/templates/rover-pilot/docs/user-onboarding.md +90 -0
- package/templates/rover-pilot/package.json +4 -0
- package/templates/rover-pilot/pilot.yaml +9 -3
- package/templates/rover-pilot/users/alice.yaml +5 -1
- package/dist/origin-ca.d.ts +0 -1
- package/dist/push-secrets.d.ts +0 -9
- package/dist/push-target.d.ts +0 -2
- package/dist/run-subprocess.d.ts +0 -5
- package/dist/user-secret-names.d.ts +0 -6
- package/templates/rover-pilot/.kamal/hooks/pre-deploy +0 -9
- package/templates/rover-pilot/deploy/Dockerfile +0 -15
- package/templates/rover-pilot/deploy/kamal/deploy.yml +0 -39
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
name: Upgrade
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: Explicit @rizom/ops version (empty means latest)
|
|
8
|
+
required: false
|
|
9
|
+
type: string
|
|
10
|
+
schedule:
|
|
11
|
+
# Weekday morning check for new operator tooling releases.
|
|
12
|
+
- cron: "17 6 * * 1-5"
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: upgrade
|
|
19
|
+
cancel-in-progress: false
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
upgrade:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
# Check only presence here; the private key itself is never exposed to
|
|
26
|
+
# this step. A missing private-key secret fails before checkout.
|
|
27
|
+
- name: Require upgrade App configuration
|
|
28
|
+
env:
|
|
29
|
+
APP_ID: ${{ vars.OPS_UPGRADE_APP_ID }}
|
|
30
|
+
HAS_PRIVATE_KEY: ${{ secrets.OPS_UPGRADE_APP_PRIVATE_KEY != '' }}
|
|
31
|
+
run: |
|
|
32
|
+
missing=""
|
|
33
|
+
if [ -z "$APP_ID" ]; then
|
|
34
|
+
missing="OPS_UPGRADE_APP_ID"
|
|
35
|
+
fi
|
|
36
|
+
if [ "$HAS_PRIVATE_KEY" != "true" ]; then
|
|
37
|
+
missing="${missing:+$missing and }OPS_UPGRADE_APP_PRIVATE_KEY"
|
|
38
|
+
fi
|
|
39
|
+
if [ -n "$missing" ]; then
|
|
40
|
+
echo "$missing is not set for this repository." >&2
|
|
41
|
+
echo "Configure the upgrade GitHub App as described in docs/operator-playbook.md." >&2
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# No credential is persisted in .git/config while the workflow installs
|
|
46
|
+
# and executes a freshly published @rizom/ops package.
|
|
47
|
+
- uses: actions/checkout@v5
|
|
48
|
+
with:
|
|
49
|
+
persist-credentials: false
|
|
50
|
+
|
|
51
|
+
- uses: oven-sh/setup-bun@v2
|
|
52
|
+
|
|
53
|
+
- name: Install operator tooling
|
|
54
|
+
run: bun install
|
|
55
|
+
|
|
56
|
+
- name: Upgrade operator tooling
|
|
57
|
+
env:
|
|
58
|
+
VERSION_INPUT: ${{ inputs.version }}
|
|
59
|
+
run: bunx brains-ops upgrade . --to "${VERSION_INPUT:-latest}"
|
|
60
|
+
|
|
61
|
+
- name: Detect upgrade changes
|
|
62
|
+
id: upgrade-changes
|
|
63
|
+
run: |
|
|
64
|
+
if [ -z "$(git status --porcelain)" ]; then
|
|
65
|
+
echo "Already up to date."
|
|
66
|
+
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
67
|
+
else
|
|
68
|
+
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
- name: Create repository-scoped upgrade token
|
|
72
|
+
if: steps.upgrade-changes.outputs.changed == 'true'
|
|
73
|
+
id: upgrade-token
|
|
74
|
+
uses: actions/create-github-app-token@v2
|
|
75
|
+
with:
|
|
76
|
+
app-id: ${{ vars.OPS_UPGRADE_APP_ID }}
|
|
77
|
+
private-key: ${{ secrets.OPS_UPGRADE_APP_PRIVATE_KEY }}
|
|
78
|
+
permission-contents: write
|
|
79
|
+
permission-pull-requests: write
|
|
80
|
+
permission-workflows: write
|
|
81
|
+
|
|
82
|
+
- name: Open upgrade PR
|
|
83
|
+
if: steps.upgrade-changes.outputs.changed == 'true'
|
|
84
|
+
env:
|
|
85
|
+
GH_TOKEN: ${{ steps.upgrade-token.outputs.token }}
|
|
86
|
+
run: |
|
|
87
|
+
VERSION=$(bun -e 'console.log(JSON.parse(await Bun.file("package.json").text()).devDependencies["@rizom/ops"])')
|
|
88
|
+
BRANCH="ops/upgrade-rizom-ops-$VERSION"
|
|
89
|
+
git config user.name "github-actions[bot]"
|
|
90
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
91
|
+
git checkout -B "$BRANCH"
|
|
92
|
+
git add -A
|
|
93
|
+
git commit -m "chore(ops): upgrade @rizom/ops to $VERSION"
|
|
94
|
+
git push --force \
|
|
95
|
+
"https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
|
|
96
|
+
"$BRANCH"
|
|
97
|
+
if [ -n "$(gh pr list --head "$BRANCH" --state open --json number --jq '.[].number')" ]; then
|
|
98
|
+
echo "PR already open for $BRANCH"
|
|
99
|
+
exit 0
|
|
100
|
+
fi
|
|
101
|
+
gh pr create \
|
|
102
|
+
--title "chore(ops): upgrade @rizom/ops to $VERSION" \
|
|
103
|
+
--body "Automated operator tooling upgrade. Review the scaffold diff, then merge; deploys stay operator-dispatched." \
|
|
104
|
+
--head "$BRANCH"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# private brain pilot
|
|
2
2
|
|
|
3
|
-
Private desired-state
|
|
3
|
+
Private desired-state repository for the hosted brain pilot. The generated repository/service name may remain `rover-pilot` for deployment identity compatibility.
|
|
4
4
|
|
|
5
5
|
This is a single operator-owned repo. Pilot users do not get their own brain repos.
|
|
6
6
|
Per-user deploy config lives under `users/<handle>/`, while content stays in per-user content repos.
|
|
@@ -29,17 +29,28 @@ The repo also checks in its deploy contract:
|
|
|
29
29
|
- `.github/workflows/*`
|
|
30
30
|
|
|
31
31
|
`.env.schema` is the single source of truth for required and sensitive deploy vars.
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
Use separate GitHub tokens: `CONTENT_REPO_ADMIN_TOKEN` for operator-side content repo creation/checks, and `GIT_SYNC_TOKEN` for runtime directory-sync git access.
|
|
33
|
+
The fleet publishes one immutable image per effective Brain version and site pin set: `brain-${brainVersion}` for instances without a site override, `brain-${brainVersion}--<pins>--s<digest>` for instances with one (sorted readable pins plus an exact-identity digest; long names omit the readable pins). Pinned images use new immutable tags after this format change; existing registry tags must not be overwritten. Instances with the same version and pins share an image; a site's pin change builds that site's image and no other, and smoke-to-fleet promotion reuses the tested image because its name already carries its pins. Build and Deploy verify installed package versions against an image's name before reusing it.
|
|
34
|
+
When an effective brain version (`pilot.yaml.brainVersion`, or a cohort override) or a site pin changes and you push, CI builds every missing image, refreshes generated user env files (an instance with site pins names its image there as `IMAGE_TAG`), and redeploys affected users. Every external site and theme package keeps its own exact version pin. Published tags remain immutable: a new pin set is a new tag.
|
|
34
35
|
When a push changes only deploy contract files, CI prints `No affected user configs; skipping deploy.` and stops before Kamal.
|
|
35
36
|
|
|
36
37
|
## Commands
|
|
37
38
|
|
|
38
39
|
- `brains-ops init <repo>`
|
|
39
|
-
- `brains-ops
|
|
40
|
-
- `brains-ops
|
|
40
|
+
- `brains-ops upgrade <repo>` — bumps `@rizom/ops` (or `--to <version>`) and refreshes the generated scaffold; the Upgrade workflow runs this on a schedule and opens a PR
|
|
41
|
+
- `brains-ops render <repo>` — regenerates `views/users.md` with live DNS, `/health/ready`, and unauthenticated `/mcp` status checks
|
|
42
|
+
- `brains-ops user:add <repo> <handle> --cohort <cohort> [--discord] [--anchor-id <id>]` — scaffolds a browser-chat-first user with Discord disabled by default; use `--discord` to include Discord config and its per-user secret
|
|
43
|
+
- `brains-ops onboard <repo> <handle>` — creates/seeds the user's content repo with separate admin and sync tokens
|
|
44
|
+
- `brains-ops age-key:bootstrap <repo>`
|
|
41
45
|
- `brains-ops ssh-key:bootstrap <repo>`
|
|
42
|
-
- `brains-ops cert:bootstrap <repo
|
|
43
|
-
- `brains-ops secrets:
|
|
46
|
+
- `brains-ops cert:bootstrap <repo>`
|
|
47
|
+
- `brains-ops secrets:encrypt <repo> <handle>`
|
|
44
48
|
- `brains-ops reconcile-cohort <repo> <cohort>`
|
|
45
49
|
- `brains-ops reconcile-all <repo>`
|
|
50
|
+
- `brains-ops reconcile-all <repo> --dry-run` (isolated, no external content-repository access; lists both passes' changed files)
|
|
51
|
+
|
|
52
|
+
`render` owns the observational `views/users.md` projection. Reconcile owns generated per-user config and never rewrites observed status rows.
|
|
53
|
+
|
|
54
|
+
The Upgrade workflow uses a repository-scoped GitHub App token because an Actions `GITHUB_TOKEN` cannot update generated files under `.github/workflows/`. Checkout persists no credential, and the App token is minted only after the freshly published tooling finishes and only when there is a change to push. Configure the App and its `OPS_UPGRADE_APP_ID` Actions variable and `OPS_UPGRADE_APP_PRIVATE_KEY` Actions secret as described in `docs/operator-playbook.md`. If token creation or the upgrade push fails, stop; do not substitute an operator's personal credentials.
|
|
55
|
+
|
|
56
|
+
Use `docs/canonical-crossover-record.md` to record exact forward and rollback artifact pins before an approved crossover window.
|