diff --git a/app/Actions/CoolifyTask/RunRemoteProcess.php b/app/Actions/CoolifyTask/RunRemoteProcess.php index 51c5a1f9e..981b81378 100644 --- a/app/Actions/CoolifyTask/RunRemoteProcess.php +++ b/app/Actions/CoolifyTask/RunRemoteProcess.php @@ -9,6 +9,7 @@ use App\Jobs\ApplicationDeploymentJob; use App\Models\Server; use Illuminate\Process\ProcessResult; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Process; use Spatie\Activitylog\Models\Activity; @@ -124,6 +125,7 @@ class RunRemoteProcess ])); } } catch (\Throwable $e) { + Log::error('Error calling event: '.$e->getMessage()); } } diff --git a/app/Actions/Proxy/CheckProxy.php b/app/Actions/Proxy/CheckProxy.php index d64804758..51303d87a 100644 --- a/app/Actions/Proxy/CheckProxy.php +++ b/app/Actions/Proxy/CheckProxy.php @@ -4,6 +4,7 @@ namespace App\Actions\Proxy; use App\Enums\ProxyTypes; use App\Models\Server; +use Illuminate\Support\Facades\Log; use Lorisleiva\Actions\Concerns\AsAction; use Symfony\Component\Yaml\Yaml; @@ -88,6 +89,7 @@ class CheckProxy $portsToCheck = []; } } catch (\Exception $e) { + Log::error('Error checking proxy: '.$e->getMessage()); } if (count($portsToCheck) === 0) { return false; diff --git a/app/Actions/Service/DeleteService.php b/app/Actions/Service/DeleteService.php index 9c4b0349c..9b87454da 100644 --- a/app/Actions/Service/DeleteService.php +++ b/app/Actions/Service/DeleteService.php @@ -4,6 +4,7 @@ namespace App\Actions\Service; use App\Actions\Server\CleanupDocker; use App\Models\Service; +use Illuminate\Support\Facades\Log; use Lorisleiva\Actions\Concerns\AsAction; class DeleteService @@ -39,7 +40,8 @@ class DeleteService if (! empty($commands)) { foreach ($commands as $command) { $result = instant_remote_process([$command], $server, false); - if ($result !== 0) { + if ($result !== null && $result !== 0) { + Log::error('Error deleting volumes: '.$result); } } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 3e3ae0834..9aa87e8dd 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -30,11 +30,17 @@ class Kernel extends ConsoleKernel private InstanceSettings $settings; + private string $updateCheckFrequency; + + private string $instanceTimezone; + protected function schedule(Schedule $schedule): void { $this->allServers = Server::where('ip', '!=', '1.2.3.4'); $this->settings = instanceSettings(); + $this->updateCheckFrequency = $this->settings->update_check_frequency ?: '0 * * * *'; + $this->instanceTimezone = $this->settings->instance_timezone ?: config('app.timezone'); $schedule->job(new CleanupStaleMultiplexedConnections)->hourly(); @@ -56,7 +62,7 @@ class Kernel extends ConsoleKernel // Instance Jobs $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('cleanup:unreachable-servers')->daily()->onOneServer(); - $schedule->job(new PullTemplatesFromCDN)->cron($this->settings->update_check_frequency)->timezone($this->settings->instance_timezone)->onOneServer(); + $schedule->job(new PullTemplatesFromCDN)->cron($this->updateCheckFrequency)->timezone($this->instanceTimezone)->onOneServer(); $schedule->job(new CleanupInstanceStuffsJob)->everyTwoMinutes()->onOneServer(); $this->scheduleUpdates($schedule); @@ -80,28 +86,27 @@ class Kernel extends ConsoleKernel if ($server->isSentinelEnabled()) { $schedule->job(function () use ($server) { CheckAndStartSentinelJob::dispatch($server); - })->cron($this->settings->update_check_frequency)->timezone($this->settings->instance_timezone)->onOneServer(); + })->cron($this->updateCheckFrequency)->timezone($this->instanceTimezone)->onOneServer(); } } $schedule->job(new CheckHelperImageJob) - ->cron($this->settings->update_check_frequency) - ->timezone($this->settings->instance_timezone) + ->cron($this->updateCheckFrequency) + ->timezone($this->instanceTimezone) ->onOneServer(); } private function scheduleUpdates($schedule): void { - $updateCheckFrequency = $this->settings->update_check_frequency; $schedule->job(new CheckForUpdatesJob) - ->cron($updateCheckFrequency) - ->timezone($this->settings->instance_timezone) + ->cron($this->updateCheckFrequency) + ->timezone($this->instanceTimezone) ->onOneServer(); if ($this->settings->is_auto_update_enabled) { $autoUpdateFrequency = $this->settings->auto_update_frequency; $schedule->job(new UpdateCoolifyJob) ->cron($autoUpdateFrequency) - ->timezone($this->settings->instance_timezone) + ->timezone($this->instanceTimezone) ->onOneServer(); } } @@ -166,14 +171,13 @@ class Kernel extends ConsoleKernel if (is_null($server)) { continue; } - $serverTimezone = $server->settings->server_timezone; if (isset(VALID_CRON_STRINGS[$scheduled_backup->frequency])) { $scheduled_backup->frequency = VALID_CRON_STRINGS[$scheduled_backup->frequency]; } $schedule->job(new DatabaseBackupJob( backup: $scheduled_backup - ))->cron($scheduled_backup->frequency)->timezone($serverTimezone)->onOneServer(); + ))->cron($scheduled_backup->frequency)->timezone($this->instanceTimezone)->onOneServer(); } } @@ -207,14 +211,13 @@ class Kernel extends ConsoleKernel if (! $server) { continue; } - $serverTimezone = $server->settings->server_timezone ?: config('app.timezone'); if (isset(VALID_CRON_STRINGS[$scheduled_task->frequency])) { $scheduled_task->frequency = VALID_CRON_STRINGS[$scheduled_task->frequency]; } $schedule->job(new ScheduledTaskJob( task: $scheduled_task - ))->cron($scheduled_task->frequency)->timezone($serverTimezone)->onOneServer(); + ))->cron($scheduled_task->frequency)->timezone($this->instanceTimezone)->onOneServer(); } }