Преглед на файлове

Merge branch 'master' into fix-docker-images

sstidl преди 1 година
родител
ревизия
de846743dc
променени са 4 файла, в които са добавени 40 реда и са изтрити 11 реда
  1. 6 6
      doc_docker.md
  2. 6 2
      docker/entrypoint.sh
  3. 14 3
      docker/test/docker-compose.yml
  4. 14 0
      docker/test/test-script.sh

+ 6 - 6
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

+ 6 - 2
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
 

+ 14 - 3
docker/test/docker-compose.yml

@@ -11,7 +11,7 @@ x-shared:
       - TELEMETRY=true
 
 services:
-  ###################### POSTGRESQL ################################
+###################### POSTGRESQL ################################
   pg:
     image: postgres:alpine
     environment:
@@ -48,7 +48,7 @@ services:
     ports:
       - 9124:8080
 
-  ####################### MYSQL ##############################
+####################### MYSQL ##############################
 
   mysql:
     image: mysql:lts
@@ -88,7 +88,8 @@ services:
     ports:
       - 9126:8080
 
-  ###### SQLITE ######
+################ SQLITE ####################################
+
   speedtest-debian-sqlite:
     # check at http://localhost:9125/results/sanitycheck.php
     build:
@@ -111,6 +112,7 @@ services:
     environment: *env_vars_sqlite
     ports:
       - 9128:8080
+
   speedtest-alpine-sqlite-dual:
     <<: *speedtest-service
     build:
@@ -123,3 +125,12 @@ services:
       - ./servers.json:/servers.json:ro
     ports:
       - 9129:8080
+
+##############  TEST CONTAINER  ###############################################################
+  test-container:
+    image: alpine
+    volumes:
+      - ./test-script.sh:/test-script.sh
+    command:
+      - sh
+      - /test-script.sh

+ 14 - 0
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