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
Add scheduled task for database cleanup if not in cloud environment
Andras Bacsai99fe076b5af3
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.phpindex e92c602cff..4ff1d80209 100644--- a/app/Console/Kernel.php+++ b/app/Console/Kernel.php@@ -47,6 +47,10 @@ class Kernel extends ConsoleKernel$this->check_resources($schedule);$this->pull_helper_image($schedule);$this->check_scheduled_tasks($schedule);++ if (!isCloud()) {+ $schedule->command('cleanup:database --yes')->daily();+ }}}private function pull_helper_image($schedule)@@ -68,35 +72,35 @@ class Kernel extends ConsoleKernel$containerServers = $servers->where('settings.is_swarm_worker', false)->where('settings.is_build_server', false);}foreach ($containerServers as $server) {- $schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer();- // $schedule- // ->call(function () use ($server) {- // $randomSeconds = rand(1, 40);- // $job = new ContainerStatusJob($server);- // $job->delay($randomSeconds);- // ray('dispatching container status job in ' . $randomSeconds . ' seconds');- // dispatch($job);- // })->name('container-status-' . $server->id)->everyMinute()->onOneServer();+ // $schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer();+ $schedule+ ->call(function () use ($server) {+ $randomSeconds = rand(1, 40);+ $job = new ContainerStatusJob($server);+ $job->delay($randomSeconds);+ ray('dispatching container status job in ' . $randomSeconds . ' seconds');+ dispatch($job);+ })->name('container-status-' . $server->id)->everyMinute()->onOneServer();if ($server->isLogDrainEnabled()) {- $schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();- // $schedule- // ->call(function () use ($server) {- // $randomSeconds = rand(1, 40);- // $job = new CheckLogDrainContainerJob($server);- // $job->delay($randomSeconds);- // dispatch($job);- // })->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer();+ // $schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();+ $schedule+ ->call(function () use ($server) {+ $randomSeconds = rand(1, 40);+ $job = new CheckLogDrainContainerJob($server);+ $job->delay($randomSeconds);+ dispatch($job);+ })->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer();}}foreach ($servers as $server) {- $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer();- // $schedule- // ->call(function () use ($server) {- // $randomSeconds = rand(1, 40);- // $job = new ServerStatusJob($server);- // $job->delay($randomSeconds);- // dispatch($job);- // })->name('server-status-job-' . $server->id)->everyMinute()->onOneServer();+ // $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer();+ $schedule+ ->call(function () use ($server) {+ $randomSeconds = rand(1, 40);+ $job = new ServerStatusJob($server);+ $job->delay($randomSeconds);+ dispatch($job);+ })->name('server-status-job-' . $server->id)->everyMinute()->onOneServer();}}private function instance_auto_update($schedule)