feat: proactive stack health reconciliation and periodic Docker resource pruning#47
Draft
veerendra2 wants to merge 3 commits into
Draft
feat: proactive stack health reconciliation and periodic Docker resource pruning#47veerendra2 wants to merge 3 commits into
veerendra2 wants to merge 3 commits into
Conversation
…rce pruning - Add health reconciliation loop (HEALTH_RECONCILE_INTERVAL, default 5m) that detects and redeploys stacks with Status != Running or any exited/dead container - Add periodic Docker resource prune loop (PRUNE_INTERVAL, default 24h) that only fires when all managed stacks are healthy - Add composeflux.suspend=true label support: any stack with this label on any container is skipped by both loops; prune is aborted entirely if any stack is suspended - Move inline dClient.Prune() out of Prune() into the dedicated scheduled loop so pruning is always gated on stack health - Update docs: new env vars, new Introduction sections, remove outdated limitation Closes #31 Co-Authored-By: Claude <noreply@anthropic.com>
…control PRUNE_INTERVAL unset/empty disables pruning. PRUNE_RESOURCES is removed. Co-Authored-By: Claude <noreply@anthropic.com>
- Fix stack existence check before calling Ps() in health and prune loops (prevents errors on bootstrap when stacks not yet deployed) - Fix empty container list handling in isStackHealthy (stack with zero containers is unhealthy) - Add deprecation warning for removed PRUNE_RESOURCES env var - Fix docs: PRUNE_INTERVAL requires 0 to disable, not unset Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #31
Summary
HEALTH_RECONCILE_INTERVAL, default5m): periodically checks all managed stacks and redeploys any whereStatus != Runningor any container isexited/dead. Skips stacks withrestartingcontainers (Docker restart policy is doing its job).PRUNE_INTERVAL, default24h): prunes unused images, volumes, and build cache — but only when all managed stacks are healthy. If any stack is degraded or suspended, the cycle is skipped.composeflux.suspend=true): set viadocker update --label-addon any container to pause reconciliation for the entire stack. Both the health loop and prune loop respect it. Useful during maintenance (e.g., stopping a DB for backups without triggering a reconcile).dClient.Prune()out ofPrune()into the dedicated scheduled loop so pruning is always gated on health.How to Test
Health reconciliation:
Suspend label:
Prune loop:
🤖 Generated with Claude Code