Skip to content

feat: add label-based reconciliation pause support#25

Closed
veerendra2 wants to merge 3 commits into
mainfrom
feat/pause-reconciliation-label
Closed

feat: add label-based reconciliation pause support#25
veerendra2 wants to merge 3 commits into
mainfrom
feat/pause-reconciliation-label

Conversation

@veerendra2
Copy link
Copy Markdown
Owner

@veerendra2 veerendra2 commented May 29, 2026

Summary

Add support for pausing reconciliation on specific stacks using a label. When a stack has the label composeflux.reconciliation.pause=true, ComposeFlux will skip all reconciliation operations for that stack.

Key feature: Add the label via Docker CLI without modifying Git - perfect for temporary operations like backups.

Problem (Fixes #22)

During database backups (e.g., Kopia backing up PostgreSQL), containers must stay stopped. ComposeFlux should not touch these stacks during reconciliation to prevent data corruption.

Solution

Add a label-based pause mechanism that completely excludes stacks from reconciliation:

  • Label: composeflux.reconciliation.pause=true
  • Behavior: Stack is skipped in all reconciliation operations:
    • ✅ No deployment during Sync()
    • ✅ No image updates during SyncImages()
    • ✅ No pruning even if deleted from Git

Usage

Recommended: Docker CLI (no Git changes)

# Pause reconciliation for a stack
for container in $(docker ps -aq --filter "label=com.docker.compose.project=immich"); do
  docker container update --label-add composeflux.reconciliation.pause=true $container
done

# Resume reconciliation
for container in $(docker ps -aq --filter "label=com.docker.compose.project=immich"); do
  docker container update --label-rm composeflux.reconciliation.pause $container
done

Example: Backup workflow

# 1. Pause reconciliation
for container in $(docker ps -aq --filter "label=com.docker.compose.project=immich"); do
  docker container update --label-add composeflux.reconciliation.pause=true $container
done

# 2. Stop container for backup
docker stop immich-postgres-1

# 3. Run backup
kopia snapshot create /var/lib/postgresql/data

# 4. Resume reconciliation and restart
for container in $(docker ps -aq --filter "label=com.docker.compose.project=immich"); do
  docker container update --label-rm composeflux.reconciliation.pause $container
done
docker start immich-postgres-1

Alternative: Compose file (permanent pause)

name: immich
labels:
  composeflux.reconciliation.pause: "true"
services:
  postgres:
    image: postgres:16

Changes

  • Add LabelReconciliationPause constant
  • Add isReconciliationPaused() helper function
  • Check pause label in Sync(), SyncImages(), and Prune()
  • Log when stacks are skipped due to pause label
  • Add documentation with Docker CLI examples

Files Changed

  • internal/reconcile/deploy.go - Add label constant
  • internal/reconcile/prune.go - Add helper function, skip paused stacks
  • internal/reconcile/sync.go - Skip paused stacks in sync and image updates
  • docs/Introduction.md - Document pause label feature
  • docs/index.md - Add GitHub badge

🤖 Generated with Claude Code

Add support for pausing reconciliation on specific stacks using a label.
When a stack has the label 'composeflux.reconciliation.pause=true',
ComposeFlux will skip all reconciliation operations for that stack.

Use case:
- Database backups (e.g., Kopia backing up PostgreSQL)
- Maintenance operations requiring containers to stay stopped
- Temporary exclusion from automated deployments

Changes:
- Add LabelReconciliationPause constant
- Add isReconciliationPaused() helper function
- Skip paused stacks in Sync() - no deployment
- Skip paused stacks in SyncImages() - no image updates
- Skip paused stacks in Prune() - no removal even if deleted from Git

Usage:
Add label to compose file or via Docker CLI:
  labels:
    composeflux.reconciliation.pause: "true"

Or using Docker CLI:
  docker container update --label-add composeflux.reconciliation.pause=true <container>

Fixes #22

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add GitHub repo badge to docs/index.md
- Document the pause label feature in Introduction.md
- Emphasize Docker CLI usage (no Git changes required)
- Include usage examples for Docker CLI and backup scenarios
- Show compose file option as alternative for permanent pause

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@veerendra2 veerendra2 force-pushed the feat/pause-reconciliation-label branch from 32c9c36 to bc177da Compare May 29, 2026 18:36
ContainerPrune removes ALL stopped containers, including those from
paused stacks (composeflux.reconciliation.pause=true). This would
delete containers stopped for backups or maintenance.

ComposeFlux already manages container lifecycle via Down() in the
Prune() function, so ContainerPrune is not needed.

Changes:
- Comment out ContainerPrune call with explanation
- Add reference to issue #22
- Keep other resource pruning (images, volumes, networks, build cache)

Fixes #22

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@veerendra2 veerendra2 added the build Builds dev docker image label May 29, 2026
@veerendra2
Copy link
Copy Markdown
Owner Author

Closing this PR. After testing, simply disabling ContainerPrune is sufficient to solve the issue. The label-based pause feature is not needed. See #26 for the simpler solution.

@veerendra2 veerendra2 closed this May 29, 2026
@veerendra2 veerendra2 removed the build Builds dev docker image label May 29, 2026
@veerendra2 veerendra2 deleted the feat/pause-reconciliation-label branch May 29, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add suspend reconciliation support for stacks

1 participant