coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
34.99k stars 1.92k forks source link

[Bug]: Deleted project still visible in server resources #3747

Closed KaelWD closed 3 weeks ago

KaelWD commented 1 month ago

Error Message and Logs

image

Steps to Reproduce

  1. Create a docker compose project (without git) from https://github.com/Swetrix/selfhosting/blob/main/docker-compose.yml
  2. Delete the project without stopping or deleting any resources first

Example Repository URL

No response

Coolify Version

v4.0.0-beta.355

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 22.04

Additional Information

Looks the same as #1937

shiv122 commented 1 month ago

try triggering docker cleanup and then delete it. it works sometimes. Server> select server > general > setting > Force Docker Cleanup

image

KaelWD commented 1 month ago

I already tried that. I also can't see it in docker images or docker ps -a.

shiv122 commented 1 month ago

yes I'm having same issue , it worked with one, but when you delete the container manually cleanup doesn't work.

iustin05 commented 1 month ago

Same for me, sometimes containers remain on disk..

KaelWD commented 1 month ago

Idk what happened but it's gone now, I'm guessing the automated cleanup does something extra that manual one is missing.

peaklabs-dev commented 1 month ago

I cannot reproduce. If a project has a resource, you cannot delete it and you get this error: Environment has defined resources, please delete them first. Can you help me with more detailed steps on how you managed to delete the project in the first place?

KaelWD commented 1 month ago

I don't know, I never got that warning for some reason. I'll try to reproduce it again when I have time.

KaelWD commented 1 month ago

Yeah it still happens with beta.360.

No error appears, and there is an entry under server -> resources that has no associated project and links to nowhere.

KaelWD commented 1 month ago

DeleteProject only checks for applications, which does not include ones inside services: https://github.com/coollabsio/coolify/blob/dfd218ec064790d214bc57d3d9b3840f35b6a379/app/Livewire/Project/DeleteProject.php#L30-L32

Deleting an environment does all this instead:

https://github.com/coollabsio/coolify/blob/2d3a6a4528cc9e077a5b6c63f7f691f2155ee214/app/Models/Environment.php#L37-L49

Not sure why each database type needs to be a separate relation, you'd think they're just a subclass of Application.

peaklabs-dev commented 1 month ago

Thanks for the details, I can now reproduce it and have fixed this and will PR after some testing.

ohkimur commented 1 month ago

@peaklabs-dev This is still happening. If you go to the dashboard and click on a project, then click delete, it will delete the project but not it's resources.

peaklabs-dev commented 1 month ago

@ohkimur yes because the new version is not out yet.

ohkimur commented 1 month ago

@peaklabs-dev Oh, I see. Thanks for letting me know!