fix: restart sentinel once a day
This commit is contained in:
16
app/Actions/Server/RestartContainer.php
Normal file
16
app/Actions/Server/RestartContainer.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Server;
|
||||
|
||||
use App\Models\Server;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class RestartContainer
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
public function handle(Server $server, string $containerName)
|
||||
{
|
||||
$server->restartContainer($containerName);
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,13 @@ class Kernel extends ConsoleKernel
|
||||
} else {
|
||||
$schedule->job(new DockerCleanupJob($server))->everyTenMinutes()->timezone($serverTimezone)->onOneServer();
|
||||
}
|
||||
|
||||
// Temporary solution until we have better memory management for Sentinel
|
||||
if ($server->isSentinelEnabled()) {
|
||||
$schedule->job(function () use ($server) {
|
||||
$server->restartContainer('coolify-sentinel');
|
||||
})->daily()->onOneServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1253,4 +1253,9 @@ $schema://$host {
|
||||
{
|
||||
return base_url().'/server/'.$this->uuid;
|
||||
}
|
||||
|
||||
public function restartContainer(string $containerName)
|
||||
{
|
||||
return instant_remote_process(['docker restart '.$containerName], $this, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user