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.

Refactor ServerStatusJob to remove unnecessary coolify.yaml file

Andras Bacsaiba86a75c4fb8
diff --git a/app/Jobs/ServerStatusJob.php b/app/Jobs/ServerStatusJob.php
deleted file mode 100644
index fcc33c8594..0000000000
--- a/app/Jobs/ServerStatusJob.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-namespace App\Jobs;
-
-use App\Models\Server;
-use Illuminate\Bus\Queueable;
-use Illuminate\Contracts\Queue\ShouldBeEncrypted;
-use Illuminate\Contracts\Queue\ShouldQueue;
-use Illuminate\Foundation\Bus\Dispatchable;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Queue\SerializesModels;
-
-class ServerStatusJob implements ShouldBeEncrypted, ShouldQueue
-{
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
-
- public int|string|null $disk_usage = null;
-
- public $tries = 3;
-
- public function backoff(): int
- {
- return isDev() ? 1 : 3;
- }
-
- public function __construct(public Server $server) {}
-
- public function handle()
- {
- if (! $this->server->isServerReady($this->tries)) {
- throw new \RuntimeException('Server is not ready.');
- }
- try {
- if ($this->server->isFunctional()) {
- $this->remove_unnecessary_coolify_yaml();
- if ($this->server->isSentinelEnabled()) {
- $this->server->checkSentinel();
- }
- }
- } catch (\Throwable $e) {
- // send_internal_notification('ServerStatusJob failed with: '.$e->getMessage());
- ray($e->getMessage());
-
- return handleError($e);
- }
-
- }
-
- private function remove_unnecessary_coolify_yaml()
- {
- // This will remote the coolify.yaml file from the server as it is not needed on cloud servers
- if (isCloud() && $this->server->id !== 0) {
- $file = $this->server->proxyPath().'/dynamic/coolify.yaml';
-
- return instant_remote_process([
- "rm -f $file",
- ], $this->server, false);
- }
- }
-}