example.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <title>Auth Service · Runbook</title>
  7. <style>
  8. :root {
  9. --bg: #0c0e14;
  10. --paper: #14171f;
  11. --paper-2: #1c2030;
  12. --ink: #eaecf3;
  13. --muted: #8b94ad;
  14. --line: #262b3b;
  15. --accent: #6ee7b7;
  16. --accent-soft: rgba(110,231,183,0.1);
  17. --warn: #fbbf24;
  18. --danger: #f87171;
  19. --display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  20. --body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  21. --mono: ui-monospace, 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
  22. }
  23. * { box-sizing: border-box; }
  24. body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.6; }
  25. .page { max-width: 1100px; margin: 0 auto; padding: 32px 28px 64px; }
  26. /* Header */
  27. .head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 24px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
  28. .head-left { display: flex; flex-direction: column; gap: 6px; }
  29. .crumb { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
  30. h1 { font-family: var(--display); font-size: 36px; margin: 4px 0; font-weight: 700; letter-spacing: -0.02em; }
  31. .head-meta { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
  32. .head-meta span { color: var(--accent); }
  33. .pill {
  34. display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  35. font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  36. }
  37. .pill.tier { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(110,231,183,0.3); }
  38. .pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  39. section { margin-top: 40px; }
  40. h2 { font-family: var(--display); font-size: 22px; margin: 0 0 14px; letter-spacing: -0.005em; font-weight: 700; }
  41. h2 .index { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 12px; vertical-align: middle; }
  42. /* Summary */
  43. .summary { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
  44. .panel { padding: 22px 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
  45. .panel p { margin: 0 0 12px; }
  46. .panel p:last-child { margin: 0; }
  47. .deps h3 { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; font-weight: 500; }
  48. .deps ul { padding: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-family: var(--mono); font-size: 12.5px; }
  49. .deps li { display: flex; justify-content: space-between; padding: 8px 12px; background: var(--paper-2); border-radius: 6px; }
  50. .deps li .ok { color: var(--accent); }
  51. .deps li .warn { color: var(--warn); }
  52. /* Tables */
  53. table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  54. th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
  55. th { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--paper-2); }
  56. tr:last-child td { border-bottom: none; }
  57. td.code, .panel code { font-family: var(--mono); }
  58. .sev { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 4px; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
  59. .sev-1 { background: rgba(248,113,113,0.15); color: var(--danger); }
  60. .sev-2 { background: rgba(251,191,36,0.15); color: var(--warn); }
  61. .sev-3 { background: rgba(110,231,183,0.15); color: var(--accent); }
  62. /* Procedure cards */
  63. .procs { display: flex; flex-direction: column; gap: 14px; }
  64. .proc { padding: 18px 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
  65. .proc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
  66. .proc-head h3 { margin: 0; font-family: var(--display); font-size: 17px; }
  67. .proc-head .when { font-family: var(--mono); font-size: 11px; color: var(--muted); }
  68. pre { background: var(--paper-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: #cdd6f4; margin: 8px 0 0; }
  69. pre .cmt { color: var(--muted); }
  70. pre .var { color: var(--warn); }
  71. pre .ok { color: var(--accent); }
  72. /* On-call */
  73. .rota { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  74. /* Checklist */
  75. .checklist { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  76. .step { padding: 18px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; display: flex; gap: 16px; align-items: flex-start; }
  77. .step-num { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--display); font-size: 16px; }
  78. .step h4 { margin: 0 0 6px; font-family: var(--display); font-size: 15px; }
  79. .step p { margin: 0; color: var(--muted); font-size: 13px; }
  80. .step code { font-family: var(--mono); background: var(--paper-2); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--accent); }
  81. footer { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
  82. @media (max-width: 880px) {
  83. .summary, .checklist { grid-template-columns: 1fr; }
  84. h1 { font-size: 26px; }
  85. }
  86. </style>
  87. </head>
  88. <body>
  89. <div class="page">
  90. <header class="head">
  91. <div class="head-left">
  92. <div class="crumb">Northwind / Identity / Auth</div>
  93. <h1>auth-service</h1>
  94. <div class="head-meta">Owned by <span>@identity-platform</span> · v4.7.2 · Last reviewed 14 Oct 2025</div>
  95. </div>
  96. <span class="pill tier"><span class="dot"></span>Tier 0 · production-critical</span>
  97. </header>
  98. <section>
  99. <h2><span class="index">01</span>Service summary</h2>
  100. <div class="summary">
  101. <div class="panel">
  102. <p><strong>auth-service</strong> issues, validates, and revokes session tokens for every Northwind product surface — web, mobile, and the public API. It owns the password store, the TOTP/WebAuthn enrollments, and the audit-log writer for all auth events.</p>
  103. <p>If <code>auth-service</code> is down, customers cannot log in or refresh sessions. Existing valid sessions continue to work for their TTL (15 minutes) but no new auth happens.</p>
  104. </div>
  105. <div class="panel deps">
  106. <h3>Dependencies</h3>
  107. <ul>
  108. <li><span>Postgres · auth-db</span><span class="ok">healthy</span></li>
  109. <li><span>Redis · session-cache</span><span class="ok">healthy</span></li>
  110. <li><span>KMS · auth-keyring</span><span class="ok">healthy</span></li>
  111. <li><span>SES · transactional</span><span class="warn">degraded</span></li>
  112. <li><span>Pager · oncall.northwind</span><span class="ok">healthy</span></li>
  113. </ul>
  114. </div>
  115. </div>
  116. </section>
  117. <section>
  118. <h2><span class="index">02</span>Alerts you might wake up to</h2>
  119. <table>
  120. <thead><tr><th>Alert</th><th>Severity</th><th>What it means</th><th>First response</th></tr></thead>
  121. <tbody>
  122. <tr>
  123. <td class="code">auth.login_5xx_rate &gt; 1%</td>
  124. <td><span class="sev sev-1">SEV-1</span></td>
  125. <td>Login endpoint returning errors. Customers are locked out.</td>
  126. <td>Check Postgres + Redis dashboards. Roll back last deploy if &lt; 30 min old.</td>
  127. </tr>
  128. <tr>
  129. <td class="code">auth.token_refresh_lag_p95 &gt; 800ms</td>
  130. <td><span class="sev sev-2">SEV-2</span></td>
  131. <td>Refresh path is slow. Web app starts to feel sluggish.</td>
  132. <td>Inspect Redis CPU + connection count. Scale read replicas if needed.</td>
  133. </tr>
  134. <tr>
  135. <td class="code">auth.signup_failure &gt; 10/min</td>
  136. <td><span class="sev sev-2">SEV-2</span></td>
  137. <td>New signups are failing. Often SES bounces or SMTP auth.</td>
  138. <td>Check SES bounce rate. Failover transactional queue to backup region.</td>
  139. </tr>
  140. <tr>
  141. <td class="code">auth.kms_signing_errors &gt; 0</td>
  142. <td><span class="sev sev-1">SEV-1</span></td>
  143. <td>KMS can't sign session tokens. New logins fail; existing sessions OK.</td>
  144. <td>Page the security team. Do not roll keys without a security engineer.</td>
  145. </tr>
  146. <tr>
  147. <td class="code">auth.audit_writer_backlog &gt; 5k</td>
  148. <td><span class="sev sev-3">SEV-3</span></td>
  149. <td>Audit log writer is falling behind. Compliance impact.</td>
  150. <td>Drain manually. Open a ticket; not a wake-up.</td>
  151. </tr>
  152. </tbody>
  153. </table>
  154. </section>
  155. <section>
  156. <h2><span class="index">03</span>Common procedures</h2>
  157. <div class="procs">
  158. <div class="proc">
  159. <div class="proc-head"><h3>Deploy a new version</h3><span class="when">Use during business hours</span></div>
  160. <p>Deploys are blue/green. The script waits for two consecutive healthchecks before promoting traffic.</p>
  161. <pre><span class="cmt"># Deploy auth-service v4.7.3 to production</span>
  162. $ nw deploy auth-service --tag <span class="var">v4.7.3</span> --env production
  163. <span class="cmt"># Wait for two consecutive healthchecks (~90 s), then promote.</span>
  164. $ nw deploy promote auth-service --env production
  165. <span class="ok">→ traffic shifted: 10% / 50% / 100%</span></pre>
  166. </div>
  167. <div class="proc">
  168. <div class="proc-head"><h3>Roll back to last known good</h3><span class="when">Use when error rate &gt; 1% post-deploy</span></div>
  169. <pre><span class="cmt"># Rolls back to the previously promoted version, no rebuild.</span>
  170. $ nw deploy rollback auth-service --env production
  171. <span class="ok">→ rolled back to v4.7.2 in 38 s</span></pre>
  172. </div>
  173. <div class="proc">
  174. <div class="proc-head"><h3>Rotate signing keys</h3><span class="when">Schedule with security; never solo</span></div>
  175. <pre><span class="cmt"># 1. Generate the new signing key in KMS</span>
  176. $ nw kms create-key --alias auth-signing-<span class="var">$(date +%Y%m%d)</span>
  177. <span class="cmt"># 2. Mark the new key as the primary; old key remains valid for 24h</span>
  178. $ nw kms set-primary auth-signing --key <span class="var">&lt;arn&gt;</span>
  179. <span class="cmt"># 3. After 24h, schedule deletion of the previous key</span>
  180. $ nw kms schedule-deletion auth-signing --key <span class="var">&lt;old-arn&gt;</span> --days 30</pre>
  181. </div>
  182. <div class="proc">
  183. <div class="proc-head"><h3>Drain audit-log backlog</h3><span class="when">Use when audit_writer_backlog alert fires</span></div>
  184. <pre>$ nw exec auth-service -- bin/audit-drain --batch <span class="var">5000</span>
  185. <span class="ok">→ drained 4,812 entries in 12 s; backlog now 0</span></pre>
  186. </div>
  187. </div>
  188. </section>
  189. <section>
  190. <h2><span class="index">04</span>On-call rotation · this month</h2>
  191. <table class="rota">
  192. <thead><tr><th>Week</th><th>Primary</th><th>Secondary</th><th>Backup (escalation)</th></tr></thead>
  193. <tbody>
  194. <tr><td>Oct 27 – Nov 02</td><td>Devon Park</td><td>Priya Banerjee</td><td>Sasha Lin</td></tr>
  195. <tr><td>Nov 03 – Nov 09</td><td>Caleb Renner</td><td>Devon Park</td><td>Sasha Lin</td></tr>
  196. <tr><td>Nov 10 – Nov 16</td><td>Priya Banerjee</td><td>Caleb Renner</td><td>Mira Reddy</td></tr>
  197. <tr><td>Nov 17 – Nov 23</td><td>Sasha Lin</td><td>Priya Banerjee</td><td>Mira Reddy</td></tr>
  198. </tbody>
  199. </table>
  200. </section>
  201. <section>
  202. <h2><span class="index">05</span>Incident response — first 30 minutes</h2>
  203. <div class="checklist">
  204. <div class="step">
  205. <div class="step-num">1</div>
  206. <div><h4>Acknowledge the page within 5 min.</h4><p>Type <code>/ack</code> in <code>#incidents-auth</code>. The bot stops re-paging and tags the on-call.</p></div>
  207. </div>
  208. <div class="step">
  209. <div class="step-num">2</div>
  210. <div><h4>Open the incident channel.</h4><p>Run <code>/incident open auth-service "&lt;short title&gt;"</code>. Slack bot creates a dedicated channel and pages the secondary.</p></div>
  211. </div>
  212. <div class="step">
  213. <div class="step-num">3</div>
  214. <div><h4>Post a status snapshot.</h4><p>Customer-impact in one line, what you know, what you're checking next. Re-post every 10 minutes.</p></div>
  215. </div>
  216. <div class="step">
  217. <div class="step-num">4</div>
  218. <div><h4>Mitigate before you diagnose.</h4><p>If a recent deploy is suspect, roll back. If KMS is degraded, fail open is <em>never</em> the answer for auth — escalate to security.</p></div>
  219. </div>
  220. <div class="step">
  221. <div class="step-num">5</div>
  222. <div><h4>Hand off or stand down.</h4><p>If you can't resolve in 30 min, hand to the secondary. When healthy, close with <code>/incident close</code>; postmortem is owed within 5 business days.</p></div>
  223. </div>
  224. </div>
  225. </section>
  226. <footer>
  227. <span>Northwind Identity Platform · runbook v3.2</span>
  228. <span>Source: ops-docs/auth-service.md</span>
  229. </footer>
  230. </div>
  231. </body>
  232. </html>