Config-as-code
Config-as-code moves your data model, access rules and settings between CairnCMS instances. Capture the source as YAML files, review changes in source control, preview them against the target, and apply the reviewed tree.
Use cairncms config snapshot and cairncms config apply to manage these resources together in CairnCMS 1.7.0 and later.
What travels in the tree
Section titled “What travels in the tree”| Resource | Captured state |
|---|---|
| Schema | Collections, fields, relations and their metadata |
| Roles and permissions | Role keys, access flags and operator-defined permission rules |
| Folders | File-library folder keys, names and hierarchy |
| Project settings | Supported branding, language, authentication, asset and map settings |
| Extension settings | Declared stored values for selected extension subjects, without copying secret values |
| Translations | Custom translation strings grouped by language |
The manifest selects which resource kinds the tree manages. An omitted kind is left alone. Within a managed kind, omission can mean deletion. Read Managed scope and deletions before reducing a tree or applying it to an existing project.
Snapshots do not transfer collection items, user accounts, uploaded file data, file records, or extension packages. Use Backups or Migration between instances when moving a complete deployment.
Start with a preview
Section titled “Start with a preview”Run these commands with the local instance’s database configuration loaded:
cairncms config snapshot ./configcairncms config apply ./config --dry-runThe first command captures the instance. The second compares the tree with that instance without changing it. An unchanged capture reports No changes to apply.
Back up the target before applying changes.
Follow Your first apply for a disposable walkthrough, or Deploying across environments for the promotion workflow.
Choose a connection
Section titled “Choose a connection”| Surface | Input | Target |
|---|---|---|
| Local CLI | Directory of YAML files | Database configured for the CLI process |
| Remote CLI | The same directory | Instance selected by --url, using an administrator token |
| HTTP API | One complete JSON or YAML document | Server receiving the request |
Find the reference you need
Section titled “Find the reference you need”- Files and resources: manifest, layout and supported fields.
- CLI reference: commands, options and exit codes.
- HTTP API: requests and response formats.
- Remote instances: credentials, TLS, version requirements and timeouts.
- Apply output: human plans, JSON output and run records.
- Failure recovery: inspect and recover from a failed apply.
- Adopting the unified workflow: existing directories and standalone files.
- Standalone schema commands: the retained compatibility workflow.