Skip to content

Deploy a stack from a Git repository #138

Description

@Nikosan73

Summary

Let a stack pull its compose file from a Git repo, and redeploy when there's a new commit.

Detailed description

I keep all my compose files in GitHub. When I merge a change, I want the stack to pick it up. Right now the plugin has no idea Git exists.

Issue #84 and issue #103 both point the other way. There, the plugin writes the files and Git keeps a record. I'm asking for the reverse. The repo is the source. The plugin reads from it.

What I'm after, roughly:

  • When adding a stack, let me give a repo URL, a branch, and the path to the compose file inside it. A username and token for private repos.
  • The plugin clones it somewhere local and runs compose from that copy.
  • To check for updates, compare the local commit to the head of that branch. Only redeploy if they differ.
  • Trigger it two ways. On a schedule, reusing the auto-update scheduler that's already there. And by hand, with a "Pull and redeploy" item in the stack menu. A webhook would be nice later, but polling on its own would do.
  • If someone edits a Git-backed stack in the editor, warn them the next pull will wipe it.

Portainer does this already, and it's the reason my stacks are still there rather than here. Everything else about this plugin is better.

Alternatives considered

I can clone the repo myself, run git pull && docker compose up -d from cron, and register the stack with an Indirect Path. That works. But the plugin can't tell that the stack came from Git, so the UI never shows whether it's current or behind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions