From f2d82e16d6434f69d9e764b9d33ed3048044c8d7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 11 Jul 2024 11:30:20 +0200 Subject: [PATCH] fix: remove volumes as well --- app/Actions/Application/StopApplication.php | 8 ++++++-- app/Models/Application.php | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Actions/Application/StopApplication.php b/app/Actions/Application/StopApplication.php index 493f7eee4..5d184091e 100644 --- a/app/Actions/Application/StopApplication.php +++ b/app/Actions/Application/StopApplication.php @@ -39,9 +39,13 @@ public function handle(Application $application) } } if ($application->build_pack === 'dockercompose') { + // remove network $uuid = $application->uuid; - instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server); - instant_remote_process(["docker network rm {$uuid}"], $server); + instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false); + instant_remote_process(["docker network rm {$uuid}"], $server, false); + + // remove volumes + instant_remote_process(["cd {$application->dirOnServer()} && docker compose down -v"], $server, false); } } } diff --git a/app/Models/Application.php b/app/Models/Application.php index 592607698..64dc3d43e 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -778,6 +778,11 @@ public function generateBaseDir(string $uuid) return "/artifacts/{$uuid}"; } + public function dirOnServer() + { + return application_configuration_dir()."/{$this->uuid}"; + } + public function setGitImportSettings(string $deployment_uuid, string $git_clone_command, bool $public = false) { $baseDir = $this->generateBaseDir($deployment_uuid);