Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

add delete_connected_networks function to services.php

ayntk-ai97c2bedda27f
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 324713bbff..d88e94e19e 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -151,7 +151,6 @@ class Application extends BaseModel
$server = data_get($this, 'destination.server');
$workdir = $this->workdir();
if (str($workdir)->endsWith($this->uuid)) {
- ray('Deleting workdir');
instant_remote_process(['rm -rf ' . $this->workdir()], $server, false);
}
}
@@ -176,7 +175,6 @@ class Application extends BaseModel
public function delete_connected_networks($uuid)
{
$server = data_get($this, 'destination.server');
- ray($uuid);
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
instant_remote_process(["docker network rm {$uuid}"], $server, false);
}
diff --git a/app/Models/Service.php b/app/Models/Service.php
index 33238281e9..f56d05af1f 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -56,7 +56,7 @@ class Service extends BaseModel
$databaseStorages = $this->databases()->get()->pluck('persistentStorages')->flatten()->sortBy('id');
$storages = $applicationStorages->merge($databaseStorages)->implode('updated_at');
- $newConfigHash = $images.$domains.$images.$storages;
+ $newConfigHash = $images . $domains . $images . $storages;
$newConfigHash .= json_encode($this->environment_variables()->get('value')->sort());
$newConfigHash = md5($newConfigHash);
$oldConfigHash = data_get($this, 'config_hash');
@@ -121,13 +121,20 @@ class Service extends BaseModel
public function delete_configurations()
{
- $server = data_get($this, 'server');
+ $server = data_get($this, 'destination.server');
$workdir = $this->workdir();
if (str($workdir)->endsWith($this->uuid)) {
- instant_remote_process(['rm -rf '.$this->workdir()], $server, false);
+ instant_remote_process(['rm -rf ' . $this->workdir()], $server, false);
}
}
+ public function delete_connected_networks($uuid)
+ {
+ $server = data_get($this, 'destination.server');
+ instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
+ instant_remote_process(["docker network rm {$uuid}"], $server, false);
+ }
+
public function status()
{
$applications = $this->applications;
@@ -907,7 +914,7 @@ class Service extends BaseModel
public function workdir()
{
- return service_configuration_dir()."/{$this->uuid}";
+ return service_configuration_dir() . "/{$this->uuid}";
}
public function saveComposeConfigs()