Deploy: remove orphaned containers on compose up - #34
Open
secoro wants to merge 1 commit into
Open
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
=========================================
Coverage 29.51% 29.51%
Complexity 133 133
=========================================
Files 54 54
Lines 1738 1738
Branches 321 321
=========================================
Hits 513 513
Misses 1170 1170
Partials 55 55
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Why
The v1.4.0 deploy failed at checkout with `EACCES: permission denied, rmdir .../backend/deploy/Caddyfile`.
Root cause: when Caddy was removed from the repo (3073111), `docker compose up` left the old `onsinventory-caddy` container behind — compose does not remove services that disappeared from the compose file unless `--remove-orphans` is passed. That container bind-mounted `./deploy/Caddyfile` from the runner workspace; after the file was deleted from git, the Docker daemon recreated the missing mount source as a root-owned directory on container restart, which the runner user can't delete during checkout cleanup.
The one-off cleanup already ran successfully (run 29204400052, dispatched from `debug/clean-caddy-leftovers`): it removed the orphaned container and the root-owned directory, and the deploy went through.
What
Add `--remove-orphans` to the deploy's `docker compose up` so removed services are cleaned up on every deploy and this can't recur.