From dc485086d15df3c1f25b6cf039a3f5f080cf1143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20de=20Biolley?= Date: Mon, 14 Jul 2025 10:41:30 +0200 Subject: [PATCH 1/6] :sparkles: Add support for apk package manager (on Alpine Linux) --- app/Actions/Server/CheckUpdates.php | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/app/Actions/Server/CheckUpdates.php b/app/Actions/Server/CheckUpdates.php index f90e00708..e801a1c99 100644 --- a/app/Actions/Server/CheckUpdates.php +++ b/app/Actions/Server/CheckUpdates.php @@ -106,6 +106,15 @@ class CheckUpdates $out['osId'] = $osId; $out['package_manager'] = $packageManager; + return $out; + case 'apk': + instant_remote_process(['apk update -q'], $server); + $output = instant_remote_process(['LANG=C apk list --upgradable 2>/dev/null'], $server); + + $out = $this->parseApkOutput($output); + $out['osId'] = $osId; + $out['package_manager'] = $packageManager; + return $out; default: return [ @@ -273,4 +282,32 @@ class CheckUpdates return $result; } + + private function parseApkOutput(string $output): array + { + $updates = []; + $lines = explode("\n", $output); + + foreach ($lines as $line) { + // Skip empty lines + if (empty($line)) { + continue; + } + + // Example line: docker-cli-compose-2.31.0-r5 x86_64 {docker-cli-compose} (Apache-2.0) [upgradable from: docker-cli-compose-2.31.0-r4] + if (preg_match('/^(.+)-([0-9]\S*) (\S+) \{\S+\} \([^)]+\) \[upgradable from: .+?-([0-9][^\]]+)\]$/', $line, $matches)) { + $updates[] = [ + 'package' => $matches[1], + 'new_version' => $matches[2], + 'architecture' => $matches[3], + 'current_version' => $matches[4], + ]; + } + } + + return [ + 'total_updates' => count($updates), + 'updates' => $updates, + ]; + } } From 27ebae917dc55a7311988475c94125141c1b751c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20de=20Biolley?= Date: Mon, 14 Jul 2025 11:05:42 +0200 Subject: [PATCH 2/6] :zap: Also support upgrade packages --- app/Actions/Server/UpdatePackage.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Actions/Server/UpdatePackage.php b/app/Actions/Server/UpdatePackage.php index ab0ca9494..d77d5b87e 100644 --- a/app/Actions/Server/UpdatePackage.php +++ b/app/Actions/Server/UpdatePackage.php @@ -58,6 +58,10 @@ class UpdatePackage $commandAll = 'pacman -Syu --noconfirm'; $commandInstall = 'pacman -S --noconfirm '.$sanitizedPackage; break; + case 'apk': + $commandAll = 'apk update && apk upgrade'; + $commandInstall = 'apk upgrade '.$package; + break; default: return [ 'error' => 'OS not supported', From f707b8c0c3623713abfe97cc705f096197d9d12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20de=20Biolley?= Date: Mon, 14 Jul 2025 11:16:44 +0200 Subject: [PATCH 3/6] :sparkles: Add support to install Docker --- app/Actions/Server/InstallDocker.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index eb53b32ee..779f06b30 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -80,6 +80,15 @@ class InstallDocker $command = $command->merge([$this->getSuseDockerInstallCommand()]); } elseif ($supported_os_type->contains('arch')) { $command = $command->merge([$this->getArchDockerInstallCommand()]); + } elseif ($supported_os_type->contains('alpine')) { + $command = $command->merge([ + "echo 'Installing Prerequisites...'", + 'zypper update -y', + 'command -v curl >/dev/null || apk add curl', + 'command -v wget >/dev/null || apk add wget', + 'command -v git >/dev/null || apk add git', + 'command -v jq >/dev/null || apk add jq', + ]); } else { $command = $command->merge([$this->getGenericDockerInstallCommand()]); } From 4b5db024fb621e26ff60974603fe949bb83b4bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20de=20Biolley?= Date: Tue, 15 Jul 2025 17:33:58 +0200 Subject: [PATCH 4/6] :pencil2: Fix copy-paste issue --- app/Actions/Server/InstallDocker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index 779f06b30..21dc2f80b 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -83,7 +83,7 @@ class InstallDocker } elseif ($supported_os_type->contains('alpine')) { $command = $command->merge([ "echo 'Installing Prerequisites...'", - 'zypper update -y', + 'apk update', 'command -v curl >/dev/null || apk add curl', 'command -v wget >/dev/null || apk add wget', 'command -v git >/dev/null || apk add git', From 14603574e6977433962f0f85e0e2f89e24c7603a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20de=20Biolley?= Date: Tue, 15 Jul 2025 17:34:22 +0200 Subject: [PATCH 5/6] :memo: Update template --- resources/views/livewire/server/security/patches.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/server/security/patches.blade.php b/resources/views/livewire/server/security/patches.blade.php index a4fe5b309..2988db589 100644 --- a/resources/views/livewire/server/security/patches.blade.php +++ b/resources/views/livewire/server/security/patches.blade.php @@ -18,7 +18,7 @@

Server Patching

(experimental) Status notifications sent every week.
You can disable notifications in the notification settings." /> @if (isDev()) From 240331556e061d3823459da46cddd576a6732a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20de=20Biolley?= Date: Mon, 22 Dec 2025 11:52:12 +0100 Subject: [PATCH 6/6] :sparkles: Install docker on alpine --- app/Actions/Server/InstallDocker.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index 21dc2f80b..5115d506a 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -81,14 +81,7 @@ class InstallDocker } elseif ($supported_os_type->contains('arch')) { $command = $command->merge([$this->getArchDockerInstallCommand()]); } elseif ($supported_os_type->contains('alpine')) { - $command = $command->merge([ - "echo 'Installing Prerequisites...'", - 'apk update', - 'command -v curl >/dev/null || apk add curl', - 'command -v wget >/dev/null || apk add wget', - 'command -v git >/dev/null || apk add git', - 'command -v jq >/dev/null || apk add jq', - ]); + $command = $command->merge([$this->getAlpineDockerInstallCommand()]); } else { $command = $command->merge([$this->getGenericDockerInstallCommand()]); } @@ -168,6 +161,13 @@ class InstallDocker 'systemctl start docker.service'; } + private function getAlpineDockerInstallCommand(): string + { + return "echo 'Installing Prerequisites...' && ". + 'apk update && '. + 'apk add docker'; + } + private function getGenericDockerInstallCommand(): string { return "curl --max-time 300 --retry 3 https://releases.rancher.com/install-docker/{$this->dockerVersion}.sh | sh || curl --max-time 300 --retry 3 https://get.docker.com | sh -s -- --version {$this->dockerVersion}";