From c00ad26abe3bd280eadcbbbc2a587056f3640dea Mon Sep 17 00:00:00 2001 From: Stefan Stidl Date: Sun, 1 Dec 2024 22:08:51 +0100 Subject: [PATCH 1/3] fix permissions on db file --- docker/entrypoint.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 96c19460f..5414eae83 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -18,9 +18,13 @@ cp /speedtest/favicon.ico /var/www/html/ # Set custom webroot on alpine if is_alpine; then + echo "ALPINE IMAGE" sed -i "s#\"/var/www/localhost/htdocs\"#\"/var/www/html\"#g" /etc/apache2/httpd.conf +else + echo "DEBIAN IMAGE" fi + # Set up backend side for standlone modes if [[ "$MODE" == "standalone" || "$MODE" == "dual" ]]; then cp -r /speedtest/backend/ /var/www/html/backend @@ -82,9 +86,9 @@ if [[ "$TELEMETRY" == "true" && ("$MODE" == "frontend" || "$MODE" == "standalone mkdir -p /database/ if is_alpine; then - chown apache /database/ + chown -R apache /database/ else - chown www-data /database/ + chown -R www-data /database/ fi fi From a177238636fdc52a215ccd991f6931b90ebe97b0 Mon Sep 17 00:00:00 2001 From: sstidl Date: Sun, 1 Dec 2024 22:44:37 +0100 Subject: [PATCH 2/3] improve test scripts --- docker/test/docker-compose.yml | 16 +++++++++++++--- docker/test/test-script.sh | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 docker/test/test-script.sh diff --git a/docker/test/docker-compose.yml b/docker/test/docker-compose.yml index 918fe74a7..b04e18f18 100644 --- a/docker/test/docker-compose.yml +++ b/docker/test/docker-compose.yml @@ -2,7 +2,7 @@ ## do not use it in production services: - ###################### POSTGRESQL ################################ +###################### POSTGRESQL ################################ pg: image: postgres:alpine environment: @@ -39,7 +39,7 @@ services: ports: - 9124:8080 - ####################### MYSQL ############################## +####################### MYSQL ############################## mysql: image: mysql:lts @@ -79,7 +79,8 @@ services: ports: - 9126:8080 - ###### SQLITE ###### +################ SQLITE #################################### + speedtest-debian-sqlite: # check at http://localhost:9125/results/sanitycheck.php build: @@ -102,3 +103,12 @@ services: environment: *env_vars_sqlite ports: - 9128:8080 + +############## TEST CONTAINER ############################################################### + test-container: + image: alpine + volumes: + - ./test-script.sh:/test-script.sh + command: + - sh + - /test-script.sh diff --git a/docker/test/test-script.sh b/docker/test/test-script.sh new file mode 100644 index 000000000..27d236014 --- /dev/null +++ b/docker/test/test-script.sh @@ -0,0 +1,14 @@ +PORT=8080 + +apk add w3m + +echo sleeping a little to get things setteled... +sleep 10 + +for db in sqlite pg mysql; do + for distro in alpine debian; do + hostname=speedtest-$distro-$db + echo $hostname + w3m -dump http://$hostname:$PORT/results/sanitycheck.php|grep -v 'N/A' + done +done From a8af966d8800a52e1674ab474c4a0d33cabb88a7 Mon Sep 17 00:00:00 2001 From: iJuhan Date: Mon, 2 Dec 2024 19:56:13 +0100 Subject: [PATCH 3/3] fix: Update docker docs --- doc_docker.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc_docker.md b/doc_docker.md index c02e5e369..2ee4de38c 100755 --- a/doc_docker.md +++ b/doc_docker.md @@ -11,10 +11,10 @@ An Alpine Linux based docker version of LibreSpeed is also available here: [GitH If you just want to try it, the fastest way is: ```shell -docker run -p 80:80 -d --name speedtest --rm ghcr.io/librespeed/speedtest +docker run -p 80:8080 -d --name speedtest --rm ghcr.io/librespeed/speedtest ``` -Then go with your browser to port 80 of your server and try it out. If port 80 is already in use, adjust the first number in 80:80 above. +Then go with your browser to port 80 of your server and try it out. If port 80 is already in use, adjust the first number in 80:8080 above. Default is to run in standalone mode. ## Docker Compose @@ -41,9 +41,9 @@ services: #DISABLE_IPINFO: "false" #IPINFO_APIKEY: "your api key" #DISTANCE: "km" - #WEBPORT: 80 + #WEBPORT: 8080 ports: - - "80:80" # webport mapping (host:container) + - "80:8080" # webport mapping (host:container) ``` Please adjust the environment variables according to the intended operating mode. @@ -73,7 +73,7 @@ Here's a list of additional environment variables available in this mode: * __`DISABLE_IPINFO`__: If set to `true`, ISP info and distance will not be fetched from either [ipinfo.io](https://ipinfo.io) or the offline database. Default: value: `false` * __`IPINFO_APIKEY`__: API key for [ipinfo.io](https://ipinfo.io). Optional, but required if you want to use the full [ipinfo.io](https://ipinfo.io) APIs (required for distance measurement) * __`DISTANCE`__: When `DISABLE_IPINFO` is set to false, this specifies how the distance from the server is measured. Can be either `km` for kilometers, `mi` for miles, or an empty string to disable distance measurement. Requires an [ipinfo.io](https://ipinfo.io) API key. Default value: `km` -* __`WEBPORT`__: Allows choosing a custom port for the included web server. Default value: `80`. Note that you will have to expose it through docker with the -p argument. This is not the port where the service is exposed outside docker! +* __`WEBPORT`__: Allows choosing a custom port for the included web server. Default value: `8080`. Note that you will have to expose it through docker with the -p argument. This is not the port where the service is exposed outside docker! If telemetry is enabled, a stats page will be available at `http://your.server/results/stats.php`, but a password must be specified. @@ -110,7 +110,7 @@ Here's a list of additional environment variables available in this mode: This command starts LibreSpeed in backend mode, with the default settings, on port 80: ```shell -docker run -e MODE=backend -p 80:80 -it ghcr.io/librespeed/speedtest +docker run -e MODE=backend -p 80:8080 -it ghcr.io/librespeed/speedtest ``` ### Frontend mode