Merge pull request #693 from librespeed/fix-docker-images

Fix docker images and dual mode
This commit is contained in:
sstidl 2025-02-13 19:59:25 +01:00 • committed by GitHub
commit a1c43977ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 464 additions and 4 deletions

View file

@ -4,6 +4,7 @@ RUN apk add --quiet --no-cache \
apache2 \
php-apache2 \
php-ctype \
php-phar \
php-gd \
php-openssl \
php-pdo \

4
docker/test/README.md Normal file
View file

@ -0,0 +1,4 @@
The files in this folder represent a simple end to end test.
At the moment it is interactive, so you need to run `docker compose up` in the folder and watch the output for errors.
Sometimes the mysql container needs more than 15 seconds, so the test_script fails.
Just try it again.

View file

@ -1,5 +1,14 @@
## this is a docker compose file used to test all scenarios
## do not use it in production
x-shared:
speedtest-service: &speedtest-service
environment:
- PASSWORD=gimmeTheStats1337
- EMAIL=test@example.com
- ENABLE_ID_OBFUSCATION=true
- MODE=standalone
- REDACT_IP_ADDRESSES=true
- TELEMETRY=true
services:
###################### POSTGRESQL ################################
@ -104,9 +113,27 @@ services:
ports:
- 9128:8080
speedtest-alpine-sqlite-dual:
<<: *speedtest-service
build:
context: ../..
dockerfile: Dockerfile.alpine
environment:
- MODE=dual
volumes:
- ./servers.json:/servers.json:ro
ports:
- 9129:8080
############## TEST CONTAINER ###############################################################
test-container:
image: alpine
depends_on:
- pg
- mysql
- speedtest-alpine-mysql
- speedtest-alpine-pg
volumes:
- ./test-script.sh:/test-script.sh
command:

409
docker/test/servers.json Normal file
View file

@ -0,0 +1,409 @@
[
{
"name": "Amsterdam, Netherlands (Clouvider)",
"server": "//ams.speedtest.clouvider.net/backend",
"id": 51,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Clouvider",
"sponsorURL": "https://www.clouvider.co.uk/"
},
{
"name": "Amsterdam, Netherlands (Sharktech)",
"server": "https://amsspeed.sharktech.net",
"id": 94,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Sharktech",
"sponsorURL": "https://sharktech.net"
},
{
"name": "Atlanta, United States (Clouvider)",
"server": "//atl.speedtest.clouvider.net/backend",
"id": 53,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Clouvider",
"sponsorURL": "https://www.clouvider.co.uk/"
},
{
"name": "Bangalore, India (DigitalOcean)",
"server": "//in1.backend.librespeed.org/",
"id": 75,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "DigitalOcean",
"sponsorURL": "https://www.digitalocean.com"
},
{
"name": "Bari, Italy (GARR)",
"server": "https://st-be-ba1.infra.garr.it",
"id": 33,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Consortium GARR",
"sponsorURL": "//garr.it"
},
{
"name": "Bologna, Italy (GARR)",
"server": "https://st-be-bo1.infra.garr.it",
"id": 34,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Consortium GARR",
"sponsorURL": "//garr.it"
},
{
"name": "Chicago, USA (Sharktech)",
"server": "https://chispeed.sharktech.net",
"id": 93,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Sharktech",
"sponsorURL": "https://sharktech.net"
},
{
"name": "Denver, USA (Sharktech)",
"server": "https://denspeed.sharktech.net",
"id": 92,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Sharktech",
"sponsorURL": "https://sharktech.net"
},
{
"name": "Frankfurt, Germany (Clouvider)",
"server": "//fra.speedtest.clouvider.net/backend",
"id": 50,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Clouvider",
"sponsorURL": "https://www.clouvider.co.uk/"
},
{
"name": "Frankfurt, Germany (FRA01)",
"server": "https://speedtest.lumischvps.cloud/",
"id": 86,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "LumischVPS",
"sponsorURL": "https://discord.gg/GxYzPwJmA2"
},
{
"name": "Ghom, Iran (Amin IDC)",
"server": "https://fastme.ir/",
"id": 77,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Bardia Moshiri",
"sponsorURL": "https://bardia.tech/"
},
{
"name": "Helsinki, Finland (3) (Hetzner)",
"server": "//finew.openspeed.org/",
"id": 22,
"dlURL": "backend437/garbage.php",
"ulURL": "backend437/empty.php",
"pingURL": "backend437/empty.php",
"getIpURL": "backend437/getIP.php",
"sponsorName": "Daily Health Insurance Group",
"sponsorURL": "//dhig.net/"
},
{
"name": "Helsinki, Finland (5) (Hetzner)",
"server": "//fast.kabi.tk/",
"id": 24,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "KABI.tk",
"sponsorURL": "//kabi.tk"
},
{
"name": "Johannesburg, South Africa (Host Africa)",
"server": "//za1.backend.librespeed.org/",
"id": 70,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "HOSTAFRICA",
"sponsorURL": "https://www.hostafrica.co.za"
},
{
"name": "Las Vegas, USA (Sharktech)",
"server": "https://lasspeed.sharktech.net",
"id": 90,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Sharktech",
"sponsorURL": "https://sharktech.net"
},
{
"name": "London, England (Clouvider)",
"server": "//lon.speedtest.clouvider.net/backend",
"id": 49,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Clouvider",
"sponsorURL": "https://www.clouvider.co.uk/"
},
{
"name": "Los Angeles, United States (1) (Clouvider)",
"server": "//la.speedtest.clouvider.net/backend",
"id": 54,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Clouvider",
"sponsorURL": "https://www.clouvider.co.uk/"
},
{
"name": "Los Angeles, USA (Sharktech)",
"server": "https://laxspeed.sharktech.net",
"id": 91,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Sharktech",
"sponsorURL": "https://sharktech.net"
},
{
"name": "New York, United States (2) (Clouvider)",
"server": "//nyc.speedtest.clouvider.net/backend",
"id": 52,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Clouvider",
"sponsorURL": "https://www.clouvider.co.uk/"
},
{
"name": "Nottingham, England (LayerIP)",
"server": "https://uk1.backend.librespeed.org",
"id": 43,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "fosshost.org",
"sponsorURL": "https://fosshost.org"
},
{
"name": "Nuremberg, Germany (1) (Hetzner)",
"server": "//de1.backend.librespeed.org",
"id": 28,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Snopyta",
"sponsorURL": "https://snopyta.org"
},
{
"name": "Nuremberg, Germany (2) (Hetzner)",
"server": "//de4.backend.librespeed.org",
"id": 27,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "LibreSpeed",
"sponsorURL": "https://librespeed.org"
},
{
"name": "Nuremberg, Germany (3) (Hetzner)",
"server": "//de3.backend.librespeed.org",
"id": 30,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "LibreSpeed",
"sponsorURL": "https://librespeed.org"
},
{
"name": "Nuremberg, Germany (4) (Hetzner)",
"server": "//de5.backend.librespeed.org",
"id": 31,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "LibreSpeed",
"sponsorURL": "https://librespeed.org"
},
{
"name": "Nuremberg, Germany (6) (Hetzner)",
"server": "//librespeed.lukas-heinrich.com/",
"id": 46,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "luki9100",
"sponsorURL": "https://lukas-heinrich.com/"
},
{
"name": "Ohio, USA (Rust backend)",
"server": "https://librespeed-rs.ir/",
"id": 95,
"dlURL": "backend/garbage",
"ulURL": "backend/empty",
"pingURL": "backend/empty",
"getIpURL": "backend/getIP",
"sponsorName": "Sudo Dios",
"sponsorURL": "https://github.com/SudoDios"
},
{
"name": "Poznan, Poland (INEA)",
"server": "https://speedtest.kamilszczepanski.com",
"id": 74,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Kamil Szczepański",
"sponsorURL": "https://kamilszczepanski.com"
},
{
"name": "Prague, Czech Republic (CESNET)",
"server": "//speedtest.cesnet.cz",
"id": 79,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "CESNET",
"sponsorURL": "https://www.cesnet.cz"
},
{
"name": "Prague, Czech Republic (Turris)",
"server": "//librespeed.turris.cz",
"id": 85,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Turris",
"sponsorURL": "https://www.turris.com"
},
{
"name": "Roma, Italy (GARR)",
"server": "https://st-be-rm2.infra.garr.it",
"id": 35,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Consortium GARR",
"sponsorURL": "//garr.it"
},
{
"name": "Serbia (SOX)",
"server": "https://speedtest2.sox.rs",
"id": 87,
"dlURL": "libre/backend/garbage.php",
"ulURL": "libre/backend/empty.php",
"pingURL": "libre/backend/empty.php",
"getIpURL": "libre/backend/getIP.php",
"sponsorName": "Serbian Open eXchange (SOX)",
"sponsorURL": "https://sox.rs"
},
{
"name": "Singapore (Salvatore Cahyo)",
"server": "https://speedtest.dsgroupmedia.com",
"id": 68,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Salvatore Cahyo",
"sponsorURL": "https://salvatorecahyo.my.id"
},
{
"name": "Tehran, Iran (Fanava)",
"server": "https://speedme.ir/",
"id": 76,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Bardia Moshiri",
"sponsorURL": "https://bardia.tech"
},
{
"name": "Tehran, Iran (Faraso)",
"server": "https://st.bardia.tech",
"id": 80,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "Bardia Moshiri",
"sponsorURL": "https://bardia.tech/"
},
{
"name": "Tokyo, Japan (A573)",
"server": "https://librespeed.a573.net/",
"id": 82,
"dlURL": "backend/garbage.php",
"ulURL": "backend/empty.php",
"pingURL": "backend/empty.php",
"getIpURL": "backend/getIP.php",
"sponsorName": "A573",
"sponsorURL": "https://mirror.a573.net/"
},
{
"name": "Vilnius, Lithuania (RackRay)",
"server": "//lt1.backend.librespeed.org/",
"id": 69,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Time4VPS",
"sponsorURL": "https://www.time4vps.com"
},
{
"name": "Virginia, United States, OVH",
"server": "https://speed.riverside.rocks/",
"id": 78,
"dlURL": "garbage.php",
"ulURL": "empty.php",
"pingURL": "empty.php",
"getIpURL": "getIP.php",
"sponsorName": "Riverside Rocks",
"sponsorURL": "https://riverside.rocks"
}
]

View file

@ -1,9 +1,16 @@
#!/bin/sh
## simple script to call sanitycheck on all containers
PORT=8080
apk add w3m
if ! apk add w3m; then
echo "Failed to install w3m package"
exit 1
fi
echo sleeping a little to get things setteled...
sleep 10
sleep 15
for db in sqlite pg mysql; do
for distro in alpine debian; do

View file

@ -11,12 +11,24 @@ function I(i){return document.getElementById(i);}
//LIST OF TEST SERVERS. See documentation for details if needed
<?php
$mode=getenv("MODE");
if($mode=="standalone" || $mode=="dual"){ ?>
if($mode=="standalone" || $mode=="backend"){ ?>
var SPEEDTEST_SERVERS=[];
<?php } else { ?>
var SPEEDTEST_SERVERS= <?= file_get_contents('/servers.json') ?: '[]' ?>;
<?php }
if ($mode=="dual"){ ?>
// add own server in dual mode
SPEEDTEST_SERVERS.unshift({
"name":"This Server",
"server":document.location.href+"backend/",
"id":1,
"dlURL":"garbage.php",
"ulURL":"empty.php",
"pingURL":"empty.php",
"getIpURL":"getIP.php",
"pingT":-1
})
<?php } ?>
//INITIALIZE SPEED TEST
var s=new Speedtest(); //create speed test object
<?php if(getenv("TELEMETRY")=="true"){ ?>