Flatten config templates, render inside the release - #127
Merged
Conversation
…lease
Rendered config templates were pushed straight into the non-versioned
apps-data/{app}/config/ tree before the atomic symlink switch, breaking
the release's atomicity guarantee and leaving no history to fall back
to. Drop the config/ subdirectory convention entirely and rely on
naming alone: any *.template.* file next to an app's docker-compose.yml
is rendered in place, on the runner, before the release is archived -
so it rides inside the same release tarball as .env. Compose files now
mount the rendered file by plain relative path, one line per file,
instead of reaching into apps-data. apps-data stays reserved for state
that must survive across releases and is never regenerated.
Fixes #126.
.template as an infix (traefik.template.yml) meant a bespoke glob (*.template.*) and extra care extracting the real extension. Match the convention Terraform's templatefile() (.tpl) and Consul Template (.tmpl) use instead: .template as a trailing suffix (traefik.yml.template), stripped via Path.stem to get the rendered filename. Simpler glob (*.template), no risk of the marker showing up mid-filename by accident.
.template as a terminal suffix (traefik.yml.template) loses default syntax highlighting everywhere - editors and GitHub's diff view pick a language by the last extension, and .template isn't a recognized one anywhere out of the box. Use Terraform's own .tpl marker, but keep it as an infix (traefik.tpl.yml) rather than terminal like Terraform does, so the real extension (.yml) stays last and highlighting keeps working with zero per-editor configuration.
traefik.tpl.yml -> traefik.yml.tpl, matching Terraform's own .tpl placement (user_data.tpl) instead of an infix. Editors won't syntax- highlight the template source out of the box with this placement - noted in AGENTS.md, with a pointer to configuring a file association if that matters. Rendered output (traefik.yml) is unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apps-data/{app}/config/tree before the atomic symlink switch - not part of the release tarball, no history, and in tension with the atomicity guarantee AGENTS.md documents elsewhere.config/subdirectory convention entirely: any*.template.*file next to an app'sdocker-compose.ymlis now rendered in place, on the runner, before the release is archived - so it rides inside the same release tarball as.env.traefik,codecov) now mount the rendered file by plain relative path, one line per file, instead of reaching intoapps-data.apps-datastays reserved for state that must survive across releases and is never regenerated (acme.json, database data directories, codecov'sarchive/).push_app_configsand therendered_configsdict threaded throughresolve_app_envs/deploy_to_host/main- no longer needed.Closes #126.
Test plan
deploy/tests/test_deploy.pyupdated for the flattened layout; full suite (48 tests) passespre-commit run --all-filespasses (yamllint, pymarkdown, ruff, actionlint)docker compose configvalidated for bothapps/traefikandapps/codecov- confirmed the rendered-file mounts resolve toapps/traefik/traefik.ymlandapps/codecov/codecov.ymlrespectively, noapps-datainvolvement for config