mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
refactoring
This commit is contained in:
@ -3,8 +3,8 @@
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\SSHCommands\CreateUserCommand;
|
||||
use App\SSHCommands\GetPublicKeyCommand;
|
||||
use App\SSHCommands\System\CreateUserCommand;
|
||||
use App\SSHCommands\System\GetPublicKeyCommand;
|
||||
use Throwable;
|
||||
|
||||
class Initialize extends InstallationJob
|
||||
@ -13,13 +13,10 @@ class Initialize extends InstallationJob
|
||||
|
||||
protected ?string $asUser;
|
||||
|
||||
protected bool $defaultKeys;
|
||||
|
||||
public function __construct(Server $server, string $asUser = null, bool $defaultKeys = false)
|
||||
public function __construct(Server $server, string $asUser = null)
|
||||
{
|
||||
$this->server = $server->refresh();
|
||||
$this->asUser = $asUser;
|
||||
$this->defaultKeys = $defaultKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,7 +35,7 @@ public function handle(): void
|
||||
protected function authentication(): void
|
||||
{
|
||||
$this->server
|
||||
->ssh($this->asUser ?? $this->server->ssh_user, $this->defaultKeys)
|
||||
->ssh($this->asUser ?? $this->server->ssh_user)
|
||||
->exec(
|
||||
new CreateUserCommand(
|
||||
$this->server->authentication['user'],
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\SSHCommands\InstallCertbotCommand;
|
||||
use App\SSHCommands\SSL\InstallCertbotCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallCertbot extends InstallationJob
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\SSHCommands\InstallComposerCommand;
|
||||
use App\SSHCommands\PHP\InstallComposerCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallComposer extends InstallationJob
|
||||
|
@ -5,8 +5,8 @@
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallMariadbCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use App\SSHCommands\Database\InstallMariadbCommand;
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallMariadb extends InstallationJob
|
||||
|
@ -5,8 +5,8 @@
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallMysqlCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use App\SSHCommands\Database\InstallMysqlCommand;
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallMysql extends InstallationJob
|
||||
|
@ -5,8 +5,8 @@
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallNginxCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use App\SSHCommands\Nginx\InstallNginxCommand;
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallNginx extends InstallationJob
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\SSHCommands\InstallNodejsCommand;
|
||||
use App\SSHCommands\Installation\InstallNodejsCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallNodejs extends InstallationJob
|
||||
|
@ -5,8 +5,8 @@
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallPHPCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use App\SSHCommands\PHP\InstallPHPCommand;
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallPHP extends InstallationJob
|
||||
|
@ -6,8 +6,8 @@
|
||||
use App\Jobs\Job;
|
||||
use App\Models\FirewallRule;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\CreateNginxPHPMyAdminVHostCommand;
|
||||
use App\SSHCommands\DownloadPHPMyAdminCommand;
|
||||
use App\SSHCommands\PHPMyAdmin\CreateNginxPHPMyAdminVHostCommand;
|
||||
use App\SSHCommands\PHPMyAdmin\DownloadPHPMyAdminCommand;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use Throwable;
|
||||
@ -76,7 +76,7 @@ private function downloadSource(): void
|
||||
*/
|
||||
private function setUpVHost(): void
|
||||
{
|
||||
$vhost = File::get(base_path('system/command-templates/nginx/phpmyadmin-vhost.conf'));
|
||||
$vhost = File::get(resource_path('commands/webserver/nginx/phpmyadmin-vhost.conf'));
|
||||
$vhost = Str::replace('__php_version__', $this->service->server->defaultService('php')->version, $vhost);
|
||||
$this->service->server->ssh()->exec(
|
||||
new CreateNginxPHPMyAdminVHostCommand($vhost),
|
||||
|
@ -5,8 +5,8 @@
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallRedisCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use App\SSHCommands\Installation\InstallRedisCommand;
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallRedis extends InstallationJob
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\SSHCommands\InstallRequirementsCommand;
|
||||
use App\SSHCommands\Installation\InstallRequirementsCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallRequirements extends InstallationJob
|
||||
|
@ -5,8 +5,8 @@
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallSupervisorCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use App\SSHCommands\Supervisor\InstallSupervisorCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallSupervisor extends InstallationJob
|
||||
|
@ -5,8 +5,8 @@
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\InstallUfwCommand;
|
||||
use App\SSHCommands\ServiceStatusCommand;
|
||||
use App\SSHCommands\Firewall\InstallUfwCommand;
|
||||
use App\SSHCommands\Service\ServiceStatusCommand;
|
||||
use Throwable;
|
||||
|
||||
class InstallUfw extends InstallationJob
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use App\Exceptions\InstallationFailed;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\UninstallPHPCommand;
|
||||
use App\SSHCommands\PHP\UninstallPHPCommand;
|
||||
use Throwable;
|
||||
|
||||
class UninstallPHP extends InstallationJob
|
||||
|
@ -5,7 +5,7 @@
|
||||
use App\Jobs\Job;
|
||||
use App\Models\FirewallRule;
|
||||
use App\Models\Service;
|
||||
use App\SSHCommands\DeleteNginxPHPMyAdminVHost;
|
||||
use App\SSHCommands\PHPMyAdmin\DeleteNginxPHPMyAdminVHost;
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace App\Jobs\Installation;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\SSHCommands\UpgradeCommand;
|
||||
use App\SSHCommands\System\UpgradeCommand;
|
||||
use Throwable;
|
||||
|
||||
class Upgrade extends InstallationJob
|
||||
|
Reference in New Issue
Block a user