docs/ops: deployment bootstrap runbook — service order, seed data, grant blessings, and required scopes (for an autonomous bootstrap)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 43/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- devops, documentation
調査の方向性
Read campus/docs/prod-rollout.md, campus/docs/required-env-vars.md, and docs/circles-access-control.md for the existing deployment and grant procedures. Validate the bootstrap order and verification checklist against those references, then create the docs runbook described in the follow-up; done means it provides a consistent, actionable sequence for deployment, seed data, blessings, scopes, and verification.
索引モデルが issue の本文から書いたものです。
説明
Why now
The 2026-11-19 login outage (every sign-in on both deployments 500ed) was a bootstrap prerequisite nobody had written down in one place: /login requested a scope (users:read, added in 4946d91) that the portal client's allowed_scopes cap didn't cover, and campus.auth validates that request all-or-nothing. The recovery knowledge was scattered across the README, campus/docs/prod-rollout.md, docs/circles-access-control.md, a commit message, and live debugging. This issue collects the full bootstrap sequence — deployment order, seed data, grant blessings, scopes — so an autonomous (or merely sane) bootstrap can succeed. Fixes so far: today's cap repair + PR #82 (baseline-only login + step-up), but the runbook itself is the missing artifact.
1. Deployment order (what must exist first)
Each layer depends on the previous; the campus-side mechanics live in campus/docs/prod-rollout.md (§3 staggered sequence) and campus/docs/required-env-vars.md (boot-enforced in prod, #1108):
- Data stores — Postgres (auth/api/audit) + Mongo (auth/api) + object bucket. Credentials in the creation payload — a volume attach before credentials land poisons the datadir (postgres needs
databasePasswordReset, mongo full recreation; campus#1105). Verify connectivity via a temporary tcp-proxy before wiring app URIs. - campus.audit — its operator API key (
AUDIT_OPERATOR_API_KEY) auto-seeds at audit startup; every other service'sAUDIT_API_KEY(traces:write) and the portal'sAUDIT_UI_API_KEY(traces:read + apikeys:read + apikeys:write) are minted from that operator key afterwards. So audit before all trace producers. - campus.auth — the identity fabric. Needs
AUTH_SUPER_ADMIN(master admin),AUTH_OPERATOR_CLIENT_IDS(operator clients — on prod this is literally the portal client,campus-admin-production/ uid-client-6ec13381),WORKSPACE_DOMAIN, and the Google OAuth app + vault label behind/google/authorize. - campus.api — circles, grant store, resources. Its
init_storagebootstrap is idempotent and seeds the circles graph (below); prod runs schema + seed via the one-off (ENV=developmentfor the process only) + migration-ledger stamping perTARGET_DB(campus#1103 / #1104). - Gateway (dev
campus-development, prodnyjc-campus) fronting the services. Known failure mode: the dev gateway's auth/api/audit upstreams can flap 502 — consumers should set per-service URL overrides (CAMPUS_AUTH_URL/CAMPUS_API_URL/CAMPUS_AUDIT_URL) as the fallback rather than ridingBASE_URL(this bit the dev portal on 2026-11-19 too). - Consumer apps — campus-admin portal, classroom, etc.
2. Seed data (what must exist before anything signs in)
Circles graph (CirclesResource.init_storage(), idempotent, per docs/circles-access-control.md §Bootstrap): the @meta record, root circle, the campus-admin sentinel (the portal's default ADMIN_CIRCLE), bootstrap admins' user circles (BOOTSTRAP_ADMIN_USERS: [email protected] + [email protected] — user circles are named after the email and represent the user in role memberships), a resource circle + <resource>.admin role circle per guarded resource, and the bootstrap admins added to every role circle.
campus.auth: the guest client (public; CLI device flow) — its scope allowlist is per-environment: dev includes clients:read/clients:write, prod's does not (a prod device login requesting client-management scopes is rejected outright); the master admin account ([email protected], AUTH_SUPER_ADMIN bypass + campus-admin circle member); operator client wiring.
campus.api (prod): schema init + ledger stamps, the circles graph, vault labels the services read + vault access grants for their clients (bits: 1 = read, 15 = full).
Trap to encode in any automation: client principals cannot edit circle membership (#854 — domain administration must be attributable to a user), so the first admin must come from seed data, never from an API call. The bootstrap paradox is otherwise unresolvable.
3. The portal (campus-admin) bootstrap checklist
- Client mint (
campus-admin-dev/campus-admin-production):redirect_uris={PUBLIC_URL}/finalize_login(+http://localhost:5000/finalize_loginin dev). campus#651 enforces fail-closed: a callback not registered here 400s at authorize — every sign-in broken. allowed_scopescap — the one that bit us. Must include:campus.profile(OAuth floor) — always.users:read— not a feature scope: flask_campus's context hook re-fetches the signed-in user's record on cache misses throughusers[id].get(), two-leg gated; without the scope the portal 500s on every request once the context cache expires (4946d91; the #854-family regression campus#956). This is a bootstrapping requirement of any flask_campus consumer, not a campus-admin quirk.- Feature vocabularies the deployment uses — today the migrations set (
migrations:read/write/admin), acquired per-user via the Migrations view's step-up re-auth (PR #82). A cap gap there no longer breaks sign-in: the step-up catches it and shows the reason; the nav renders disabled-with-reason. - Failure mode if the cap lags the login request: campus.auth rejects
sessions.new→ every sign-in 500s (the outage). Since PR #82,/loginrequests only the structural baselineLOGIN_SCOPES_BASE = ["campus.profile", "users:read"], so cap drift on feature vocabularies degrades to visible UI states instead.
- Service env:
SECRET_KEY,CLIENT_ID/CLIENT_SECRET,PUBLIC_URL,BASE_URLor per-service URL overrides (the gateway-flapping fallback above),AUDIT_API_KEY(producer),AUDIT_UI_API_KEY(UI key),AUDIT_TRACING_ENABLED,AUDIT_ADMINS(comma list — independent gate),ADMIN_CIRCLE(defaultcampus-adminsentinel — independent gate). - Audit keys: mint the UI key (
traces:read+apikeys:read+apikeys:write) from the audit operator key; the /audit section authenticates by API key, not bearer.
4. Grant blessings — the sequence
Authority for blessings is itself bootstrapped, so order matters:
- Seed the first admins (circles membership + role circles) via
BOOTSTRAP_ADMIN_USERS/ the master admin — APIs can't do it (#854 above). - A seeded admin logs in via campus-cli device flow and blesses others:
- Circle membership: the user's user circle must exist before
members/addaccepts an email-shaped member; the grantor needscircles.admin(e.g.campus-test-admingrants via its own device login — credentials deliberately unshared). Live recipe:docs/circles-access-control.md§Classroom live-testing grants. - Grant rows (#883 two-leg designation leg):
campus grant grant --grantee-type user --grantee-id <email> --resource <vocabulary> --level <read|write|admin>— requires the operator or a same-vocabulary admin; levels are hierarchical (admin ⊇ write ⊇ read). - Migrations grants are seeded ahead of a migration window by explicit decision — they are not standing blessings.
- users:read/write grants for portal admins (a users:write row covers read).
- Circle membership: the user's user circle must exist before
- Env-specific CLI constraint: on prod, the guest client cannot even request
clients:*login scopes, and grant-store reads/writes reject plain user tokens (#854 family) — so prod client/grant administration needs the operator context or a pre-seeded grants admin. Automations must not assume the dev CLI path works on prod. - Vault blessings for service clients ride the Clients page /
campus client access(bits 1/15), not the grant store.
5. Scopes reference (who needs what, and why)
| Scope | Required by | Why |
|---|---|---|
campus.profile |
every login | OAuth floor |
users:read |
portal /login baseline |
context-hook user-record fallback; missing ⇒ portal-wide 500s after cache expiry |
migrations:read/write/admin |
Migrations view step-up | capability leg; the grant row is the designation leg; services enforce both per call |
read, write |
CLI default | device-flow default set |
clients:read/write |
campus-cli client administration | dev guest allowlist yes, prod no — a grant row is also required (#883) |
traces:write / traces:read + apikeys:* |
audit producers / audit UI | API-key auth (minted from the operator key), not bearer scopes |
6. Autonomous-bootstrap verification checklist
- Every service
/health200 (incl. gateway). -
/auth/v1/oauth/device_authorizeissues codes;/auth/v1/google/authorizeredirects with the right client. - Portal:
/login302 → authorize → finalize → dashboard 200 (a 500 here = cap / redirect_uri / secret drift — check in that order). - Anonymous
/resources/circles302s to sign-in; wrong-redirect_uriclients get the campus#651 browser error page. - Context-cache expiry does NOT 500 the next request (the
users:readtrap). - Migrations view renders the correct two-leg panel state; grant store reachable.
- Circle/grant probes answer for the seeded admins; a non-member's section pill renders disabled with the reason (PR #82).
Follow-ups this issue tracks
- Turn this into a script/runbook file (docs/) once validated — an autonomous bootstrap wants executable checks, not prose.
- Upstream (campus): narrow token issuance by designation so tokens reflect grants — single-source capability detection instead of the scope+grant double probes (PR #82).
- Upstream (campus): consider making
users:readimplicit for self-reads (the #879 embedded-user path already avoids the fallback on current builds; the fallback remains a bootstrap trap on older builds). -
BOOTSTRAP_ADMIN_USERSlifecycle (removal flow) — flagged in circles-access-control.md as a deliberate follow-up.
- 主要言語
- Python
- スター
- 0
- フォーク
- 0
- 平均マージ
- 13分
- マージ済み PR(30日)
- 62
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nyjc-computing/campus-admin のほかの issue
-
chore
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
nyjc-computing/campus-admin#105 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nyjc-computing/campus-admin#96 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nyjc-computing/campus-admin#16 ·
メンテナーはふだん 1 日以内に返信
-
ops: replace the Procfile with a platform-side startCommand override (Railpack deprecates Procfiles)オープンchore
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
nyjc-computing/campus-admin#100 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
nyjc-computing/campus-admin#72 ·
メンテナーはふだん 1 日以内に返信
nyjc-computing/campus-admin の issue をすべて見る
似ている issue
-
ui
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ARTPARK-SAHAI-ORG/calibrate-frontend#919 ·
メンテナーはふだん 1 日以内に返信
-
CI: MSYS2 jobs fail — mingw python3 package renamed upstream to python対応中かも @ronaldtse が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
pydantic/pytest-examples#102 · コメント 1 件 ·