docs/ops: deployment bootstrap runbook — service order, seed data, grant blessings, and required scopes (for an autonomous bootstrap)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 43/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- devops, documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 0
- Fork
- 0
- Merge trung bình
- 13 phút
- Pull request đã merge (30 ngày)
- 62
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nyjc-computing/campus-admin
-
chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
nyjc-computing/campus-admin#105 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nyjc-computing/campus-admin#96 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nyjc-computing/campus-admin#16 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ops: replace the Procfile with a platform-side startCommand override (Railpack deprecates Procfiles)Đang mởchore
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
nyjc-computing/campus-admin#100 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
nyjc-computing/campus-admin#72 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của nyjc-computing/campus-admin
Issue tương tự
-
triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
kornia/kornia-rs#1416 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PolicyEngine/ai-inequality#64 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timeCó thể đã có người làm @PabloRoque đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
pymc-devs/pymc-extras#839 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày