fix(cli): remove profile-deactivated containers before every compose up - #804
Merged
Merged
Conversation
compose up --remove-orphans never removes the container of a service whose profile just went inactive — the service is still in the compose file, so compose does not count it as an orphan. A tari local→remote switch therefore left the old minotari_node running (offline, re-syncing) against a remote-mode config; monerod local→remote had the same latent bug, and the apply-path comment claiming --remove-orphans covered it was wrong (disproven empirically against compose v2 / docker 29.0.1). compose_up_checked now reconciles from the committed .env before the up: every profile-gated service (monerod, tari, wallet-rpc, tari-wallet) whose profile token is absent gets 'compose rm -sf'. The command resolves named services regardless of active profiles and exits 0 when nothing runs, so the steady state is a no-op and a box already stuck with a stale node container heals on its next up. Closes #795 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Two residual observations from an adversarial pass over the parallel (now-closed) #806, both applying to the merged code here:
🤖 Generated with Claude Code |
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.
What
Reproduced #795's root cause empirically:
compose up --remove-orphansnever removes the container of a service whose profile just went inactive — the service is still in the compose file, so compose does not count it as an orphan (verified against compose v2 / docker 29.0.1: a profiled service's running container survives anup --remove-orphanswith the profile off). A tari local→remote switch therefore left the oldminotari_noderunning — offline, flailing, re-syncing into a reclaimed dir — against a remote-mode config. The monerod local→remote path had the same latent bug; the apply-path comment claiming--remove-orphanscovered it was wrong.compose_up_checked(the choke point apply/up/upgrade all route through) now reconciles from the committed.envbefore the up: every profile-gated service (monerod,tari,wallet-rpc,tari-wallet) whose profile token is absent getscompose rm -sf. That command resolves explicitly named services regardless of active profiles and exits 0 when nothing runs, so the steady state is a no-op — and a box already stuck with a stale node container (the #795 bench reproduction) heals on its nextupinstead of needing a manualrm -f. Removal runs BEFORE the up so the old local node never runs beside the remote-mode p2pool. On-disk chain data is untouched, exactly as the apply preview promises.Coverage
Stack tier (
tests/stack/run.sh), driven through the realapplyagainst the docker stub's call log:tarito the removal list, and the removal precedes the recreate up;monerod.docs/configuration.mdalready promises "switch to remote mode and the stack won't run a local one" — this makes the code match the doc, so no doc change.Closes #795
🤖 Generated with Claude Code