From ab3055150f6439d4a9408819d386482699177e01 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 2 Sep 2023 15:53:12 +0200 Subject: [PATCH] test distributed application check --- app/Console/Kernel.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 7e0bbf580..dbe48200d 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,15 +2,19 @@ namespace App\Console; +use App\Jobs\ApplicationContainerStatusJob; use App\Jobs\CheckResaleLicenseJob; use App\Jobs\CleanupInstanceStuffsJob; use App\Jobs\DatabaseBackupJob; +use App\Jobs\DatabaseContainerStatusJob; use App\Jobs\DockerCleanupJob; use App\Jobs\InstanceAutoUpdateJob; use App\Jobs\ProxyCheckJob; use App\Jobs\ResourceStatusJob; +use App\Models\Application; use App\Models\InstanceSettings; use App\Models\ScheduledDatabaseBackup; +use App\Models\StandalonePostgresql; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -20,7 +24,7 @@ protected function schedule(Schedule $schedule): void { if (isDev()) { $schedule->command('horizon:snapshot')->everyMinute(); - $schedule->job(new ResourceStatusJob)->everyMinute(); + // $schedule->job(new ResourceStatusJob)->everyMinute(); $schedule->job(new ProxyCheckJob)->everyFiveMinutes(); $schedule->job(new CleanupInstanceStuffsJob)->everyMinute(); // $schedule->job(new CheckResaleLicenseJob)->hourly(); @@ -28,13 +32,26 @@ protected function schedule(Schedule $schedule): void } else { $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->job(new CleanupInstanceStuffsJob)->everyTenMinutes()->onOneServer(); - $schedule->job(new ResourceStatusJob)->everyMinute()->onOneServer(); + // $schedule->job(new ResourceStatusJob)->everyMinute()->onOneServer(); $schedule->job(new CheckResaleLicenseJob)->hourly()->onOneServer(); $schedule->job(new ProxyCheckJob)->everyFiveMinutes()->onOneServer(); $schedule->job(new DockerCleanupJob)->everyTenMinutes()->onOneServer(); } $this->instance_auto_update($schedule); $this->check_scheduled_backups($schedule); + $this->check_resources($schedule); + } + private function check_resources($schedule) + { + $applications = Application::all(); + foreach ($applications as $application) { + $schedule->job(new ApplicationContainerStatusJob($application))->everyMinute()->onOneServer(); + } + + $postgresqls = StandalonePostgresql::all(); + foreach ($postgresqls as $postgresql) { + $schedule->job(new DatabaseContainerStatusJob($postgresql))->everyMinute()->onOneServer(); + } } private function instance_auto_update($schedule){ if (isDev()) {