Skip to content

⚡️ Feature: Pre/Post Deployment Script Support (with Git-backed Scripts) for Containers, Projects, and Swarm #2249

@freedbygrace

Description

@freedbygrace

Feature Description

Introduce support for pre-deployment and post-deployment scripts/commands that can be attached to containers, stacks/projects, and Docker Swarm services within Arcane.

These scripts should:

  • Be defined as reusable script objects

  • Support variables and secrets injection

  • Allow ordered execution

  • Be enabled/disabled without removal either globally or per container, service, stack, deployment

  • Support both:

    • Inline/local scripts
    • Git-backed scripts from a configured repository (branch/tag/path selectable)

This enables Arcane to orchestrate not just deployments, but the full lifecycle preparation and post-processing required for successful service operation.


Problem It Solves

Deployments—especially in Docker Swarm—often require additional steps outside of standard compose definitions, such as:

  • Creating destination directories (Swarm does not behave like standalone Compose)
  • Setting permissions
  • Running initialization or migration tasks
  • Executing post-deployment validation or registration steps

Today, these steps must be handled:

  • Manually
  • Via external tooling (Ansible, scripts, CI/CD pipelines)
  • Or embedded awkwardly into container entrypoints

This leads to:

  • Inconsistent deployments
  • Operational overhead
  • Fragile, non-repeatable workflows
  • Tight coupling between app containers and infrastructure logic

Proposed Solution

  • Define Script Objects:

    • Name, description
    • Execution type (pre/post)
    • Inline script or Git reference
    • Environment variables + secrets
    • Timeout / retry options (optional)
  • Attach scripts to:

    • Containers
    • Projects/Stacks
    • Swarm services
  • Execution Features:

    • Ordered execution (1..N)
    • Toggle enable/disable per script
    • Execution context (host vs container scope—future enhancement)
    • Logging/output capture (future enhancement)

Git-backed Scripts

  • Configure one or more Git repositories in Arcane

  • Reference scripts via:

    • Repo
    • Branch/tag/commit
    • File path
  • Optionally support:

    • Pull/update on deployment
    • Version pinning for deterministic behavior

This allows teams to:

  • Centralize operational logic
  • Version control scripts
  • Reuse across multiple deployments

Alternatives Considered

  • Init containers / sidecars
    Not available in Docker Swarm and adds complexity even where supported.

  • Embedding logic in container entrypoints
    Couples infrastructure concerns with application code and reduces portability.

  • External orchestration tools (Ansible, CI/CD pipelines)
    Adds additional systems to manage and breaks the “single pane of glass” Arcane provides.

  • Manual pre/post steps
    Error-prone and not scalable.

  • Komodo-style implementations
    Similar conceptually, but Arcane can provide a more integrated and flexible model tailored to its architecture.


Additional Context

  • This feature helps normalize behavior differences between Docker Compose and Swarm

  • Aligns with Arcane’s goal of simplifying and centralizing container lifecycle management

  • Opens the door for future enhancements:

    • Script result tracking and logs
    • Conditional execution (based on environment, success/failure, etc.)
    • Integration with event systems (e.g., pub/sub like NATS)
    • Policy-driven deployments

Overall, this would significantly reduce deployment friction while increasing reliability, repeatability, and operational clarity.

Would you be willing to work on this feature?

  • Yes, I'd like to implement this feature
  • I could help with parts of this feature
  • No, I'm just suggesting the feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more upvotesUpvote the issue to show that this is a feature that is wanted.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions