Aller au contenu

Deploy setup — manual, human-only checklist

Brouillon : cette page n'a pas encore été relue et peut être incomplète ou inexacte.

These steps require the GitHub UI, the DigitalOcean console, or org-admin rights and cannot be performed by CI. Do them in order. See deploy-architecture.md for the model. Names in CODE are referenced by the workflows — keep them exact or update the workflow vars/secrets to match.

  • App repos: af-corporation-outlook-com/{ged_backend, agbale_frontend, afcm-backend, afcm-front}
  • Superrepo: af-corporation-outlook-com/dowonou-deploy
  • DOCR registry: registry.digitalocean.com/afcorp
  • DO cluster name (for doctl kubeconfig save): af-sandbox (override via superrepo var DO_CLUSTER)

Used by app CI to write the superrepo, and by promote.yml to dispatch frontend builds.

  1. Org → Settings → Developer settings → GitHub Apps → New GitHub App.
    • Permissions: Repository → Contents: Read & write, Pull requests: Read & write (the DEV bump lands as an auto-merge PR — main is protected, direct push is rejected), Metadata: Read-only, Actions: Read & write (so promote.yml can dispatch + watch build-env.yml).
    • No webhook needed.
    • NOTE: if you add Pull requests after first creating the App, you must re-accept the permission on each installation (GitHub emails an approval link / Settings → Installations → Configure), or gh pr create fails with 403.
  2. Install it on all four app repos and the superrepo.
  3. Generate a private key; note the App ID.
  4. Add as org secrets (or per-repo) so each app repo and the superrepo can read them:
    • App repos need: DEPLOY_APP_ID, DEPLOY_APP_PRIVATE_KEY
    • Superrepo promote.yml needs: APP_ID, APP_PRIVATE_KEY
    • (Two name pairs because the app workflows and promote.yml were kept independent; you may point both at the same App — just set both name pairs to the same values.)

App pipelines build & push images; they do not get cluster access.

  1. DigitalOcean → API → Tokens, or Container Registry → Settings, create a token with registry read & write.
  2. Add as secret DIGITALOCEAN_ACCESS_TOKEN in each app repo (or as an org secret).
  3. Ensure each cluster namespace (agbale-dev, agbale-staging, agbale-prod) has a DOCR image pull secret so deployed pods can pull. (DigitalOcean → Container Registry → “DigitalOcean Kubernetes integration” wires this automatically per cluster.)

3. Superrepo GitHub Environments (cluster credentials — the ONLY place they live)

Section intitulée « 3. Superrepo GitHub Environments (cluster credentials — the ONLY place they live) »

In dowonou-deploy → Settings → Environments, create three:

Environment Secret Protection
dev DIGITALOCEAN_ACCESS_TOKEN (DEV cluster) none (auto-deploy)
staging DIGITALOCEAN_ACCESS_TOKEN (staging cluster) optional reviewers
production DIGITALOCEAN_ACCESS_TOKEN (PROD cluster) Required reviewers = deploy leads; optional wait timer
  • The deploy job maps manifest env prod → GitHub Environment production.
  • If DEV/staging/PROD share one cluster today, use the same token in each — the isolation still holds once clusters split, with no workflow change.
  • Optional: restrict each Environment’s deployment branches to main.
  • Also set, if you run e2e: E2E_USERNAME, E2E_PASSWORD (repo or env secrets).

4. Superrepo main protection (the DEV-auto / promo-gated split)

Section intitulée « 4. Superrepo main protection (the DEV-auto / promo-gated split) »

Goal: let the GitHub App auto-land DEV bumps as PRs, but force lead review on staging/PROD. The DEV bump opens a PR and self-merges — main requires a PR, so the App needs Pull requests: write (Section 1) and the repo needs Allow auto-merge enabled (Settings → General → Pull Requests).

Use classic branch protection (Settings → Branches) OR a ruleset — either works. Required settings on main:

  • Require a pull request before merging, Required approvals = 0.
  • Require review from Code Owners: enable.
  • CODEOWNERS scopes owners to /environments/staging/ and /environments/prod/ only. Net effect: a DEV-only change (environments/dev/**) matches no code owner → 0 approvals → the bot’s PR auto-merges; a staging/PROD change requires the leads team.

This was applied via the API as classic protection: required_approving_review_count: 0, require_code_owner_reviews: true.

  • Create the team @af-corporation-outlook-com/dowonou-leads and give it write on the repo (rename in .github/CODEOWNERS if you use a different slug). ⚠️ With code-owner review required, staging/PROD PRs are unmergeable until this team exists — DEV is unaffected.
  • Allow the GitHub App to bypass PR requirements for environments/dev/**, OR (simpler) rely on the 0-approval + path-scoped-codeowners combination above so a direct push of a DEV-only change is permitted. Verify with a test bump (Section 6).

If your org enforces “require PR for all pushes to main” with no bypass, switch the app deploy-dev.yml bump to open an auto-merge PR for environments/dev/** instead of pushing to main directly, and enable repo Allow auto-merge.

5. Per-app variables (optional; defaults baked in)

Section intitulée « 5. Per-app variables (optional; defaults baked in) »

Workflows default these, override only if names differ:

  • App repos: DO_REGISTRY (default registry.digitalocean.com/afcorp), DEPLOY_REPO (default af-corporation-outlook-com/dowonou-deploy).
  • Superrepo: DO_CLUSTER (default af-sandbox), APP_REPO_ORG (default af-corporation-outlook-com).
  1. Make sure agbale-ged-backend:<sha> can be built — push a trivial commit to ged_backend main.
  2. Confirm deploy-dev.yml: builds, pushes agbale-ged-backend:<short-sha>, and opens/pushes a superrepo commit updating environments/dev/versions.yaml (ged-backend.tag = <short-sha>) and the ged_backend gitlink.
  3. Confirm the superrepo deploy.yml runs for dev only and helm-upgrades agbale-dev with the new tag; staging/PROD untouched.
  1. Run Actions → Promote with from_env=dev, to_env=staging, apps=ged-backend.
  2. Confirm it opens a PR editing environments/staging/versions.yaml, requires the leads’ review (CODEOWNERS), and on merge deploys staging with the same tag.
  3. Repeat staging → prod; confirm the production Environment blocks on required reviewers before the deploy runs.
  • Revert the offending manifest commit on main (re-triggers deploy.yml for that env), or
  • workflow_dispatch Deploy for the env after editing the manifest back to a known-good pin.
  • Create team @af-corporation-outlook-com/dowonou-leads (or edit .github/CODEOWNERS).
  • Decide whether one GitHub App backs both DEPLOY_APP_* and APP_* name pairs.
  • Confirm the afcm-front submodule is repointed to master (it currently tracks the feature branch DT-002-helm-charts).
  • Confirm DEV/staging/PROD cluster split (one cluster today → same token in all envs).