Add service database CRUD, logs, and lifecycle actions, and document service application operations with OpenAPI tests.
25 lines
625 B
PHP
25 lines
625 B
PHP
<?php
|
|
|
|
namespace App\Actions\Service;
|
|
|
|
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);
|
|
}
|
|
}
|