Unable to delete remote server
To Reproduce
- create a remove server
- create a service with the server
- shut down the remove server
- remove service,this operation will keep stuck, then refresh the page
- you will get a empty service, and the server cannot be deleted, indicating that there are still associated services
Current vs. Expected behavior
delete the remote server which already has no service
Provide environment information
Remote Server OS: Ubuntu 24.04 LTS
Remote Server Arch: x86_64
Remote Server Provider: Tencent
Dokploy version: v0.21.7
Which area(s) are affected? (Select all that apply)
Remote server
Are you deploying the applications where Dokploy is installed or on a remote server?
Remote server
Additional context
Will you send a PR to fix it?
No
I tested the same steps and it works fine, although the server is down, it is likely that when you try to delete it you have some very long loading, but if you reload the page you will notice that the application was really deleted https://github.com/Dokploy/dokploy/blob/canary/apps/dokploy/server/api/routers/application.ts#L190-L215, you can also check the delete and you will notice that the first thing we delete is the application so it is always deleted first, if it still appears that you have associated services is because you really have other applications, compose or databases associated with that server.
The application is indeed deleted and not visible on the page, but the service it actually corresponds to in the dokploy database still exists, so it is not possible to delete the remote server. The way I solved this the other day was to directly manipulate the dokploy database to remove the corresponding service.
I can not replicate this problem, because if a service is removed and in the UI is not shown is because the service is really removed and should not exist in the database, if you have a server with this problem you can enter the discord and I can take a look,
beyond that this is the query that shows the alert based on the count, if a service has a server assigned it will count it if it is 0 there is no associated service you can check this query https://github.com/Dokploy/dokploy/blob/canary/apps/dokploy/server/api/routers/server.ts#L87-L103
If you have another way to reproduce it I can take a look but it works for me.
I re-looked at the structure of the database, and the table I was working on was the application table, and deleting the corresponding records solved the problem. But the strange thing is why the records exist in the database but are not displayed on the page?
I honestly don't have much idea what might be going on, I haven't seen anyone else report this problem so it might be something isolated on your machine
Well I will close this issue, as no one else has reported anything similar, nor have I experienced i