Bootstrapping cofactor/deploy/
-
Read how the system is really deployed: the infrastructure-as-code, the CI workflows and the service entrypoints. Do not guess from folder names.
-
Make one target per independently deployed unit. Two things that always ship together are one target; two things that can ship apart are two.
-
Write
system.yml:yamlenvironments: dev: policy: auto # auto, or approval (a human approves each plan) requireChecks: [CI] # exact check-run names that must pass on a commit targets: - id: db # lowercase letters, digits, dashes owns: ['packages/db/**'] # globs of the paths this target is built from confirmTimeoutMinutes: 30 # how long to wait for the status runbook to confirm forwardOnly: true # schema targets only: never rolled back, only forward migrations: 'packages/db/migrations/*.sql' # targets owning SQL migrations only runbooks: dev: { deploy: deploy-db-dev, status: status-db-dev } # per stageThe
runbooks.<stage>.deployand.statusvalues are runbook names. Each is defined as a repo file atcofactor/runbooks/<slug>.yml; seedocs/features/runbooks.mdfor the file format. -
Write
contracts/<id>.ymlfor every target, one file each:yamlprovides: ['route:POST /widgets@1', 'column:widgets.name@1'] requires: ['db:column:widgets.name@1']
A symbol is
kind:name@n. A requirement is<target>:<symbol>. Symbols are lowercase kind, any name, and a versionnof 1 or more. -
Write two runbooks per target per stage (files in
cofactor/runbooks/, named insystem.yml). The deploy runbook starts the deploy and exits; it never waits for the rollout. The status runbook reports what is live: it writes this JSON to the file named by$COFACTOR_RESULT_FILE:json{"version":"<sha>","state":"steady"}stateissteady,rollingorfailed. The status runbook must NOT put secrets, tokens or hostnames in that file. -
Run
cofactor deploy graph validateand fix every issue it prints.