Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volumes are not cleaned up #2729

Closed
andrasbacsai opened this issue Jun 30, 2024 — with Linear · 6 comments · Fixed by #2789
Closed

Volumes are not cleaned up #2729

andrasbacsai opened this issue Jun 30, 2024 — with Linear · 6 comments · Fixed by #2789
Assignees
Labels
🐛 Bug Reported issues that need to be reproduced by the team.

Comments

Copy link
Member

  • Create a docker compose app via private github.
  • Delete it
  • Check if volume is still exists
@andrasbacsai andrasbacsai added 🐛 Bug Reported issues that need to be reproduced by the team. 🚧 Next Issues and PRs planned for the next release. labels Jun 30, 2024 — with Linear
@andrasbacsai andrasbacsai self-assigned this Jun 30, 2024
@ingokpp
Copy link

ingokpp commented Jun 30, 2024

I created an empty repo (private) with the following compose file. After deploying, i ran docker volume ls which includes "listmonk-data". After deleting the resource the volume still remains.

Edit: So i noticed that Coolify doesn't add the resource’s UUID to the volume name.
Edit Edit: Own defined network names also don't get the UUID name

@sukhcha-in
Copy link

I am using docker compose, unused images and networks are not being cleaned as well.

@peaklabs-dev
Copy link
Member

Same for networks: #2546

@ingokpp
Copy link

ingokpp commented Jul 5, 2024

Any news on this?

@Djemai-Samy
Copy link

Same for preview deployments. They are deleted from the Coolify dashboard, but the containers are still running on the server.

@jSchenkel
Copy link

Hello! I'm currently developing an AI tool that investigates issues, and I used this issue as a test to see if it could help. Below are the findings, which I hope might assist in resolving this issue faster.

Boosterbot.ai Findings

The root cause of the bug is the absence of explicit error handling and logging in the volume cleanup process. While the deleting event in the Application model attempts to remove Docker volumes, there is no confirmation of success or failure, leading to potential leftover volumes. Additionally, other related classes and methods do not include volume cleanup commands, contributing to the issue.

  1. Identify the code responsible for handling the deletion of Docker Compose applications.
    The DeleteService class in app/Actions/Service/DeleteService.php is responsible for handling the deletion of services, including Docker Compose applications. The handle method includes logic for deleting environment variables, applications, databases, and scheduled tasks associated with the service. It also constructs Docker CLI commands to remove volumes using docker volume rm -f $storage->name and executes them using instant_remote_process. However, there is no explicit check to ensure these commands are executed successfully.
  2. Verify if there are any steps or commands in the identified code that handle the cleanup of Docker volumes.
    The StopApplication class in app/Actions/Application/StopApplication.php and StopApplicationOneServer.php handle stopping applications but do not include commands to remove Docker volumes. The DeleteResourceJob class in app/Jobs/DeleteResourceJob.php calls StopApplication::run, StopDatabase::run, and DeleteService::run, but none of these actions explicitly handle Docker volume cleanup. The delete_configurations method in the Service model (app/Models/Service.php) removes the working directory but does not handle Docker volumes.
  3. Check if the volume cleanup steps or commands are being executed correctly.
    The deleting event in the Application model (app/Models/Application.php) includes logic to remove Docker volumes using docker volume rm -f $storage->name via instant_remote_process. However, there is no explicit error handling or logging to confirm the success of these commands. The StopDatabase class in app/Actions/Database/StopDatabase.php stops database containers but does not handle volume cleanup. The CleanupStuckedResources command in app/Console/Commands/CleanupStuckedResources.php does not address Docker volume cleanup.

These suggestions are automatically generated based on the context of the issue description and repository code. I'm actively looking for feedback to improve the tool's accuracy and relevance, so any insights you might have are greatly appreciated!

@andrasbacsai andrasbacsai removed the 🚧 Next Issues and PRs planned for the next release. label Jul 15, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 Bug Reported issues that need to be reproduced by the team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants