feat: pull new sentinel image and restart container

This commit is contained in:
Andras Bacsai
2024-05-08 19:19:32 +02:00
parent 76a5290351
commit 1a152a5597
7 changed files with 76 additions and 20 deletions

View File

@@ -8,8 +8,11 @@ use App\Models\Server;
class StartSentinel
{
use AsAction;
public function handle(Server $server)
public function handle(Server $server, $version = 'latest', bool $restart = false)
{
return instant_remote_process(['docker run --rm --pull always -d --name coolify-sentinel -p 127.0.0.1:8888:8888 -v /var/run/docker.sock:/var/run/docker.sock -v /data/coolify/metrics:/var/www/html/storage/app/metrics --pid host --health-cmd "curl --fail http://127.0.0.1:8888/api/health || exit 1" --health-interval 10s --health-retries 3 ghcr.io/coollabsio/sentinel:latest'], $server, false);
if ($restart) {
instant_remote_process(['docker rm -f coolify-sentinel'], $server, false);
}
return instant_remote_process(["docker run --rm --pull always -d --name coolify-sentinel -v /var/run/docker.sock:/var/run/docker.sock -v /data/coolify/metrics:/var/www/html/storage/app/metrics --pid host --health-cmd \"curl --fail http://127.0.0.1:8888/api/health || exit 1\" --health-interval 10s --health-retries 3 ghcr.io/coollabsio/sentinel:$version"], $server, false);
}
}