From 7b45f5f5a03fb79963d508ad0895389e835f1414 Mon Sep 17 00:00:00 2001 From: Alex Justesen <1144087+alexjustesen@users.noreply.github.com> Date: Thu, 27 Nov 2025 19:11:19 -0600 Subject: [PATCH 1/3] Add Librespeed CLI installation to Dockerfile --- docker/8.4/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker/8.4/Dockerfile b/docker/8.4/Dockerfile index 0ce8d812f..262aa0055 100644 --- a/docker/8.4/Dockerfile +++ b/docker/8.4/Dockerfile @@ -7,6 +7,7 @@ ARG NODE_VERSION=22 ARG MYSQL_CLIENT="mysql-client" ARG POSTGRES_VERSION=17 ARG SPEEDTEST_VERSION=1.2.0 +ARG LIBRESPEED_VERSION=1.0.12 WORKDIR /var/www/html @@ -49,14 +50,19 @@ RUN apt-get update && apt-get upgrade -y \ && ARCH=$(uname -m) \ && if [ "$ARCH" = "x86_64" ]; then \ PLATFORM="x86_64"; \ + LIBRESPEED_PLATFORM="amd64"; \ elif [ "$ARCH" = "aarch64" ]; then \ PLATFORM="aarch64"; \ + LIBRESPEED_PLATFORM="arm64"; \ else \ echo "Unsupported architecture: $ARCH"; exit 1; \ fi \ && curl -o /tmp/speedtest-cli.tgz -L \ "https://install.speedtest.net/app/cli/ookla-speedtest-$SPEEDTEST_VERSION-linux-$PLATFORM.tgz" \ && tar -xzf /tmp/speedtest-cli.tgz -C /usr/bin \ + && curl -o /tmp/librespeed-cli.tar.gz -L \ + "https://github.com/librespeed/speedtest-cli/releases/download/v$LIBRESPEED_VERSION/librespeed-cli_${LIBRESPEED_VERSION}_linux_${LIBRESPEED_PLATFORM}.tar.gz" \ + && tar -xzf /tmp/librespeed-cli.tar.gz -C /usr/bin \ && apt-get -y autoremove \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* From 56b560e04ad2d8c580be2bfcd884da800f70db46 Mon Sep 17 00:00:00 2001 From: Alex Justesen <1144087+alexjustesen@users.noreply.github.com> Date: Thu, 27 Nov 2025 19:12:11 -0600 Subject: [PATCH 2/3] scaffold run librespeed action --- app/Actions/Librespeed/RunSpeedtest.php | 45 +++++++++++++++++++++++++ app/Enums/ResultService.php | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 app/Actions/Librespeed/RunSpeedtest.php diff --git a/app/Actions/Librespeed/RunSpeedtest.php b/app/Actions/Librespeed/RunSpeedtest.php new file mode 100644 index 000000000..f48afa365 --- /dev/null +++ b/app/Actions/Librespeed/RunSpeedtest.php @@ -0,0 +1,45 @@ +server->url' => $server, + 'service' => ResultService::Librespeed, + 'status' => 'waiting', + 'scheduled' => $isScheduled, + 'dispatched_by' => $dispatchedBy, + ]); + + SpeedtestWaiting::dispatch($result); + + // TODO: Implement Librespeed speedtest job batching + + // Bus::batch([ + // [ + // new StartSpeedtestJob($result), + // new CheckForInternetConnectionJob($result), + // new SkipSpeedtestJob($result), + // new SelectSpeedtestServerJob($result), + // new RunSpeedtestJob($result), + // new BenchmarkSpeedtestJob($result), + // new CompleteSpeedtestJob($result), + // ], + // ])->catch(function (Batch $batch, ?Throwable $e) { + // Log::error(sprintf('Speedtest batch "%s" failed for an unknown reason.', $batch->id)); + // })->name('Ookla Speedtest')->dispatch(); + + return $result; + } +} diff --git a/app/Enums/ResultService.php b/app/Enums/ResultService.php index bfc7eec55..39a441d39 100644 --- a/app/Enums/ResultService.php +++ b/app/Enums/ResultService.php @@ -7,12 +7,14 @@ enum ResultService: string implements HasLabel { case Faker = 'faker'; + case Librespeed = 'librespeed'; case Ookla = 'ookla'; public function getLabel(): ?string { return match ($this) { self::Faker => __('enums.service.faker'), + self::Librespeed => __('enums.service.librespeed'), self::Ookla => __('enums.service.ookla'), }; } From 27ca8f0163a500be27134e00592fd019d3408671 Mon Sep 17 00:00:00 2001 From: Alex Justesen <1144087+alexjustesen@users.noreply.github.com> Date: Thu, 27 Nov 2025 19:15:28 -0600 Subject: [PATCH 3/3] use ResultStatus enum in RunSpeedtest action --- app/Actions/Librespeed/RunSpeedtest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Actions/Librespeed/RunSpeedtest.php b/app/Actions/Librespeed/RunSpeedtest.php index f48afa365..4ce8cfb99 100644 --- a/app/Actions/Librespeed/RunSpeedtest.php +++ b/app/Actions/Librespeed/RunSpeedtest.php @@ -3,6 +3,7 @@ namespace App\Actions\Librespeed; use App\Enums\ResultService; +use App\Enums\ResultStatus; use App\Events\SpeedtestWaiting; use App\Models\Result; use Lorisleiva\Actions\Concerns\AsAction; @@ -17,7 +18,7 @@ public function handle(bool $isScheduled = false, ?string $server = null, ?int $ $result = Result::create([ 'data->server->url' => $server, 'service' => ResultService::Librespeed, - 'status' => 'waiting', + 'status' => ResultStatus::Waiting, 'scheduled' => $isScheduled, 'dispatched_by' => $dispatchedBy, ]);