Introducing a new way to review your PRs.

Read the announcement

getarcaneapp / arcane

Modern Docker Management, Designed for Everyone

View on GitHub

26 documents · Updated Oct 19, 2026

docs / gitops-and-project-automation

GitOps and project automation

Arcane connects Git repositories to workload deployment and project backup. A tracked Compose definition can become the source for a project or a Swarm stack. Selected project files can also be committed back to a repository. Arcane stores reusable repository access, records each result, and repeats either direction on a schedule or after a project save. For detailed project and repository lifecycle flows, see Projects, repositories, and buildables.

Automation model

Repository sources

A Git repository is a reusable source record for deployment and backup workflows. It identifies a remote URL, the access method, and whether the source is enabled. HTTP tokens and SSH keys are protected when Arcane stores them. Connection tests, branch discovery, and file browsing help an operator confirm the source before creating automation. Backup also needs permission to create commits and push to the selected branch.

The repository record is separate from a sync. This lets several syncs use one source while choosing different branches or Compose files. In a manager-and-agent setup, a repository list can also be reconciled to an agent so the agent has the same source records and credentials.

References: backend/…/model.go• L5-17 backend/…/service.go• L44-70 backend/…/service.go• L117-171 backend/…/service.go• L448-469

GitOps syncs

A GitOps sync is the automation contract between one environment, one repository, and one project or stack. A deployment sync reads a selected branch and Compose definition into a workload. A backup sync reads selected project files and writes them to a repository branch. Both keep the last known commit, file set, result, and error so the source and applied state can be compared.

Deployment syncs support two file scopes. Single-file mode applies the Compose file and any matching Compose override. It rejects a .env that selects more Compose or environment files because those files are not part of the single-file scope. Directory mode stages the surrounding files and subdirectories, validates the complete tree, and removes tracked files that no longer exist in the source. Untracked project data stays outside that scope. Root environment files use Arcane's merge rules so local values can remain as an overlay instead of being replaced by a raw repository copy.

If a run is interrupted after it pins a source revision, recovery uses that same revision instead of silently applying a newer branch head. This keeps a retry tied to the source that the interrupted run had already recorded.

This diagram shows how a repository revision becomes a managed workload.

flowchart LR
    R[Git repository] --> C[Selected branch and commit]
    C --> F[Compose file and optional files]
    F --> V[Validation and staging]
    V --> T{Deployment target}
    T -->|project| P[Arcane project]
    T -->|swarm stack| S[Swarm stack]
    P --> D[Deploy or redeploy]
    S --> D
    D --> Q[Sync status and audit event]

References: types/…/gitops.go• L58-237 backend/…/service.go• L123-237 backend/…/service.go• L266-355 backend/…/service.go• L358-432 backend/…/service.go• L472-557 backend/…/service.go• L751-917

Git backups

A Git backup sync makes a project's selected files available as a versioned branch directory. It always includes the project Compose file and its supported sibling override files. It then adds the configured files or directories. Sensitive environment files and Arcane scratch data stay out of the snapshot.

The backup compares the project snapshot with the last snapshot it pushed. If the remote backup directory changed since that point, it stops with a conflict instead of overwriting another writer's changes. An operator can preview the changes, review directory history and file diffs, then choose to apply the Arcane snapshot. The backup destination must not overlap another backup on the same branch.

This diagram shows how a project save or manual run becomes a safe Git backup.

flowchart LR
    P[Project files] --> S[Stable file snapshot]
    S --> C{Remote backup state}
    C -->|unchanged| W[Commit and push]
    C -->|changed by another writer| X[Conflict for review]
    X --> A[Explicit Arcane adoption]
    A --> W
    W --> H[Backup status and history]

References: backend/…/service.go• L102-153 backend/…/service.go• L195-262 backend/…/service.go• L264-403 backend/…/service.go• L481-523 backend/…/service.go• L562-663

Project bindings

The first successful deployment sync creates or finds the project and records a two-way binding. The sync points to the project and the project records which sync manages it. Arcane writes this relationship as one domain operation and rejects a project already claimed by another sync. A backup sync links to a project for file capture but does not make that project deployment-managed.

Startup reconciliation can recover a directory-sync project when its stored link is missing but one safe, unique project directory matches the sync. Arcane refuses ambiguous matches. A broken binding or a name collision does not create a suffixed duplicate. It records the failure and disables automatic runs until the operator repairs the relationship.

A bound project treats the Git revision as its configuration source. A changed sync updates Compose, environment, and override files. It refreshes project metadata and redeploys only when the project is already running and managed content changed. GitOps deployment also removes orphan services so the running workload follows the tracked Compose definition. When the sync is removed, Arcane clears the project's managed marker so the project does not retain a broken owner.

After a managed project changes, Arcane redeploys it when it is running or when the sync requests redeployment. A stopped project is not started by default. A sync can instead request an image pull so its next start does not depend on an image tag that changed upstream.

Project list and detail views combine stored project data with live Compose state. They expose the current source owner, Git revision, service status, image update state, and project tags so an operator can distinguish tracked configuration from runtime state.

Project deployment prepares missing bind sources inside the project before containers start. This keeps those directories owned by the Arcane runtime instead of letting the container engine create them with a different owner.

Git-supplied project updates validate the resulting Compose view before changing the project. Arcane keeps a file backup for recovery and applies environment selection before the Compose file so the selected source remains consistent. A successful file update refreshes project metadata and signals file subscribers, which lets save-triggered backup work without polling. A GitOps-managed project also rejects direct image-tag edits because the repository remains the source for those changes.

Compose path resolution honors an explicit COMPOSE_FILE selection first. If no such selection exists, a GitOps-managed project uses the Compose path from its sync before normal file detection. Project views expose the management marker and current Git information so operators can see which source controls the workload.

For the detailed project and repository lifecycle flows, see Projects, repositories, and buildables.

References: backend/…/service.go• L135-227 backend/…/service.go• L229-287 backend/…/service.go• L597-724 backend/…/service.go• L845-987 backend/…/service.go• L147-171 backend/…/service.go• L225-264 backend/…/service.go• L281-347 backend/…/service.go• L23-78 backend/…/service.go• L138-300 backend/…/service.go• L534-614 backend/…/service.go• L103-135 backend/…/service.go• L358-432 backend/…/service.go• L589-705 backend/…/service.go• L777-917

Scheduling and control

Automatic sync scheduling

Automatic sync turns a sync interval into a dynamic job owned by that sync. Each scheduled run uses the shared gitops-sync workflow. Transient clone failures retry while the run keeps its pinned source revision. The scheduler re-reads the sync before each run, so disabling or deleting the record stops future work. Startup restores jobs for enabled syncs, removes orphaned jobs and scratch data, and starts an overdue sync without waiting for another full interval.

Manual triggers and scheduled triggers use the same sync operation. Project saves can mark a backup pending and submit a debounced run when save-triggered backup is enabled. An admission guard allows only one run for a sync at a time. This prevents a manual request, startup kick, webhook, timer fire, or save trigger from racing over the same clone or deployment.

The scheduler supports both fixed recurring jobs and the wider set of platform jobs. It exposes whether a job is enabled, whether it can run manually, and when it is expected to run. This gives the product one place to show and control background work without changing the deployment contract.

References: backend/…/service.go• L216-320 backend/…/service.go• L762-823 backend/…/service.go• L852-961 backend/…/service.go• L1095-1134 backend/…/entityjobs.go• L17-107 backend/…/scheduler.go• L201-224 types/…/job.go• L1-75 types/…/project.go• L1-40

Sync status

Each sync exposes the last attempt and the last successful revision as separate signals. Operators can use the result, error, timestamp, commit, and next-run estimate to tell whether the source was reached, whether the workload was applied, and whether automation remains active. Backup syncs also expose pending, conflict, failure reason, and last-backup state so a remote change is not confused with a transport failure.

Admitted sync runs also carry source, mode, target, and outcome telemetry. This lets operators correlate a failed or skipped run with the automation record without changing the deployment result shown to the user.

The sync interface supports list and count views, create, update, delete, manual run, status lookup, repository file browsing, backup preview, backup conflict resolution, backup history, revision diffs, and bulk import. These operations are scoped to an environment for deployment work. Repository administration remains a separate global source-management flow. Backup-mode operations require the dedicated backup permission, while pre-deploy hook configuration requires the separate lifecycle permission.

References: backend/…/handler.go• L107-146 backend/…/handler.go• L148-410 backend/…/service.go• L762-849 types/…/gitops.go• L240-256 types/…/gitops.go• L777-813

Pre-deploy lifecycle hooks

A pre-deploy lifecycle hook is an optional script from the synced repository that runs in a temporary runner before a project deploy. It can prepare files or values that the Compose load needs. It is treated as trusted repository code because its configured environment, mounts, image, and network mode shape what it can do. The script must be part of a full directory sync and cannot be used for a Swarm stack sync.

The hook is limited to project syncs. Its script path must stay inside the synced project files and must identify a real file rather than a directory or symlink. Its runner image is required and its time is bounded. Its default network mode is none. Configuration has a separate lifecycle permission and a global enable switch because a hook can run with host mounts or explicit network access. A non-zero exit, timeout, or runner failure stops the deploy and records the hook result for review.

References: backend/…/service.go• L118-177 backend/…/service.go• L422-484 backend/…/service.go• L845-987 backend/…/service.go• L138-291 backend/…/service.go• L294-335 types/…/gitops.go• L429-467

Build and workspace support

Project builds

Projects can include services that build images from their Compose build definitions. Project deployment selects whether each service image is built, pulled, or required to exist locally. It then passes the build context and build settings to the configured build service. This makes a project a delivery unit for both prebuilt images and source-built services.

Build behavior is separate from GitOps source selection. GitOps supplies the Compose tree and can cause a managed project to redeploy. The project build path decides how that Compose tree becomes service images, with streamed progress for the operator. The same project contract therefore supports repository-delivered Compose files with local or remote image build providers.

When project files change, Arcane refreshes the image references used by update views. If the Compose model cannot load, it clears stale runtime image references but keeps build-image references so source-built services remain visible for update checks.

References: backend/…/service.go• L31-100 backend/…/service.go• L1054-1154 types/…/project.go• L140-162 backend/…/handler.go• L840-870 backend/…/service_test.go• L218-335

Project workspaces

A project workspace gives an operator a view of the files that support a project and a controlled way to change operator-owned files. For a GitOps-managed project, files that the sync writes are visible but read-only because the repository is their source of truth. Other files remain available for local overlays such as private environment data.

Workspace changes use a file-tree revision and safe project-relative paths. The service rejects changes that touch a sync-owned file or a directory that contains one. It validates and rolls back the remaining changes as one workspace operation. A missing or unreadable ownership list fails closed so a local edit cannot be silently replaced by the next sync. Successful workspace saves notify backup subscribers.

References: backend/…/service.go• L39-113 backend/…/service.go• L131-188 backend/…/service.go• L237-283 backend/…/service_test.go• L111-141 frontend/…/+page.svelte• L257-340 frontend/…/+page.svelte• L724-815 frontend/…/+page.svelte• L99-157 frontend/…/+page.svelte• L264-317

Build workspaces

A build workspace is a controlled file area for manual build inputs. It supports browsing, reading, downloading, uploading, creating directories, and deleting paths under a configured absolute root. The workspace is not the Git repository source and does not change a project until another build or deployment flow consumes its files.

Path checks keep workspace operations inside that root, and upload names cannot contain path separators. The manual build workspace can use those files or a remote build context. It presents build settings, provider choices, live output, and build history as one operator flow. A build can load images locally or push them to a configured registry when the selected provider supports that result.

References: backend/…/workspace_service.go• L23-56 backend/…/workspace_service.go• L59-107 backend/…/workspace_service.go• L110-182 backend/…/workspace_handler.go• L24-87 frontend/…/build-workspace-service.ts• L7-67 frontend/…/+page.svelte• L44-73 frontend/…/+page.svelte• L267-335 frontend/…/+page.svelte• L510-615

Buildable features

Buildable features are optional capabilities selected when the application is built. The feature list controls whether a capability is exposed, while the non-buildable build keeps the same references safe but does not expose those features. This mechanism is distinct from building a project service image.

The current route example is an optional auto-login capability. It is registered only when both the build tag and the feature name are active, and it still checks the normal authentication service and local authentication rules.

References: backend/…/buildables.go• L1-20 backend/…/disabled.go• L1-12 backend/…/buildables.go• L21-26 backend/…/buildables_router_bootstrap.go• L1-14

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep repository credential fields and manager-to-agent repository payloads aligned. A changed access field must remain protected in storage and usable by clone, branch, browse, test, checkout, and push operations.
  • Keep sync mode contracts aligned across deployment and backup create, update, run, status, and persistence flows. Mode-specific fields must not cross between a deployment sync and a backup sync.
  • Keep directory-sync staging, stale-file cleanup, Compose validation, and root environment merging aligned. A new tracked file type needs an explicit raw-write, merge, or exclusion rule.
  • Keep backup path selection aligned with Compose and environment exclusions. A new project file type needs an explicit decision about whether it can be committed.
  • Keep backup conflict state and snapshot state aligned with preview, resolve, status, and history views. A conflict must not clear through an unrelated sync update.
  • Keep the sync-owned file list aligned with workspace read-only checks and the project editor. A missing or malformed ownership list must not make repository-controlled files editable.
  • Preserve the two-way project binding and its cache when changing GitOps project creation, linking, recovery, or deletion. GitOps-managed projects must not lose their owner when a sync is removed.
  • Keep GitOps Compose path resolution aligned with COMPOSE_FILE selection and project detail content. A change in precedence can make the UI show or deploy a different file than the sync controls.
  • Keep Git sync file validation, backup recovery, environment selection, and override handling aligned. A partial update must not leave the project using a different Compose source than the sync result.
  • Keep the project file-change signal aligned with save-triggered backup behavior. A successful Git sync or project save must not silently skip the event that starts backup work.
  • Keep GitOps ownership aligned with image-tag update paths. Repository-managed image changes must not be written through the local project update flow.
  • Keep Compose-owned and UI-owned project tags separate. A Compose tag must remain read-only in the UI while UI tags keep their per-project limit and shared color rules.
  • Keep project creation collision behavior aligned with GitOps binding recovery. A broken binding must not create a suffixed duplicate that hides the original project directory.
  • Reconcile the dynamic scheduler job when changing auto-sync, its interval, or save-triggered backup. Startup recovery, revision retry, and record deletion must use the same job identity.
  • Treat lifecycle hook fields as one security contract. Changes to permissions, validation, runner settings, mounts, or network mode can change what repository code can execute.
  • Keep lifecycle hook failure state aligned with sync status. A file update followed by a failed redeploy must remain visible as a failed deployment rather than as an unqualified success.
  • Keep deployment-time bind-source preparation aligned with Compose host-path rules and project-root safety. A change must not move directory creation to the container engine or affect read-only project loads.
  • Keep build workspace root and path checks consistent across browse, upload, create, and delete operations. A new file operation must use the same root confinement rules.
  • Keep manual build context, provider, push, and load choices aligned with the image-build API. Provider-specific limits must be checked before a request is sent.

Important failure modes

TriggerConsequenceGuard
Repository clone or authentication failsThe sync does not apply new files or push a backup and records the failed attemptTest the repository connection and keep the last sync error visible
The configured Compose path is absentNo project or stack update occursValidate the path during source preparation before reading or deploying
A single-file .env selects extra Compose or environment filesThe sync could deploy an incomplete file setRequire directory sync when the source needs additional files
Synced Compose or environment content fails validation or file updateThe project could run a partial or invalid sourceValidate before writing and restore saved project files when an update fails
A retry uses a newer branch head than the interrupted runRecovery can report success for a different source than the one that started the runStore and replay the pinned revision for the interrupted run
Two sync triggers overlapClone, file promotion, commit, or redeploy work could raceThe per-sync admission gate returns an in-progress result and skips the second run
A directory sync removes a tracked file that remains needed by ComposeThe project can fail validation or lose a required includeValidate the staged final tree before promoting it
The remote backup directory changed after the last backupA backup could overwrite another writer's changesCompare remote files with the last pushed snapshot and require explicit adoption
The backup destination overlaps another backup on the branchTwo backups could delete or claim each other's filesReject overlapping backup directories during create and update
A project binding points to another syncThe wrong automation could control the same projectProject linking rejects an existing binding owned by a different sync
A GitOps-managed project is edited through local image-tag updateThe local edit would diverge from the repository sourceRequire image-tag changes in the source repository
A deployment sync creates a project where its directory already existsA suffixed duplicate could hide a broken bindingGitOps creation refuses the duplicate and disables auto-sync
A bound project is missing and recovery finds no unique candidateAutomatic sync could attach to the wrong directory or create a hidden duplicateRecord a broken binding and disable auto-sync until the operator repairs it
A sync is deleted while its job still existsThe job could continue to fire or leave a stale project ownerDelete unregisters the job and clears project markers before removing the sync
A lifecycle script is set for a Swarm stack or is not included in the syncThe hook cannot run against the intended sourceRequire a project target and full directory sync during validation
A lifecycle hook exits with an error or times outThe project file update can succeed while the requested redeploy remains failedRecord the hook result and keep the sync failure visible
A sync directory exceeds file or size limitsThe source is not safely promoted to the project or backupEnvironment and per-sync limits bound file count and byte size
A project Compose file cannot load after a file changeRuntime image references become stale, while build-image update checks must remain availableClear runtime references and preserve the stored build-image references
A workspace change touches a GitOps-owned fileA local edit could be overwritten by the next syncWorkspace ownership checks reject direct and directory-level changes
A Compose-owned tag is changed through the project UIThe project tag state can diverge from the tracked Compose metadataReject UI changes for Compose-owned tags and update them in the source
The builds directory is relative or a path escapes its rootManual build files could be written outside the intended workspaceThe workspace requires an absolute root and sanitizes every path
A manual build sends options that its provider does not supportThe build request can fail after the operator selects an invalid combinationThe build form validates provider compatibility before it starts the streamed build

Key files

FileWhy to read it
types/…/gitops.goShared contract for repositories, syncs, results, status, branches, and file browsing
backend/…/service.goRepository source lifecycle, credential use, Git inspection, and manager-to-agent reconciliation
backend/…/service.goGitOps sync coordination, persistence, scheduling, status, workflow runs, and backup triggers
backend/…/service.goDeployment source preparation, project or stack delivery, directory staging, binding recovery, revision recovery, and redeploy behavior
backend/…/service.goProject snapshot, conflict handling, backup-on-save behavior, and backup history
backend/…/git_write.goSafe repository checkout, file collection, commit, push, history, and diff behavior
backend/…/handler.goSecured API surface for repository-connected sync operations and mode-specific permissions
backend/…/service.goGitOps/project binding, safe project creation, Compose file selection, project-level Compose loading, lifecycle hooks, and image-reference refresh behavior
backend/…/service.goProject Compose view, runtime service state, include files, and image update context
backend/…/service.goProject discovery views, live workload status, archived state, and GitOps-aware list data
backend/…/service.goGit and local environment sources and the effective environment used by a project
backend/…/service.goSeparation of Compose-owned and UI-owned project tags
backend/…/service.goProject workspace boundaries and protection for GitOps-owned files
backend/…/service.goImage pulls, builds, dependent services, and safe bind-directory preparation
backend/…/service.goProject image update rules and protection of GitOps-owned Compose sources
backend/…/service.goPre-deploy hook runner boundary, output, and failure state
backend/…/handler.goProject API actions, streamed deployment operations, and workspace updates
backend/…/service_test.goCross-feature guarantees for project updates, image handling, workspace protection, and operation recovery
backend/…/entityjobs.goDynamic per-sync job registration and single-run admission
backend/…/scheduler.goShared scheduling model for recurring and manually runnable background work
backend/…/workspace_service.goManual build workspace boundary and file operations
frontend/…/+page.svelteManual build contexts, provider selection, streamed output, and build history
backend/…/buildables.goOptional build-time feature selection