diff --git a/app/Enums/Database.php b/app/Enums/Database.php index beb9796f..ba5ea52c 100644 --- a/app/Enums/Database.php +++ b/app/Enums/Database.php @@ -14,6 +14,8 @@ final class Database const MYSQL80 = 'mysql80'; + const MYSQL84 = 'mysql84'; + const MARIADB103 = 'mariadb103'; const MARIADB104 = 'mariadb104'; diff --git a/app/Helpers/SSH.php b/app/Helpers/SSH.php index 98f9d3bd..d14d5c5a 100755 --- a/app/Helpers/SSH.php +++ b/app/Helpers/SSH.php @@ -93,7 +93,11 @@ public function connect(bool $sftp = false): void */ public function exec(string $command, string $log = '', ?int $siteId = null, ?bool $stream = false, ?callable $streamCallback = null): string { - if (! $this->log && $log) { + if (! $log) { + $log = 'run-command'; + } + + if (! $this->log) { $this->log = ServerLog::make($this->server, $log); if ($siteId) { $this->log->forSite($siteId); @@ -117,16 +121,18 @@ public function exec(string $command, string $log = '', ?int $siteId = null, ?bo $this->connection->setTimeout(0); if ($stream) { $this->connection->exec($command, function ($output) use ($streamCallback) { - $this->log?->write($output); + $this->log->write($output); return $streamCallback($output); }); return ''; } else { - $output = $this->connection->exec($command); - - $this->log?->write($output); + $output = ''; + $this->connection->exec($command, function ($out) use (&$output) { + $this->log->write($out); + $output .= $out; + }); if ($this->connection->getExitStatus() !== 0 || Str::contains($output, 'VITO_SSH_ERROR')) { throw new SSHCommandError( diff --git a/app/SSH/Services/Database/scripts/mysql/install-8.4.sh b/app/SSH/Services/Database/scripts/mysql/install-8.4.sh new file mode 100755 index 00000000..280af7d8 --- /dev/null +++ b/app/SSH/Services/Database/scripts/mysql/install-8.4.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +sudo DEBIAN_FRONTEND=noninteractive apt-get update + +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y lsb-release + +DEBIAN_FRONTEND=noninteractive wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb + +sudo DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.32-1_all.deb + +sudo DEBIAN_FRONTEND=noninteractive apt-get update + +sudo DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server + +sudo systemctl unmask mysql.service + +sudo systemctl enable mysql + +sudo systemctl start mysql + +if ! sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH auth_socket;"; then + echo 'VITO_SSH_ERROR' && exit 1 +fi + +if ! sudo mysql -e "FLUSH PRIVILEGES"; then + echo 'VITO_SSH_ERROR' && exit 1 +fi diff --git a/config/core.php b/config/core.php index 0ca948b8..9c5a9fd8 100755 --- a/config/core.php +++ b/config/core.php @@ -57,6 +57,7 @@ \App\Enums\Database::NONE, \App\Enums\Database::MYSQL57, \App\Enums\Database::MYSQL80, + \App\Enums\Database::MYSQL84, \App\Enums\Database::MARIADB103, \App\Enums\Database::MARIADB104, \App\Enums\Database::MARIADB106, @@ -72,6 +73,7 @@ \App\Enums\Database::NONE => 'none', \App\Enums\Database::MYSQL57 => 'mysql', \App\Enums\Database::MYSQL80 => 'mysql', + \App\Enums\Database::MYSQL84 => 'mysql', \App\Enums\Database::MARIADB103 => 'mariadb', \App\Enums\Database::MARIADB104 => 'mariadb', \App\Enums\Database::MARIADB106 => 'mariadb', @@ -87,6 +89,7 @@ \App\Enums\Database::NONE => '', \App\Enums\Database::MYSQL57 => '5.7', \App\Enums\Database::MYSQL80 => '8.0', + \App\Enums\Database::MYSQL84 => '8.4', \App\Enums\Database::MARIADB103 => '10.3', \App\Enums\Database::MARIADB104 => '10.4', \App\Enums\Database::MARIADB106 => '10.6', @@ -201,6 +204,7 @@ 'mysql' => [ '5.7', '8.0', + '8.4', ], 'mariadb' => [ '10.3', @@ -273,14 +277,17 @@ \App\Enums\OperatingSystem::UBUNTU20 => [ '5.7' => 'mysql', '8.0' => 'mysql', + '8.4' => 'mysql', ], \App\Enums\OperatingSystem::UBUNTU22 => [ '5.7' => 'mysql', '8.0' => 'mysql', + '8.4' => 'mysql', ], \App\Enums\OperatingSystem::UBUNTU24 => [ '5.7' => 'mysql', '8.0' => 'mysql', + '8.4' => 'mysql', ], ], 'mariadb' => [