3.4 KiB
Compose Update Policy
Compose-backed services are deployed from role-owned Jinja templates. Vendored upstream files are reference snapshots only and must not be deployed directly.
Layout
Each Docker-backed role has:
templates/compose.yaml.j2: base deployed Compose filetemplates/compose.override.yaml.j2: NBOPS-specific local overridetemplates/env.j2: generated environment fileupstream/: copied upstream reference files
docs/upstream-sources.yml is the authoritative inventory of upstream Git
repositories, README paths, Compose paths, fallback Compose URLs, local Compose
references, refs, and verification status.
Role entries support one local fallback:
local_compose_file: repo-local Compose file to copy as role reference material when upstream does not provide a useful Compose example.
Repository entries support three upstream Compose discovery sources:
compose_paths: paths to Compose files inside the checked-out repository.compose_urls: directhttporhttpsURLs that return Compose YAML.- README fenced YAML blocks, parsed when a README is listed in
readme_paths.
Repository entries that only use compose_urls may omit url and ref.
Entries that use readme_paths or compose_paths must include both url and
ref so the script can clone the source repository.
Update Workflow
-
Read
docs/upstream-sources.ymlfor the role being updated. -
Test the upstream inventory without writing snapshots:
scripts/vendor-upstream-snapshots.py <role> -
Fetch or copy the listed upstream README and Compose files into
roles/<role>/upstream/:scripts/vendor-upstream-snapshots.py --apply <role>The script also looks for Compose-shaped fenced YAML blocks in README files. When exactly one candidate is found,
--applywrites it ascompose.from-readme.yaml. Compose YAML fetched fromcompose_urlsis written ascompose.from-url.yaml, orcompose.from-url-N.yamlwhen a repository has multiple fallback URLs. A role-levellocal_compose_fileis copied underroles/<role>/upstream/local/. -
Update
roles/<role>/upstream/SOURCE.mdwith source URL, ref, snapshot date, fetched paths, and any manual verification notes. -
Commit upstream snapshot changes separately from NBOPS deployment template changes.
-
Diff upstream snapshots against current role templates.
-
Apply upstream structural changes to
templates/compose.yaml.j2. -
Keep NBOPS-local changes in
templates/compose.override.yaml.j2, including: Traefik labels, internal networks, host paths, ports, restart policy, logging, resource limits, and deployment-specific environment wiring. -
Replace mutable image tags with pinned versions where practical.
-
Document breaking changes or operator actions in the role README.
Rules
- Do not edit generated Compose files on VMs.
- Do not deploy files from
upstream/directly. - Do not treat
status: verifysources as trusted until manually checked. - Prefer pinned tags or digests over
latestand other mutable tags. - Keep HTTP application ports unpublished in Traefik mode; document internal service ports as comments in generated Compose.
Validation
Run after every Compose template update:
ansible-playbook --syntax-check playbooks/site.yml
git diff --check
Later, add a render check that runs docker compose config against generated
compose.yaml plus compose.override.yaml for selected roles.