fix: restart sentinel once a day
This commit is contained in:
parent
5780828f0f
commit
c2a2757103
3 changed files with 28 additions and 0 deletions
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 @@ private function checkResources($schedule): void
|
|||
} 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 @@ public function url()
|
|||
{
|
||||
return base_url().'/server/'.$this->uuid;
|
||||
}
|
||||
|
||||
public function restartContainer(string $containerName)
|
||||
{
|
||||
return instant_remote_process(['docker restart '.$containerName], $this, false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue