Skip to content

Commit 3ad0777

Browse files
push-app-to-main[bot]MickLesktremor021
authored
Speedtest-Tracker (#9802)
* Add speedtest-tracker (ct) * Update speedtest-tracker.sh * Update date_created and logo in JSON file * Update Speedtest Tracker installation script for local IP * Apply suggestion from @tremor021 * Update install/speedtest-tracker-install.sh Co-authored-by: Slaviša Arežina <[email protected]> * Update install/speedtest-tracker-install.sh Co-authored-by: Slaviša Arežina <[email protected]> --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <[email protected]> Co-authored-by: Slaviša Arežina <[email protected]>
1 parent 7dcb2fa commit 3ad0777

File tree

4 files changed

+286
-0
lines changed

4 files changed

+286
-0
lines changed

ct/headers/speedtest-tracker

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_____ ____ __ ______ __
2+
/ ___/____ ___ ___ ____/ / /____ _____/ /_ /_ __/________ ______/ /_____ _____
3+
\__ \/ __ \/ _ \/ _ \/ __ / __/ _ \/ ___/ __/_____/ / / ___/ __ `/ ___/ //_/ _ \/ ___/
4+
___/ / /_/ / __/ __/ /_/ / /_/ __(__ ) /_/_____/ / / / / /_/ / /__/ ,< / __/ /
5+
/____/ .___/\___/\___/\__,_/\__/\___/____/\__/ /_/ /_/ \__,_/\___/_/|_|\___/_/
6+
/_/

ct/speedtest-tracker.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: AlphaLawless
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/alexjustesen/speedtest-tracker
7+
8+
APP="Speedtest-Tracker"
9+
var_tags="${var_tags:-monitoring}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-2048}"
12+
var_disk="${var_disk:-4}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d /opt/speedtest-tracker ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
if check_for_gh_release "speedtest-tracker" "alexjustesen/speedtest-tracker"; then
33+
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="common,sqlite3,redis" setup_php
34+
setup_composer
35+
NODE_VERSION="22" setup_nodejs
36+
37+
msg_info "Stopping Service"
38+
systemctl stop speedtest-tracker
39+
msg_ok "Stopped Service"
40+
41+
msg_info "Updating Speedtest CLI"
42+
$STD apt update
43+
$STD apt --only-upgrade install -y speedtest
44+
msg_ok "Updated Speedtest CLI"
45+
46+
msg_info "Creating Backup"
47+
cp -r /opt/speedtest-tracker /opt/speedtest-tracker-backup
48+
msg_ok "Backup Created"
49+
50+
fetch_and_deploy_gh_release "speedtest-tracker" "alexjustesen/speedtest-tracker" "tarball" "latest" "/opt/speedtest-tracker"
51+
52+
msg_info "Updating Speedtest Tracker"
53+
cp -r /opt/speedtest-tracker-backup/.env /opt/speedtest-tracker/.env
54+
cd /opt/speedtest-tracker
55+
export COMPOSER_ALLOW_SUPERUSER=1
56+
$STD composer install --optimize-autoloader --no-dev
57+
$STD npm ci
58+
$STD npm run build
59+
$STD php artisan migrate --force
60+
$STD php artisan config:clear
61+
$STD php artisan cache:clear
62+
$STD php artisan view:clear
63+
chown -R www-data:www-data /opt/speedtest-tracker
64+
chmod -R 755 /opt/speedtest-tracker/storage
65+
chmod -R 755 /opt/speedtest-tracker/bootstrap/cache
66+
msg_ok "Updated Speedtest Tracker"
67+
68+
msg_info "Starting Service"
69+
systemctl start speedtest-tracker
70+
msg_ok "Started Service"
71+
msg_ok "Updated successfully"
72+
fi
73+
exit
74+
}
75+
76+
start
77+
build_container
78+
description
79+
80+
msg_ok "Completed Successfully!\n"
81+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
82+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
83+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "Speedtest-Tracker",
3+
"slug": "speedtest-tracker",
4+
"categories": [
5+
4
6+
],
7+
"date_created": "2025-12-09",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 80,
12+
"documentation": "https://docs.speedtest-tracker.dev/",
13+
"website": "https://github.com/alexjustesen/speedtest-tracker",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/speedtest-tracker.webp",
15+
"config_path": "/opt/speedtest-tracker/.env",
16+
"description": "Speedtest Tracker is a self-hosted application that runs scheduled speed tests using the Ookla Speedtest CLI and saves the results to a database for historical tracking and visualization.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/speedtest-tracker.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 2048,
24+
"hdd": 4,
25+
"os": "debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": "[email protected]",
32+
"password": "password"
33+
},
34+
"notes": []
35+
}
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: AlphaLawless
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/alexjustesen/speedtest-tracker
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
nginx \
19+
sqlite3
20+
msg_ok "Installed Dependencies"
21+
22+
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="common,sqlite3,redis" setup_php
23+
setup_composer
24+
NODE_VERSION="22" setup_nodejs
25+
import_local_ip
26+
fetch_and_deploy_gh_release "speedtest-tracker" "alexjustesen/speedtest-tracker" "tarball" "latest" "/opt/speedtest-tracker"
27+
28+
msg_info "Installing Speedtest CLI"
29+
setup_deb822_repo \
30+
"speedtest-cli" \
31+
"https://packagecloud.io/ookla/speedtest-cli/gpgkey" \
32+
"https://packagecloud.io/ookla/speedtest-cli/debian" \
33+
"$(get_os_info codename)" \
34+
"main"
35+
$STD apt install -y speedtest
36+
msg_ok "Installed Speedtest CLI"
37+
38+
msg_info "Configuring PHP-FPM runtime directory"
39+
mkdir -p /etc/systemd/system/php8.4-fpm.service.d/
40+
cat <<EOF >/etc/systemd/system/php8.4-fpm.service.d/override.conf
41+
[Service]
42+
RuntimeDirectory=php
43+
RuntimeDirectoryMode=0755
44+
EOF
45+
msg_ok "Configured PHP-FPM runtime directory"
46+
47+
msg_info "Setting up Speedtest Tracker"
48+
cd /opt/speedtest-tracker
49+
APP_KEY=$(php -r "echo bin2hex(random_bytes(16));")
50+
TIMEZONE=$(timedatectl | grep "Time zone" | awk '{print $3}')
51+
cat <<EOF >/opt/speedtest-tracker/.env
52+
APP_NAME="Speedtest Tracker"
53+
APP_ENV=production
54+
APP_TIMEZONE=${TIMEZONE}
55+
APP_KEY=base64:$(echo -n $APP_KEY | base64)
56+
APP_DEBUG=false
57+
APP_URL=http://${LOCAL_IP}
58+
59+
LOG_CHANNEL=stack
60+
LOG_LEVEL=debug
61+
62+
DB_CONNECTION=sqlite
63+
DB_DATABASE=/opt/speedtest-tracker/database/database.sqlite
64+
65+
BROADCAST_DRIVER=log
66+
CACHE_DRIVER=file
67+
FILESYSTEM_DISK=local
68+
QUEUE_CONNECTION=sync
69+
SESSION_DRIVER=file
70+
SESSION_LIFETIME=120
71+
72+
SPEEDTEST_SCHEDULE="0 */6 * * *"
73+
SPEEDTEST_SERVERS=
74+
PRUNE_RESULTS_OLDER_THAN=0
75+
76+
DISPLAY_TIMEZONE=${TIMEZONE}
77+
EOF
78+
mkdir -p /opt/speedtest-tracker/database
79+
touch /opt/speedtest-tracker/database/database.sqlite
80+
export COMPOSER_ALLOW_SUPERUSER=1
81+
$STD composer install --optimize-autoloader --no-dev
82+
$STD npm ci
83+
$STD npm run build
84+
$STD php artisan key:generate --force
85+
$STD php artisan migrate --force --seed
86+
$STD php artisan config:clear
87+
$STD php artisan cache:clear
88+
$STD php artisan view:clear
89+
chown -R www-data:www-data /opt/speedtest-tracker
90+
chmod -R 755 /opt/speedtest-tracker/storage
91+
chmod -R 755 /opt/speedtest-tracker/bootstrap/cache
92+
msg_ok "Set up Speedtest Tracker"
93+
94+
msg_info "Creating Service"
95+
cat <<EOF >/etc/systemd/system/speedtest-tracker.service
96+
[Unit]
97+
Description=Speedtest Tracker Queue Worker
98+
After=network.target
99+
100+
[Service]
101+
Type=simple
102+
User=www-data
103+
Group=www-data
104+
Restart=always
105+
ExecStart=/usr/bin/php /opt/speedtest-tracker/artisan queue:work --sleep=3 --tries=3 --max-time=3600
106+
WorkingDirectory=/opt/speedtest-tracker
107+
108+
[Install]
109+
WantedBy=multi-user.target
110+
EOF
111+
systemctl enable -q --now speedtest-tracker
112+
msg_ok "Created Service"
113+
114+
msg_info "Setting up Scheduler"
115+
cat <<EOF >/etc/cron.d/speedtest-tracker
116+
* * * * * www-data cd /opt/speedtest-tracker && php artisan schedule:run >> /dev/null 2>&1
117+
EOF
118+
msg_ok "Set up Scheduler"
119+
120+
msg_info "Configuring Nginx"
121+
cat <<EOF >/etc/nginx/sites-available/speedtest-tracker
122+
server {
123+
listen 80;
124+
server_name _;
125+
root /opt/speedtest-tracker/public;
126+
127+
add_header X-Frame-Options "SAMEORIGIN";
128+
add_header X-Content-Type-Options "nosniff";
129+
130+
index index.php;
131+
132+
charset utf-8;
133+
134+
location / {
135+
try_files \$uri \$uri/ /index.php?\$query_string;
136+
}
137+
138+
location = /favicon.ico { access_log off; log_not_found off; }
139+
location = /robots.txt { access_log off; log_not_found off; }
140+
141+
error_page 404 /index.php;
142+
143+
location ~ \.php$ {
144+
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
145+
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
146+
include fastcgi_params;
147+
}
148+
149+
location ~ /\.(?!well-known).* {
150+
deny all;
151+
}
152+
}
153+
EOF
154+
155+
ln -sf /etc/nginx/sites-available/speedtest-tracker /etc/nginx/sites-enabled/
156+
rm -f /etc/nginx/sites-enabled/default
157+
systemctl reload nginx
158+
msg_ok "Configured Nginx"
159+
160+
motd_ssh
161+
customize
162+
cleanup_lxc

0 commit comments

Comments
 (0)