Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
e620845fce Bump phpunit/phpunit from 9.5.2 to 9.5.12
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.2 to 9.5.12.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.2...9.5.12)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-24 03:06:19 +00:00
20 changed files with 1474 additions and 2611 deletions

View File

@@ -24,6 +24,6 @@ jobs:
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: henrywhitaker3/speedtest-tracker:dev,henrywhitaker3/speedtest-tracker:dev-arm

View File

@@ -24,6 +24,6 @@ jobs:
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: henrywhitaker3/speedtest-tracker:latest,henrywhitaker3/speedtest-tracker:latest-arm

View File

@@ -12,7 +12,7 @@ jobs:
steps:
- uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8
with:
php-version: '8.2'
php-version: '7.4'
- uses: actions/checkout@v2
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
@@ -46,7 +46,7 @@ jobs:
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Download Speedtest binary
run: wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz -O speedtest.tgz && tar zxvf speedtest.tgz && mv speedtest app/Bin/
run: wget https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-x86_64-linux.tgz -O speedtest.tgz && tar zxvf speedtest.tgz && mv speedtest app/Bin/
- name: Accept EULA
env:
DB_CONNECTION: sqlite

View File

@@ -1,6 +1,6 @@
# Speedtest Tracker
[![Docker pulls](https://img.shields.io/docker/pulls/henrywhitaker3/speedtest-tracker?style=flat-square)](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/henrywhitaker3/Speedtest-Tracker/laravel-master.yml?branch=master&label=dev&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/henrywhitaker3/Speedtest-Tracker/laravel-dev.yml?branch=dev&label=dev&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![last_commit](https://img.shields.io/github/last-commit/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [![issues](https://img.shields.io/github/issues/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [![commit_freq](https://img.shields.io/github/commit-activity/m/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) ![version](https://img.shields.io/badge/version-v1.12.3-success?style=flat-square) [![license](https://img.shields.io/github/license/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
[![Docker pulls](https://img.shields.io/docker/pulls/henrywhitaker3/speedtest-tracker?style=flat-square)](https://hub.docker.com/r/henrywhitaker3/speedtest-tracker) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Stable?label=master&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/henrywhitaker3/Speedtest-Tracker/Dev?label=dev&logo=github&style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/actions) [![last_commit](https://img.shields.io/github/last-commit/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) [![issues](https://img.shields.io/github/issues/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/issues) [![commit_freq](https://img.shields.io/github/commit-activity/m/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/commits) ![version](https://img.shields.io/badge/version-v1.12.2-success?style=flat-square) [![license](https://img.shields.io/github/license/henrywhitaker3/Speedtest-Tracker?style=flat-square)](https://github.com/henrywhitaker3/Speedtest-Tracker/blob/master/LICENSE)
This program runs a speedtest check every hour and graphs the results. The back-end is written in [Laravel](https://laravel.com/) and the front-end uses [React](https://reactjs.org/). It uses the [Ookla's speedtest cli](https://www.speedtest.net/apps/cli) package to get the data and uses [Chart.js](https://www.chartjs.org/) to plot the results.

View File

@@ -1,15 +0,0 @@
version: "3"
vars:
RTAG:
sh: head -n 25 /dev/random | md5sum | head -c 8
tasks:
build:
cmds:
- docker build . -f docker/Dockerfile --tag henrywhitaker3/speedtest-tracker:{{ .RTAG }}
run:
deps: [build]
cmds:
- docker run --rm -p 8765:80 -e OOKLA_EULA_GDPR=true henrywhitaker3/speedtest-tracker:{{ .RTAG }}

View File

@@ -30,6 +30,6 @@ class QueueSpeedtest implements ActionInterface
{
SettingsHelper::loadIntegrationConfig();
SpeedtestJob::dispatch($this->speedtestProvider, false, config('integrations'));
SpeedtestJob::dispatch(false, config('integrations'), $this->speedtestProvider);
}
}

View File

@@ -32,9 +32,9 @@ class Kernel extends ConsoleKernel
if ((bool)SettingsHelper::get('schedule_enabled')->value) {
$schedule->job(
new SpeedtestJob(
app()->make(SpeedtestProvider::class),
true,
config('integrations'),
app()->make(SpeedtestProvider::class)
)
)
->cron(SettingsHelper::get('schedule')['value'])

View File

@@ -43,7 +43,7 @@ class SpeedtestJob implements ShouldQueue
*
* @return void
*/
public function __construct(SpeedtestProvider $speedtestProvider, $scheduled = true, $config = [])
public function __construct($scheduled = true, $config = [], SpeedtestProvider $speedtestProvider)
{
$this->scheduled = $scheduled;
$this->config = $config;

View File

@@ -1,14 +1,4 @@
{
"1.12.3": [
{
"description": "Updated to PHP 8.2",
"link": ""
},
{
"description": "Updated speedtest cli to 1.2.0 (#1119)",
"link": "https://github.com/henrywhitaker3/Speedtest-Tracker/issues/1119"
}
],
"1.12.2": [
{
"description": "Fixed a bug where the latest X days widget would not update for the failure graph",

View File

@@ -8,7 +8,7 @@
],
"license": "MIT",
"require": {
"php": "^8",
"php": "^7.2.5",
"doctrine/dbal": "^2.10",
"dragonmantank/cron-expression": "^3",
"fideloper/proxy": "^4.2",

3976
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@ return [
|--------------------------------------------------------------------------
*/
'version' => '1.12.3',
'version' => '1.12.2',
/*
|--------------------------------------------------------------------------

View File

@@ -3,8 +3,6 @@ LABEL maintainer=henrywhitaker3@outlook.com
ENV arch='x86_64'
RUN apk add php82-tokenizer
COPY docker/conf/ /
COPY . /site

View File

@@ -3,8 +3,6 @@ LABEL maintainer=henrywhitaker3@outlook.com
ENV arch='arm'
RUN apk add php82-tokenizer
COPY docker/conf/ /
COPY . /site

View File

@@ -6,5 +6,5 @@
0 3 * * 6 run-parts /etc/periodic/weekly
0 5 1 * * run-parts /etc/periodic/monthly
# speedtest cron
* * * * * php82 /config/www/artisan schedule:run >> /config/log/speedtest/cron.log
# */5 * * * * php82 /config/www/artisan queue:retry all >> /config/log/speedtest.cron.log
* * * * * php /config/www/artisan schedule:run >> /config/log/speedtest/cron.log
# */5 * * * * php /config/www/artisan queue:retry all >> /config/log/speedtest.cron.log

View File

@@ -11,18 +11,6 @@ function eulaError()
exit 1
}
function downloadSpeedtestCli()
{
if [ $(uname -m) == "x86_64" ]; then
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz -O speedtest.tgz > /dev/null
else
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-aarch64.tgz -O speedtest.tgz > /dev/null
fi
tar zxvf speedtest.tgz > /dev/null
cp speedtest /site/app/Bin/
}
# Do Ookla stuff
if [ -z ${OOKLA_EULA_GDPR+x} ]; then
eulaError
@@ -35,27 +23,24 @@ else
echo "Ookla GDPR and EULA accepted. Downloading Speedtest CLI."
cd /tmp
downloadSpeedtestCli
if [ $(uname -m) == "x86_64" ]; then
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-x86_64-linux.tgz -O speedtest.tgz > /dev/null
else
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-arm-linux.tgz -O speedtest.tgz > /dev/null
fi
tar zxvf speedtest.tgz > /dev/null
cp speedtest /site/app/Bin/
chmod +x /site/artisan
HOME=/config && s6-setuidgid abc /site/app/Bin/speedtest --accept-license --accept-gdpr > /dev/null
HOME=/root
else
/config/www/app/Bin/speedtest --version | grep -E "1\.2\.0"
rc=$?
if [ $rc -ne 0 ]; then
downloadSpeedtestCli
fi
HOME=/config && s6-setuidgid abc /site/app/Bin/speedtest --accept-license --accept-gdpr > /dev/null
HOME=/root
fi
fi
# Copy latest nginx config
cp /defaults/nginx/nginx.conf.sample /config/nginx/nginx.conf
# Copy site files to /config
echo "Copying latest site files to config"
cp -rfT /site/ /config/www/
@@ -84,19 +69,19 @@ fi
echo 'Updating packages'
apk add composer
cd /config/www && php82 /usr/bin/composer.phar install && echo date > /config/www/.composer-time
cd /config/www && composer install && echo date > /config/www/.composer-time
sed "s,DB_DATABASE=.*,DB_DATABASE=/config/speed.db," -i.bak /config/www/.env
echo "Running database migrations"
php82 /config/www/artisan migrate
php /config/www/artisan migrate
# Check app key exists
if grep -E "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /config/www/.env > /dev/null; then
echo "App key exists"
else
echo "Generating app key"
php82 /config/www/artisan key:generate
php /config/www/artisan key:generate
fi
# Check JWT secret exists
@@ -104,7 +89,7 @@ if grep -E "JWT_SECRET=[0-9A-Za-z:+\/=]{1,}" /config/www/.env > /dev/null ; then
echo "JWT secret exists"
else
echo "Generating JWT secret"
php82 /config/www/artisan jwt:secret
php /config/www/artisan jwt:secret
fi
if [ -z ${SLACK_WEBHOOK+x} ]; then
@@ -113,7 +98,7 @@ if [ -z ${SLACK_WEBHOOK+x} ]; then
else
echo "Slack webhook set, updating db"
sed "s,SLACK_WEBHOOK=.*,SLACK_WEBHOOK=$SLACK_WEBHOOK," -i.bak /config/www/.env
php82 /config/www/artisan speedtest:slack $SLACK_WEBHOOK
php /config/www/artisan speedtest:slack $SLACK_WEBHOOK
fi
if [ -z ${TELEGRAM_BOT_TOKEN+x} ] && [ -z ${TELEGRAM_CHAT_ID+x} ]; then
@@ -124,7 +109,7 @@ else
echo "Telegram chat id and bot token set, updating .env"
sed "s,TELEGRAM_BOT_TOKEN=.*,TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN," -i.bak /config/www/.env
sed "s,TELEGRAM_CHAT_ID=.*,TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID," -i.bak /config/www/.env
php82 /config/www/artisan speedtest:telegram --chat=$TELEGRAM_CHAT_ID --bot=$TELEGRAM_BOT_TOKEN
php /config/www/artisan speedtest:telegram --chat=$TELEGRAM_CHAT_ID --bot=$TELEGRAM_BOT_TOKEN
fi
if [ -z ${BASE_PATH+x} ]; then
@@ -137,19 +122,19 @@ fi
if [ -z ${AUTH+x} ]; then
echo "AUTH variable not set. Disabling authentication"
php82 /config/www/artisan speedtest:auth --disable
php /config/www/artisan speedtest:auth --disable
else
if [ $AUTH == 'true' ]; then
echo "AUTH variable set. Enabling authentication"
php82 /config/www/artisan speedtest:auth --enable
php /config/www/artisan speedtest:auth --enable
else
echo "AUTH variable set, but not to 'true'. Disabling authentication"
php82 /config/www/artisan speedtest:auth --disable
php /config/www/artisan speedtest:auth --disable
fi
fi
echo "Clearing old jobs from queue"
php82 /config/www/artisan queue:clear
php /config/www/artisan queue:clear
mkdir -p /config/log/speedtest

View File

@@ -1,3 +1,3 @@
#!/usr/bin/with-contenv bash
exec s6-setuidgid abc php82 /config/www/artisan queue:work --timeout=120 >> /config/log/speedtest/queue.log
exec s6-setuidgid abc php /config/www/artisan queue:work --timeout=120 >> /config/log/speedtest/queue.log

View File

@@ -1,7 +1,6 @@
<?php
use App\Helpers\SettingsHelper;
use GuzzleHttp\Psr7\MimeType;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Route;
@@ -22,7 +21,7 @@ Route::get(SettingsHelper::getBase() . 'files/{path?}', function ($file) {
$fileP = public_path() . '/' . $fileP;
if (file_exists($fileP)) {
$contents = File::get($fileP);
$mime = MimeType::fromFilename($fileP);
$mime = \GuzzleHttp\Psr7\mimetype_from_filename($fileP);
return Response::make(File::get($fileP), 200, ['Content-type' => $mime]);
} else {
abort(404);