What's Changed
Swarm secrets and configs from variables and inline content
Swarm stacks now support the environment and content sources for top-level secrets and configs. Before, only file worked in Swarm mode. You can keep secret values in a SOPS-encrypted .env file and use them as Swarm secrets, without a plaintext secret file in the repository.
environment: secrets and configs read the value from a variable. doco-cd resolves it from the deploy configenvironment, theenv_files(default.env) and external secrets. SOPS-encrypted dotenv files are decrypted before use.content: configs use the inline value.- doco-cd sends the value to the Swarm API from memory. It does not write a secret or config file, also not for objects defined in
include:files. - The object name gets a hash of the value:
<stack>_<key>_<hash>, or<name>_<hash>with an explicitname. When the value changes, doco-cd creates a new object, updates the services that use it and prunes old revisions according to the configured retention. - If a variable is not set, the deployment fails. The error names the variable but not a value.
drivercannot be combined withenvironmentorcontent.
Example
services:
app:
image: myapp:latest
secrets:
- db_password
configs:
- source: app_settings
target: /etc/app/settings.conf
secrets:
db_password:
environment: DB_PASSWORD # Read from the decrypted .env file
configs:
app_settings:
content: |
log_level=infoFor a stack named myapp, doco-cd creates a secret named like myapp_db_password_<hash> and a config named like myapp_app_settings_<hash>.
Note
Secrets and configs from environment and content belong to one stack. A deployment fails if it would take over an object that another stack owns, for example through the same name. To share one object across stacks, provision it separately and reference it with external: true. Managed sharing across stacks is tracked in #2260.
Stacks that use only file secrets and configs are not affected. Their object names and deployment hashes stay the same.
See Swarm Mode -> Values from variables and inline content in the wiki.
Fix: Swarm secrets and configs with a name equal to their key
In Swarm mode, a top-level secret or config with a name equal to its key failed with undefined secret or undefined config. Services now keep the Compose key as the reference, so these stacks deploy.
All changes
✨ Features
🐛 Bug Fixes
📦 Dependencies
- chore(deps): update dependency golang to v1.27.4 by @renovate[bot] in #2176
- fix(deps): update module github.com/sigstore/cosign/v3 to v3.1.6 by @renovate[bot] in #2250
- chore(deps): update awalsh128/cache-apt-pkgs-action action to v2 by @renovate[bot] in #2251
- fix(deps): update aws-sdk-go-v2 monorepo by @renovate[bot] in #2253
- chore(deps): update dependency zensical to v0.1.4 by @renovate[bot] in #2252
- fix(deps): update module github.com/docker/compose/v5 to v5.8.1 by @renovate[bot] in #2254
- chore(deps): update docker:29-dind docker digest to 788c403 by @renovate[bot] in #2259
📚 Miscellaneous
Full Changelog: v0.138.0...v0.139.0