Source document
docs/pilot/PILOT-RUNBOOK.md
Source version
0.0.0
Generated time
2026-07-06T14:59:20.119Z
Owner
Operations / Founder
Audience
Internal
Status
Approved

Pilot Runbook

Quy trình vận hành để Founder tự onboard đối tác Pilot đầu tiên mà không phụ thuộc đội phát triển.
Mọi lệnh đã kiểm chứng thật trong Gamma-1. Source of truth = file này (Markdown). Không sửa HTML trực tiếp.
Liên quan: Support Playbook · Onboarding Package · Execution Plan.

Ký hiệu


1. Chuẩn bị trước Pilot

2. Cấp Sandbox (provision partner + tenant + inventory)

npm run ops -- create-partner --name "<Tên đối tác>" --owner founder --json     # → partnerId (pending)
npm run ops -- activate-partner --partner <partnerId>                            # → active
npm run ops -- provision-tenant --partner <partnerId> --tenant <tenantId> --name "<Tên>" --json
npm run ops -- activate-tenant --tenant <tenantId>                               # → active
npm run ops -- seed-inventory --tenant <tenantId> --json                        # inventory mẫu (Availability có dữ liệu)

3. Allowlist IP (bắt buộc cho staging)

/api/booking/* trên staging trả 403 nginx nếu IP đối tác chưa được allowlist. Đây là thao tác ops trên VPS (ssh kqxs, sửa allowlist nginx), không thuộc phạm vi thay-đổi-code.
Nếu chưa thể allowlist (hoặc muốn tránh đụng staging), có thể chạy Pilot trên sandbox local production-like (xem Execution Plan §Ghi chú) — cùng code/migration/kit.

4. Cấp API Key

npm run ops -- issue-key --customer <partnerId> --env sandbox --deliver --json
Mất/lộ key ⇒ npm run ops -- rotate-key --key <keyId> --json (cấp key mới, key cũ revoke). Xem Support Playbook §401.

5. Smoke Check (BNG tự kiểm trước khi giao)

# Với key vừa cấp + base URL:
curl -s -H "x-bng-api-key: <KEY>" \
  "<BASE>/api/booking/availability?unitId=<unitId>&start=2026-09-10&end=2026-09-12&quantity=1&adults=2&children=0"

6. Bàn giao cho đối tác


7. Checklist TRONG Pilot

8. Checklist SAU Pilot

9. Thu hồi quyền (khi Pilot kết thúc / cần cắt truy cập)

# Tạm ngưng (thuận nghịch — giữ dữ liệu, có thể mở lại):
npm run ops -- suspend-tenant --tenant <tenantId> --reason pilot-ended       # booking → 403 TENANT_INACTIVE
npm run ops -- suspend-partner --partner <partnerId> --reason pilot-ended    # mọi key → 401

# Chấm dứt vĩnh viễn:
npm run ops -- revoke-key --key <keyId> --reason pilot-ended --confirm       # key → 401 ngay
npm run ops -- archive-tenant --tenant <tenantId> --reason pilot-ended --confirm   # terminal
npm run ops -- revoke-partner --partner <partnerId> --reason pilot-ended --confirm # terminal, huỷ mọi key
Suspend là thuận nghịch (reactivate khôi phục). Revoke/Archive là terminal. Xem PARTNER-LIFECYCLE / TENANT-LIFECYCLE.