mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
init
This commit is contained in:
35
app/Jobs/Installation/InstallMariadb.php
Executable file
35
app/Jobs/Installation/InstallMariadb.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallMariadbCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallMariadb extends InstallationJob
|
||||
{
|
||||
protected Service $service;
|
||||
|
||||
public function __construct(Service $service)
|
||||
{
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws InstallationFailed
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$ssh = $this->service->server->ssh();
|
||||
$ssh->exec(new InstallMariadbCommand(), 'install-mariadb');
|
||||
$status = $ssh->exec(new ServiceStatusCommand($this->service->unit), 'mariadb-status');
|
||||
$this->service->validateInstall($status);
|
||||
$this->service->update([
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user