Project configuration and content
An automation project is the boundary that brings together runnable content, target systems, credentials, access rules, and event-driven work. The project lifecycle creates this boundary, prepares its content for tasks, and supports moving the full configuration to another project or instance.
Project lifecycle
Project creation starts with a project record and gives its owner access to it. The system then adds the basic project resources needed for a usable workspace, with optional sample content for a quick start. Project reads are scoped by membership, while project changes are protected by project permissions; administrators can enter projects without membership. (api/…/projects.go• L39-57, api/…/projects.go• L324-430, api/…/project.go• L19-84)
Project changes affect both durable records and local working data. Updates change the project name and task controls. Deletion removes the project-owned configuration in dependency order and clears its temporary working area. (api/…/project.go• L141-194, db/…/project.go• L77-131)
Project resource relationships
The project joins resources through references rather than through one large configuration object. A repository supplies automation files. Inventories and environments describe task targets and task context. Templates turn those inputs into runnable units. Views organize them for users, while schedules, integrations, workflows, runners, roles, and secrets extend how work starts, runs, and is controlled.
| Resource group | Role in the project |
|---|---|
| Repository and host configuration | Makes source files and remote hosts reachable. |
| Inventory and environment | Supplies target data and runtime context. |
| Template and view | Defines runnable content and its user-facing grouping. |
| Access key and secret storage | Supplies protected credentials to project operations. |
| Workflow and integration | Connects several actions or starts work from an external event. |
| Schedule and runner | Starts work at a time or through a registered execution worker. |
| Role and grant | Controls access to the project and its runnable resources. |
These relationships matter because a runnable template is not complete by itself. It must resolve its repository and may also resolve an inventory, environments, keys, vault data, a build template, and a view before a task can use it. The persistence and domain models page describes the stored relationships in detail.
References: api/…/projects.go• L59-321 services/…/types.go• L99-230
Content preparation
Content preparation turns a project’s stored references into a task-ready working context. The repository layer obtains the selected source revision and applies project credential mappings. An application factory then selects the task behavior for Ansible, Terraform-family tools, or shell-based commands. (db_lib/GitRepository.go• L46-72, db_lib/AppFactory.go• L8-37)
The preparation path keeps source content separate from project records. Remote repositories are cloned or updated in a project working area, and broken or incomplete checkouts are replaced. Repository browsing uses the same project credentials and can discover playbooks by application type. (db_lib/GitRepository.go• L81-130, api/…/repository.go• L137-213)
The selected application adds the content-specific setup that the task needs:
- Ansible prepares playbooks and can install changed Galaxy roles or collections.
- Terraform, OpenTofu, and Terragrunt initialize the working directory and select a workspace when supported.
- Shell-based applications run the configured file in the repository context.
The repository and automation content page explains these preparation paths and their validation boundaries. Execution then consumes the prepared context as described by the automation execution documentation.
References: db_lib/AppFactory.go• L8-37 db_lib/GitRepository.go• L105-130 db_lib/AnsibleApp.go• L86-109 db_lib/TerraformApp.go• L267-306
Configuration portability
Project backup is a portable description of project configuration and its resource relationships. Export gathers the project graph and replaces project-scoped references with names so another project can rebuild them with new IDs. It carries project metadata, repositories, host mappings, inventories, environments, views, templates, secret storages, access-key identities, roles, runners, workflows, schedules, and event integrations. Schedules and integrations are included only when their template or workflow target is also present in the export. (services/…/backup.go• L139-289, services/…/backup.go• L292-581, services/…/types.go• L46-115)
The backup does not carry credential values, task-bound secret keys, or MCP server tokens. A restored credential keeps its name and type but waits for its owner to provide a value again. MCP server tokens are omitted because the current backup format does not model them as project keys. (services/…/backup.go• L167-181, services/…/backup.go• L337-343, services/…/restore.go• L672-685, services/…/backup_mcp_test.go• L14-51)
Restore creates a new project and rebuilds its configuration in dependency order. It creates the resources that references need first, restores ordinary templates before deploy templates, then reconnects workflows, schedules, and integrations by name. Workflow nodes keep their graph links while their project references are resolved again. (services/…/restore.go• L859-999, services/…/restore.go• L460-567, services/…/restore.go• L707-775)
The import path validates format versions, names, references, host mappings, inventory content, and integration targets before or during restore. If a later step fails, it removes the new project when possible. A role that is missing from the file or whose slug is already held is reported as unassigned instead of receiving an unsafe grant. Older backup versions remain readable through explicit permission and field compatibility rules. (services/…/restore.go• L52-103, services/…/restore.go• L234-264, services/…/restore.go• L346-413, services/…/restore.go• L778-856, services/…/types.go• L46-97)
The recovery boundary is therefore larger than a database copy. It preserves the project’s configuration graph while remapping names to new IDs and retaining compatibility with older backup versions. The project backup and restore page covers the portable format, compatibility rules, and recovery results.
The following flow shows the main relationship between project setup, content preparation, execution, and recovery.
flowchart LR
A[Create project] --> B[Add project resources]
B --> C[Prepare repository and application]
C --> D[Run automation task]
B --> E[Export project configuration]
E --> F[Verify portable content]
F --> G[Restore new project]
G --> B
References: services/…/backup.go• L139-181 services/…/backup.go• L292-581 services/…/restore.go• L778-999 services/…/types.go• L46-115 services/…/backup_test.go• L1128-1195 services/…/backup_mcp_test.go• L14-51
Change checklist
When these files or sections are changed, remember to consider these:
- Update the backup format, its version compatibility, verification rules, and restore order together when a project resource or reference changes.
- Preserve name-based references in exports when project-scoped IDs cannot remain valid after restore. Keep schedules and integrations out of the export when their targets are absent.
- Keep credential mappings portable by exporting identity and type without protected values. Exclude task-secret keys and MCP server tokens, and clear runner tokens on restore.
- Keep workflow-node links and target remapping aligned when templates, inventories, or workflow graph data changes.
- Keep role permission masks and unassigned-role reporting aligned so old files remain readable without granting unknown permissions.
- Keep host mapping and inventory validation aligned between backup verification and normal project creation.
- Keep project deletion and restore cleanup aligned so a failed import does not leave an unintended project behind.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A repository is removed while a template still uses it | The repository cannot be deleted and the template loses no valid source. | Repository deletion checks template use before removal. |
| A project setup step fails | A partial project can remain and mislead later users. | Setup removes the project and reports cleanup failure if removal also fails. |
| A backup uses a newer format or an old format that lacks required role data | Restore may interpret content incorrectly or cannot preserve its access rules. | Version checks and compatibility rules reject unsupported files and handle known older versions. |
| A backup points to a missing repository, inventory, key, template, workflow, or target | Restore cannot rebuild a valid configuration graph. | Verification rejects unresolved references, and export omits schedules or integrations with no restorable target. |
| A backup contains a duplicate or malformed host mapping | Restore could write an invalid host rule or fail after project creation. | Preflight and restore validation reject invalid mappings and whitespace-equivalent duplicates. |
| A role is missing from the file or its slug is already held | Resource grants cannot safely map to the imported project role. | Restore reports the affected template or workflow grants as unassigned. |
| A backup carries a credential value, task-bound secret key, or MCP server token | Protected or run-specific data could cross the project boundary, or a server token could be restored as an invalid project key. | Export omits credential material, task-secret keys, and MCP server tokens. Restored credentials remain empty. |
| A restored runner has no registration token | The runner cannot execute project work until it is registered again. | Restore clears the token and returns the runner as unregistered. |
| A restore step fails after project creation | The new project can remain with incomplete configuration. | Restore deletes the new project when possible and returns a cleanup error when deletion also fails. |
| A checkout is missing or is not a valid Git repository | Content discovery or task preparation cannot read the source. | The repository path is cloned again when validation fails. |
Key files
| File | Why to read it |
|---|---|
| api/…/projects.go | Shows project creation, initial resources, optional demo content, and setup cleanup. |
| api/…/project.go | Shows project access context, updates, deletion, and temporary data cleanup. |
| db/…/project.go | Shows project persistence and dependency-aware deletion. |
| api/…/repository.go | Shows repository ownership, validation, browsing, and cache invalidation. |
| db_lib/GitRepository.go | Shows the source checkout boundary used by browsing and task preparation. |
| db_lib/AppFactory.go | Shows how stored application type selects content preparation behavior. |
| services/…/backup.go | Shows how project configuration becomes portable export content and how unsafe or unresolvable entries are excluded. |
| services/…/restore.go | Shows validation, dependency order, ID remapping, compatibility, and cleanup during restore. |
| services/…/types.go | Defines the portable project graph, format version, and restore result. |
| services/…/backup_test.go | Shows the guarantees for credential handling, references, version compatibility, and restore outcomes. |
| services/…/backup_mcp_test.go | Shows that MCP server tokens stay out of project backups while ordinary project keys remain portable. |
| api/…/backup_restore.go | Shows the API access and feature gates around export and restore. |