diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index 0713ed086..08874fc81 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -15,7 +15,7 @@ public function handle(Server $server) if (!$supported_os_type) { throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: documentation.'); } - ray('Installing Docker on server: ' . $server->name . ' (' . $server->ip . ')' . ' with OS: ' . $supported_os_type); + ray('Installing Docker on server: ' . $server->name . ' (' . $server->ip . ')' . ' with OS type: ' . $supported_os_type); $dockerVersion = '24.0'; $config = base64_encode('{ "log-driver": "json-file", @@ -44,18 +44,25 @@ public function handle(Server $server) "ls -l /tmp" ]); } else { - if ($supported_os_type === 'debian') { + if ($supported_os_type->contains('debian')) { $command = $command->merge([ "echo 'Installing Prerequisites...'", - "command -v jq >/dev/null || apt-get update", + "command -v jq >/dev/null || apt-get update -y", "command -v jq >/dev/null || apt install -y jq", ]); - } else if ($supported_os_type === 'rhel') { + } else if ($supported_os_type->contains('rhel')) { $command = $command->merge([ "echo 'Installing Prerequisites...'", + "command -v jq >/dev/null || dnf update -y", "command -v jq >/dev/null || dnf install -y jq", ]); + } else if ($supported_os_type->contains('sles')) { + $command = $command->merge([ + "echo 'Installing Prerequisites...'", + "command -v jq >/dev/null || zypper update -y", + "command -v jq >/dev/null || zypper install -y jq", + ]); } else { throw new \Exception('Unsupported OS'); } diff --git a/app/Models/Server.php b/app/Models/Server.php index 650e5129a..e39bbcaa6 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -194,7 +194,8 @@ public function getDiskUsage() { return instant_remote_process(["df /| tail -1 | awk '{ print $5}' | sed 's/%//g'"], $this, false); } - public function definedResources() { + public function definedResources() + { $applications = $this->applications(); $databases = $this->databases(); $services = $this->services(); @@ -342,12 +343,16 @@ public function validateOS() $collectedData->put($item->before('=')->value(), $item->after('=')->lower()->replace('"', '')->value()); } $ID = data_get($collectedData, 'ID'); - $ID_LIKE = data_get($collectedData, 'ID_LIKE'); - $VERSION_ID = data_get($collectedData, 'VERSION_ID'); - // ray($ID, $ID_LIKE, $VERSION_ID); - if (collect(SUPPORTED_OS)->contains($ID_LIKE)) { + // $ID_LIKE = data_get($collectedData, 'ID_LIKE'); + // $VERSION_ID = data_get($collectedData, 'VERSION_ID'); + $supported = collect(SUPPORTED_OS)->filter(function ($supportedOs) use ($ID) { + if (str($supportedOs)->contains($ID)) { + return str($ID); + } + }); + if ($supported->count() === 1) { ray('supported'); - return str($ID_LIKE)->explode(' ')->first(); + return $supported->first(); } else { ray('not supported'); return false; diff --git a/bootstrap/helpers/constants.php b/bootstrap/helpers/constants.php index 299d3acb9..ba659c708 100644 --- a/bootstrap/helpers/constants.php +++ b/bootstrap/helpers/constants.php @@ -29,6 +29,7 @@ ]; const SUPPORTED_OS = [ - 'debian', - 'rhel centos fedora' + 'ubuntu debian raspbian', + 'centos fedora rhel ol rocky', + 'sles opensuse-leap opensuse-tumbleweed' ];