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 Livewire Server Advanced and Form components
Andras Bacsai6545d04c465e
diff --git a/app/Livewire/Server/Advanced.php b/app/Livewire/Server/Advanced.phpindex 0103ac5f6b..b8003803a6 100644--- a/app/Livewire/Server/Advanced.php+++ b/app/Livewire/Server/Advanced.php@@ -2,12 +2,14 @@namespace App\Livewire\Server;+use App\Jobs\DockerCleanupJob;use App\Models\Server;use Livewire\Component;class Advanced extends Component{public Server $server;+protected $rules = ['server.settings.concurrent_builds' => 'required|integer|min:1','server.settings.dynamic_timeout' => 'required|integer|min:1',@@ -28,6 +30,7 @@ class Advanced extends Component'server.settings.delete_unused_volumes' => 'Delete Unused Volumes','server.settings.delete_unused_networks' => 'Delete Unused Networks',];+public function instantSave(){try {@@ -37,9 +40,21 @@ class Advanced extends Component$this->dispatch('refreshServerShow');} catch (\Throwable $e) {$this->server->settings->refresh();++ return handleError($e, $this);+ }+ }++ public function manualCleanup()+ {+ try {+ DockerCleanupJob::dispatch($this->server, true);+ $this->dispatch('success', 'Manual cleanup job started. Depending on the amount of data, this might take a while.');+ } catch (\Throwable $e) {return handleError($e, $this);}}+public function submit(){try {@@ -54,6 +69,7 @@ class Advanced extends Componentreturn handleError($e, $this);}}+public function render(){return view('livewire.server.advanced');diff --git a/app/Livewire/Server/Form.php b/app/Livewire/Server/Form.phpindex 109306e540..a2f04074a2 100644--- a/app/Livewire/Server/Form.php+++ b/app/Livewire/Server/Form.php@@ -4,8 +4,6 @@ namespace App\Livewire\Server;use App\Actions\Server\StartSentinel;use App\Actions\Server\StopSentinel;-use App\Jobs\DockerCleanupJob;-use App\Jobs\PullSentinelImageJob;use App\Models\Server;use Livewire\Component;@@ -172,30 +170,7 @@ class Form extends Component$this->server->save();$this->dispatch('success', 'Server updated.');$this->dispatch('refreshServerShow');-- // if ($this->server->isSentinelEnabled()) {- // StartSentinel::run($this->server);- // } else {- // StopSentinel::run($this->server);- // $this->server->settings->is_metrics_enabled = false;- // $this->server->settings->save();- // $this->server->sentinelHeartbeat(isReset: true);- // }- // if ($this->server->isSentinelEnabled()) {- // PullSentinelImageJob::dispatchSync($this->server);- // ray('Sentinel is enabled');- // if ($this->server->settings->isDirty('is_metrics_enabled')) {- // $this->dispatch('reloadWindow');- // }- // if ($this->server->settings->isDirty('is_sentinel_enabled') && $this->server->settings->is_sentinel_enabled === true) {- // ray('Starting sentinel');- // }- // } else {- // ray('Sentinel is not enabled');- // StopSentinel::dispatch($this->server);- // }$this->server->settings->save();- // $this->checkPortForServerApi();} catch (\Throwable $e) {$this->server->settings->refresh();@@ -272,11 +247,11 @@ class Form extends Component}refresh_server_connection($this->server->privateKey);$this->server->settings->wildcard_domain = $this->wildcard_domain;- if ($this->server->settings->force_docker_cleanup) {- $this->server->settings->docker_cleanup_frequency = $this->server->settings->docker_cleanup_frequency;- } else {- $this->server->settings->docker_cleanup_threshold = $this->server->settings->docker_cleanup_threshold;- }+ // if ($this->server->settings->force_docker_cleanup) {+ // $this->server->settings->docker_cleanup_frequency = $this->server->settings->docker_cleanup_frequency;+ // } else {+ // $this->server->settings->docker_cleanup_threshold = $this->server->settings->docker_cleanup_threshold;+ // }$currentTimezone = $this->server->settings->getOriginal('server_timezone');$newTimezone = $this->server->settings->server_timezone;if ($currentTimezone !== $newTimezone || $currentTimezone === '') {@@ -290,22 +265,4 @@ class Form extends Componentreturn handleError($e, $this);}}-- public function manualCleanup()- {- try {- DockerCleanupJob::dispatch($this->server, true);- $this->dispatch('success', 'Manual cleanup job started. Depending on the amount of data, this might take a while.');- } catch (\Throwable $e) {- return handleError($e, $this);- }- }-- public function manualCloudflareConfig()- {- $this->server->settings->is_cloudflare_tunnel = true;- $this->server->settings->save();- $this->server->refresh();- $this->dispatch('success', 'Cloudflare Tunnels enabled.');- }}