|
| 1 | +# Drift Documentation: New Section Plan |
| 2 | + |
| 3 | +## Goals |
| 4 | + |
| 5 | +- Create a dedicated Drift section (parallel to State Management / Self-host Digger) that clearly explains concepts, setup, operations, and troubleshooting. |
| 6 | +- Reduce fragmentation by moving/adapting current content under a coherent information architecture (IA). |
| 7 | +- Fill current gaps: org/project settings, scheduling strategies, remediation, and self-host specifics. |
| 8 | + |
| 9 | +## Current Inventory (what exists today) |
| 10 | + |
| 11 | +- Features → Drift Detection: `docs/ce/features/drift-detection.mdx` |
| 12 | + - Covers: GH Actions scheduled workflow for drift; Slack and GitHub Issues examples; note about 403/no-backend. |
| 13 | +- How To → Scope Drift Detection: `docs/ce/howto/scope-drift-detection.mdx` |
| 14 | + - Covers: Using `digger-filename` to limit drift to certain projects. |
| 15 | +- Reference → Action inputs: `docs/ce/reference/action-inputs.mdx` |
| 16 | + - Mentions: `mode: drift-detection`, `drift-detection-slack-notification-url`, `digger-filename`, `no-backend`. |
| 17 | +- Codebase capabilities (underdocumented in docs): |
| 18 | + - Org-level drift settings: enable/disable, cron string, Slack webhook URL (`/api/orgs/settings/`). |
| 19 | + - Project-level drift enable flag (`/api/projects/:project_id`). |
| 20 | + - Internal drift service endpoints and scheduler hooks (for backend-driven scans and Slack rollups). |
| 21 | + - Plan snapshots and counts stored per project; status surfaced in UI/API. |
| 22 | + |
| 23 | +## Proposed Section Name and Nav |
| 24 | + |
| 25 | +- Group: Drift. |
| 26 | +- Placement: Top-level group in `docs/mint.json` after “Getting Started” and “State Management”. |
| 27 | +- Remove “Drift Detection” from Features; move/retitle into this new section. |
| 28 | + |
| 29 | +## Information Architecture (pages and purpose) |
| 30 | + |
| 31 | +1) `ce/drift/overview.mdx` |
| 32 | + - What is drift, why it matters, how Digger detects it (scheduled plans on default branch per project). |
| 33 | + - Two operating modes: GitHub Actions-only vs backend-orchestrated scans. |
| 34 | + - Optional high-level mention of drift states (no dedicated page). |
| 35 | + |
| 36 | +2) `ce/drift/how-it-works.mdx` |
| 37 | + - Architecture: drift as a separate service with a cron-driven scheduler; internal endpoints and DB updates. |
| 38 | + - Backendless mode: running entirely via GitHub Actions with `mode: drift-detection`. |
| 39 | + - When to choose each approach. |
| 40 | + |
| 41 | +3) `ce/drift/quickstart-github-actions.mdx` |
| 42 | + - Minimal GH Actions workflow using `mode: drift-detection` and a cron. |
| 43 | + - Includes a note that it is "backendless mode" |
| 44 | + - Tips: install Terraform (`setup-terraform: true`), store webhook secret, use `no-backend: true` when applicable. |
| 45 | + |
| 46 | +4) `ce/drift/scoping-projects.mdx` |
| 47 | + - Consolidate/replace How To → Scope Drift Detection. |
| 48 | + - Techniques: dedicated `digger.yml` via `digger-filename`, project `drift_detection: false` in digger.yml, branch filters, dependency considerations. |
| 49 | + |
| 50 | +5) `ce/drift/notifications.mdx` |
| 51 | + - Slack rollup notifications: format, frequency, org-level webhook, test endpoint, common errors. |
| 52 | + - Mentions GitHub Issues exist for drift, with a link to the dedicated page below. |
| 53 | + |
| 54 | +6) `ce/drift/github-issues.mdx` |
| 55 | + - Dedicated setup and permissions for creating GitHub Issues during drift. |
| 56 | + - What’s in the issue, labels, ownership, and housekeeping guidance. |
| 57 | + |
| 58 | +7) `ce/drift/remediation.mdx` |
| 59 | + - How to remediate drift using GitHub Issues integration. |
| 60 | + - Describe remediation by commenting `digger apply` in the GitHub issue; include a clear note that this flow is only relevant for the GitHub Issues integration. |
| 61 | + |
| 62 | +8) `ce/drift/scheduling.mdx` |
| 63 | + - GH Actions cron examples (simple mode). |
| 64 | + - Backend scheduling (self-host/Cloud): org-level `drift_cron_tab` and how scans are batched; internal endpoints overview. |
| 65 | + |
| 66 | +9) `ce/drift/self-host.mdx` |
| 67 | + - Running the drift service (`Dockerfile_drift`), required env vars: `DIGGER_HOSTNAME`, `DIGGER_WEBHOOK_SECRET`, `DIGGER_APP_URL`, `DIGGER_DRIFT_REPORTER_HOSTNAME`. |
| 68 | + - Database/scheduler notes (pg_cron/pg_net SQL jobs in `drift/scripts/cron/*.sql`). |
| 69 | + - Securing internal endpoints, topology, scaling. |
| 70 | + |
| 71 | +10) `ce/drift/troubleshooting.mdx` |
| 72 | + - 403/permissions during drift reporting → often missing `no-backend: true` in Actions. |
| 73 | + - Slack webhook failures and how to test. |
| 74 | + - Issues creation failures (token scopes), large plan outputs, runner timeouts. |
| 75 | + |
| 76 | +## Content Outlines (key sections per page) |
| 77 | + |
| 78 | +- Overview |
| 79 | + - Concept, detection flow description, supported IaC; optional brief mention of states. |
| 80 | + |
| 81 | +- How It Works |
| 82 | + - Separate service architecture and cron; internal endpoints; backendless mode explained. |
| 83 | + |
| 84 | +- Quickstart (GH Actions) |
| 85 | + - YAML snippet; secrets; validation; verification steps; example outputs. |
| 86 | + |
| 87 | +- Scoping Projects |
| 88 | + - `digger-filename` technique; per-project `drift_detection` flag; branch selection considerations. |
| 89 | + |
| 90 | +- Notifications |
| 91 | + - Slack rollup design (aggregated per org), color legend, test endpoint; direct link to GitHub Issues page. |
| 92 | + |
| 93 | +- GitHub Issues |
| 94 | + - Enablement, required env vars/permissions, example outputs, labels/assignment. |
| 95 | + |
| 96 | +- Remediation |
| 97 | + - Comment `digger apply` in the GitHub issue to remediate drift (only relevant for Issues integration). |
| 98 | + |
| 99 | +- Scheduling |
| 100 | + - GH Actions cron; backend scheduler overview (SQL jobs in `drift/scripts/cron/`), `drift_cron_tab` semantics; examples. |
| 101 | + |
| 102 | +- Self-host |
| 103 | + - Deploying the drift service; required components; env vars; security; health checks; scaling. |
| 104 | + |
| 105 | +- Troubleshooting |
| 106 | + - Symptoms, likely causes, resolutions; logs to check; sample curl commands for internal endpoints (self-host operators). |
| 107 | + |
| 108 | +## Migration and Link Strategy |
| 109 | + |
| 110 | +- Move: `ce/features/drift-detection` → `ce/drift/quickstart-github-actions` (rename and retitle). |
| 111 | +- Move: `ce/howto/scope-drift-detection` → `ce/drift/scoping-projects` (update links site-wide). |
| 112 | +- Update: cross-links in `action-inputs.mdx` to reference new “Quickstart”, “Notifications”, and “Scheduling” pages. |
| 113 | + |
| 114 | +## Navigation Changes (mint.json) |
| 115 | + |
| 116 | +- Add a top-level group: |
| 117 | + - Drift → pages: |
| 118 | + - `ce/drift/overview` |
| 119 | + - `ce/drift/how-it-works` |
| 120 | + - `ce/drift/quickstart-github-actions` |
| 121 | + - `ce/drift/scoping-projects` |
| 122 | + - `ce/drift/notifications` |
| 123 | + - `ce/drift/github-issues` |
| 124 | + - `ce/drift/remediation` |
| 125 | + - `ce/drift/scheduling` |
| 126 | + - `ce/drift/self-host` |
| 127 | + - `ce/drift/troubleshooting` |
| 128 | +- Remove `ce/features/drift-detection` from “Features”. |
| 129 | +- Remove `ce/howto/scope-drift-detection` from “How To”. |
| 130 | + |
| 131 | +## Acceptance Criteria |
| 132 | + |
| 133 | +- New Drift group appears as a dedicated section with the listed pages. |
| 134 | +- Quickstart reproducible end-to-end (Slack and Issues options tested). |
| 135 | +- Remediation page accurately reflects the supported comment flow for Issues integration. |
| 136 | +- Self-host and How It Works pages list required env vars and components and reference the SQL scheduler snippets. |
| 137 | + |
| 138 | +## Implementation Plan (steps) |
| 139 | + |
| 140 | +1. Create new directory and placeholder pages under `docs/ce/drift/` with titles and short summaries. |
| 141 | +2. Move/adapt content from `features/drift-detection` and `howto/scope-drift-detection` into the new pages. |
| 142 | +3. Update `docs/mint.json` to add the Drift group; remove moved pages from Features/How To. |
| 143 | +4. Update cross-links in the docs (search for references to old paths and fix). |
| 144 | +5. QA pass: local build of docs, link checker, skim for tone and consistency. |
| 145 | + |
| 146 | +## References (code pointers for authoring) |
| 147 | + |
| 148 | +- Action inputs mentioning drift: `docs/ce/reference/action-inputs.mdx`. |
| 149 | +- Current feature page: `docs/ce/features/drift-detection.mdx`. |
| 150 | +- How-to: `docs/ce/howto/scope-drift-detection.mdx`. |
| 151 | +- Backend endpoints and models: `backend/controllers/orgs.go`, `backend/controllers/projects.go`, `backend/bootstrap/main.go`, `backend/models/orgs.go`. |
| 152 | +- Issue comment handling: `backend/controllers/github_comment.go`. |
| 153 | +- Drift service and scheduler: `drift/controllers/*.go`, `drift/scripts/cron/*.sql`. |
0 commit comments