Update Docker installation command and add support for SLES
This commit is contained in:
parent
085b655d9f
commit
1c386db41d
@ -15,7 +15,7 @@ class InstallDocker
|
|||||||
if (!$supported_os_type) {
|
if (!$supported_os_type) {
|
||||||
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/servers#install-docker-engine-manually">documentation</a>.');
|
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/servers#install-docker-engine-manually">documentation</a>.');
|
||||||
}
|
}
|
||||||
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';
|
$dockerVersion = '24.0';
|
||||||
$config = base64_encode('{
|
$config = base64_encode('{
|
||||||
"log-driver": "json-file",
|
"log-driver": "json-file",
|
||||||
@ -44,18 +44,25 @@ class InstallDocker
|
|||||||
"ls -l /tmp"
|
"ls -l /tmp"
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
if ($supported_os_type === 'debian') {
|
if ($supported_os_type->contains('debian')) {
|
||||||
$command = $command->merge([
|
$command = $command->merge([
|
||||||
"echo 'Installing Prerequisites...'",
|
"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",
|
"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([
|
$command = $command->merge([
|
||||||
"echo 'Installing Prerequisites...'",
|
"echo 'Installing Prerequisites...'",
|
||||||
|
"command -v jq >/dev/null || dnf update -y",
|
||||||
"command -v jq >/dev/null || dnf install -y jq",
|
"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 {
|
} else {
|
||||||
throw new \Exception('Unsupported OS');
|
throw new \Exception('Unsupported OS');
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,8 @@ class Server extends BaseModel
|
|||||||
{
|
{
|
||||||
return instant_remote_process(["df /| tail -1 | awk '{ print $5}' | sed 's/%//g'"], $this, false);
|
return instant_remote_process(["df /| tail -1 | awk '{ print $5}' | sed 's/%//g'"], $this, false);
|
||||||
}
|
}
|
||||||
public function definedResources() {
|
public function definedResources()
|
||||||
|
{
|
||||||
$applications = $this->applications();
|
$applications = $this->applications();
|
||||||
$databases = $this->databases();
|
$databases = $this->databases();
|
||||||
$services = $this->services();
|
$services = $this->services();
|
||||||
@ -342,12 +343,16 @@ class Server extends BaseModel
|
|||||||
$collectedData->put($item->before('=')->value(), $item->after('=')->lower()->replace('"', '')->value());
|
$collectedData->put($item->before('=')->value(), $item->after('=')->lower()->replace('"', '')->value());
|
||||||
}
|
}
|
||||||
$ID = data_get($collectedData, 'ID');
|
$ID = data_get($collectedData, 'ID');
|
||||||
$ID_LIKE = data_get($collectedData, 'ID_LIKE');
|
// $ID_LIKE = data_get($collectedData, 'ID_LIKE');
|
||||||
$VERSION_ID = data_get($collectedData, 'VERSION_ID');
|
// $VERSION_ID = data_get($collectedData, 'VERSION_ID');
|
||||||
// ray($ID, $ID_LIKE, $VERSION_ID);
|
$supported = collect(SUPPORTED_OS)->filter(function ($supportedOs) use ($ID) {
|
||||||
if (collect(SUPPORTED_OS)->contains($ID_LIKE)) {
|
if (str($supportedOs)->contains($ID)) {
|
||||||
|
return str($ID);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if ($supported->count() === 1) {
|
||||||
ray('supported');
|
ray('supported');
|
||||||
return str($ID_LIKE)->explode(' ')->first();
|
return $supported->first();
|
||||||
} else {
|
} else {
|
||||||
ray('not supported');
|
ray('not supported');
|
||||||
return false;
|
return false;
|
||||||
|
@ -29,6 +29,7 @@ const SPECIFIC_SERVICES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const SUPPORTED_OS = [
|
const SUPPORTED_OS = [
|
||||||
'debian',
|
'ubuntu debian raspbian',
|
||||||
'rhel centos fedora'
|
'centos fedora rhel ol rocky',
|
||||||
|
'sles opensuse-leap opensuse-tumbleweed'
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user