dokploy icon indicating copy to clipboard operation
dokploy copied to clipboard

Unable to delete remote server

Open LovesAsuna opened this issue 8 months ago • 5 comments

To Reproduce

  1. create a remove server
  2. create a service with the server
  3. shut down the remove server
  4. remove service,this operation will keep stuck, then refresh the page
  5. 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

Image

Will you send a PR to fix it?

No

LovesAsuna avatar Apr 23 '25 05:04 LovesAsuna

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.

Siumauricio avatar Apr 27 '25 01:04 Siumauricio

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.

LovesAsuna avatar Apr 27 '25 01:04 LovesAsuna

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.

Siumauricio avatar Apr 27 '25 02:04 Siumauricio

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?

LovesAsuna avatar Apr 27 '25 02:04 LovesAsuna

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

Siumauricio avatar May 17 '25 22:05 Siumauricio

Well I will close this issue, as no one else has reported anything similar, nor have I experienced i

Siumauricio avatar Jun 20 '25 05:06 Siumauricio