Skip to content

Commit

Permalink
Merge branch 'master' into fix-docker-images
Browse files Browse the repository at this point in the history
  • Loading branch information
sstidl authored Dec 29, 2024
2 parents 29e0686 + 5cad53e commit de84674
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
12 changes: 6 additions & 6 deletions doc_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
17 changes: 14 additions & 3 deletions docker/test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ x-shared:
- TELEMETRY=true

services:
###################### POSTGRESQL ################################
###################### POSTGRESQL ################################
pg:
image: postgres:alpine
environment:
Expand Down Expand Up @@ -48,7 +48,7 @@ services:
ports:
- 9124:8080

####################### MYSQL ##############################
####################### MYSQL ##############################

mysql:
image: mysql:lts
Expand Down Expand Up @@ -88,7 +88,8 @@ services:
ports:
- 9126:8080

###### SQLITE ######
################ SQLITE ####################################

speedtest-debian-sqlite:
# check at http://localhost:9125/results/sanitycheck.php
build:
Expand All @@ -111,6 +112,7 @@ services:
environment: *env_vars_sqlite
ports:
- 9128:8080

speedtest-alpine-sqlite-dual:
<<: *speedtest-service
build:
Expand All @@ -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 changes: 14 additions & 0 deletions docker/test/test-script.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit de84674

Please sign in to comment.