diff --git a/app/Actions/Librespeed/RunSpeedtest.php b/app/Actions/Librespeed/RunSpeedtest.php new file mode 100644 index 000000000..4ce8cfb99 --- /dev/null +++ b/app/Actions/Librespeed/RunSpeedtest.php @@ -0,0 +1,46 @@ +server->url' => $server, + 'service' => ResultService::Librespeed, + 'status' => ResultStatus::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'), }; } 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/*