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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
refactor: Simplify log drain installation and stop log drain if necessary
Andras Bacsai74e8a4a70368
diff --git a/app/Actions/Server/InstallLogDrain.php b/app/Actions/Server/InstallLogDrain.phpindex 6f74e020b1..034d89fe7b 100644--- a/app/Actions/Server/InstallLogDrain.php+++ b/app/Actions/Server/InstallLogDrain.php@@ -24,12 +24,7 @@ class InstallLogDrain}try {if ($type === 'none') {- $command = [- "echo 'Stopping old Fluent Bit'",- 'docker rm -f coolify-log-drain || true',- ];-- return instant_remote_process($command, $server);+ return 'No log drain is enabled.';} elseif ($type === 'newrelic') {if (! $server->settings->is_logdrain_newrelic_enabled) {throw new \Exception('New Relic log drain is not enabled.');diff --git a/app/Actions/Server/StopLogDrain.php b/app/Actions/Server/StopLogDrain.phpnew file mode 100644index 0000000000..a5bce94a57--- /dev/null+++ b/app/Actions/Server/StopLogDrain.php@@ -0,0 +1,20 @@+<?php++namespace App\Actions\Server;++use App\Models\Server;+use Lorisleiva\Actions\Concerns\AsAction;++class StopLogDrain+{+ use AsAction;++ public function handle(Server $server)+ {+ try {+ return instant_remote_process(['docker rm -f coolify-log-drain || true'], $server);+ } catch (\Throwable $e) {+ return handleError($e);+ }+ }+}diff --git a/app/Livewire/Server/LogDrains.php b/app/Livewire/Server/LogDrains.phpindex 3d7b34de11..6e09eecdd5 100644--- a/app/Livewire/Server/LogDrains.php+++ b/app/Livewire/Server/LogDrains.php@@ -3,6 +3,7 @@namespace App\Livewire\Server;use App\Actions\Server\InstallLogDrain;+use App\Actions\Server\StopLogDrain;use App\Models\Server;use Livewire\Component;@@ -132,6 +133,9 @@ class LogDrains extends Component'is_logdrain_axiom_enabled' => false,]);}+ if (! $this->server->isLogDrainEnabled()) {+ StopLogDrain::dispatch($this->server);+ }$this->server->settings->save();$this->dispatch('success', 'Settings saved.');