mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-20 06:23:23 +00:00
Persist exited status across application, database, service, and preview stop paths, and reuse the split host/port/path input for S3 endpoints with linked validation feedback.
30 lines
806 B
PHP
30 lines
806 B
PHP
<?php
|
|
|
|
namespace App\Actions\Service;
|
|
|
|
use App\Events\ServiceStatusChanged;
|
|
use App\Models\ServiceApplication;
|
|
use App\Models\ServiceDatabase;
|
|
use Lorisleiva\Actions\Concerns\AsAction;
|
|
|
|
class StopServiceApplication
|
|
{
|
|
use AsAction;
|
|
|
|
public string $jobQueue = 'high';
|
|
|
|
public function handle(ServiceApplication|ServiceDatabase $serviceApplication): void
|
|
{
|
|
$service = $serviceApplication->service;
|
|
$server = $service->destination->server;
|
|
$containerName = escapeshellarg($serviceApplication->name.'-'.$service->uuid);
|
|
|
|
instant_remote_process([
|
|
"docker stop {$containerName}",
|
|
], $server);
|
|
|
|
$serviceApplication->update(['status' => 'exited']);
|
|
ServiceStatusChanged::dispatch($service->environment->project->team->id);
|
|
}
|
|
}
|