mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
Status checks now queue a delayed check for each application, preview, service part, or database that goes from up to exited. After 2 minutes it sends the "Resource status changes" notification if the resource is still stopped, no deployment runs, and Coolify did not stop it. Each resource sends at most one notification in 15 minutes. Closes #9493
32 lines
860 B
PHP
32 lines
860 B
PHP
<?php
|
|
|
|
namespace App\Actions\Service;
|
|
|
|
use App\Jobs\NotifyResourceStoppedJob;
|
|
use App\Models\ServiceApplication;
|
|
use App\Models\ServiceDatabase;
|
|
use Lorisleiva\Actions\Concerns\AsAction;
|
|
use Lorisleiva\Actions\Decorators\JobDecorator;
|
|
|
|
class RestartServiceApplication
|
|
{
|
|
use AsAction;
|
|
|
|
public function configureJob(JobDecorator $job): void
|
|
{
|
|
$job->onQueue(deployment_queue());
|
|
}
|
|
|
|
public function handle(ServiceApplication|ServiceDatabase $serviceApplication): void
|
|
{
|
|
$service = $serviceApplication->service;
|
|
$server = $service->destination->server;
|
|
$containerName = escapeshellarg($serviceApplication->name.'-'.$service->uuid);
|
|
NotifyResourceStoppedJob::expectStop($serviceApplication);
|
|
|
|
instant_remote_process([
|
|
"docker restart {$containerName}",
|
|
], $server);
|
|
}
|
|
}
|