Add docker cleanup script#492
Conversation
📝 WalkthroughWalkthroughAdds ChangesCoolify Docker cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant CoolifyHost
participant CleanupScript as coolify-docker-cleanup.sh
participant LockFile as flock lock
participant DockerCLI
CoolifyHost->>CleanupScript: Run with retention window
CleanupScript->>LockFile: Acquire exclusive non-blocking lock
CleanupScript->>DockerCLI: Report usage and prune aged resources
DockerCLI-->>CleanupScript: Return cleanup results
CleanupScript-->>CoolifyHost: Log completion without pruning volumes
Suggested labels: 🚥 Pre-merge checks | ✅ 7 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (7 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ops/coolify-docker-cleanup.sh (1)
3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd an ERR trap for better observability.
With
set -e, the script exits immediately on the first failing command, but no cleanup-specific log message is emitted. For a scheduled job, adding anERRtrap makes failures easy to grep in logs and alerts.♻️ Suggested ERR trap
set -euo pipefail + +trap 'log "cleanup failed unexpectedly (exit code: $?)"' ERR🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ops/coolify-docker-cleanup.sh` at line 3, Add an ERR trap immediately after the strict-shell settings in the cleanup script, logging a clear cleanup-specific failure message when any command fails. Include the failing command context and exit status in the log while preserving the existing set -euo pipefail behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@ops/coolify-docker-cleanup.sh`:
- Line 3: Add an ERR trap immediately after the strict-shell settings in the
cleanup script, logging a clear cleanup-specific failure message when any
command fails. Include the failing command context and exit status in the log
while preserving the existing set -euo pipefail behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 3de6c42c-32d3-48ed-9b7f-3357ca4e1a3b
📒 Files selected for processing (2)
docs/ARCHITECTURE.mdops/coolify-docker-cleanup.sh
Why
I HATE PINGS
What
Add a bash script that safely cleans up stale images, networks, containers, old cache, but no volumes. Added docs on how to use it too.
PS: This is all codexed please actually review
Test Plan
Tested with running active forge containers, without them, with both, different amounts and types of images, and ensured expected output in all cases.
Checklist
pnpm db:generateand committed the generated files inpackages/db/drizzle/Summary by CodeRabbit
New Features
Documentation