46 Commits
Author SHA1 Message Date
Robin-Manuel Thiel 9b93de5350 feat: Handle connection failures as 0 values 2025-01-10 13:58:12 +01:00
Robin-Manuel Thiel b1153d34e4 fix: SPEEDTEST_HOSTNAME variable name v1.0.0 2024-06-17 15:27:54 +02:00
Robin-Manuel ThielandGitHub b03a1e8119 Simplify speedtest script by reducing server options 2024-06-17 15:15:26 +02:00
Robin-Manuel ThielandGitHub 0ad5a6901f Update README.md 2024-06-17 15:08:35 +02:00
Robin-Manuel ThielandGitHub f094c84656 Update README.md 2024-06-17 15:07:40 +02:00
Robin-Manuel ThielandGitHub 817def73f6 Merge pull request #19 from bazzani/add-support-for-server-flags
Add support for server options (`-s` and `-o`)
2024-06-17 15:06:12 +02:00
Barry Evans cf30d79d13 Add support for server options (-s and -o)
We want to be able to pass a server ID or fully qualified hostname to
the speedtest CLI command so that we can use a specific server to test
against, rather than the default server that the CLI selects for us.

This change adds two new mutually exclusive environment variables which
can be used to specify either:
1. `SPEEDTEST_SERVER_ID` - A server from the server list using its id
2. `SPEEDTEST_HOSTNAME`  - A server, from the server list, using its
    host's fully qualified domain name

Impact on the speedtest CLI command:
1. If `SPEEDTEST_SERVER_ID` is specified, the `-s` option will be added

2. If `SPEEDTEST_HOSTNAME` is specified, the `-o` option will be added

3. If both environment variables are specified, the container will error
   out and not run the speedtest CLI command

4. If neither of the new environment variables are not present, the CLI
   command will be called as usual with the default server
   - `JSON=$(speedtest --accept-license --accept-gdpr -f json)`

5. If you specify an invalid server ID/host name you will see an error:
- `{"type":"log","timestamp":"2024-06-17T03:39:08Z","message":"Configuration - No servers defined (NoServersException)","level":"error"}`

---

To get the available ids, sponsors, and hostnames from speedtest run:
- `curl -s https://cli.speedtest.net/api/cli/config | jq -r '.servers[] | "id: \(.id), sponsor: \(.sponsor), host: \(.host)"'`

and you will get a response like:

```
id: 32298, sponsor: SYNLINQ, host: speedtest1.synlinq.de:8080
id: 44081, sponsor: 23M GmbH, host: speedtest.23m.com:8080
id: 53257, sponsor: LWLcom GmbH, host: netservice01.fra02.lwlcom.net:8080
id: 40094, sponsor: PVDataNet, host: speedtestde.pvdatanet.com:8080
id: 55462, sponsor: Twerion.net | Minecraft Server, host: speedtest.twerion.net:8080
id: 37492, sponsor: Melbicom, host: speedtest-fra.melbicom.net:8080
id: 10010, sponsor: fdcservers.net, host: lg-fra.fdcservers.net:8080
id: 54504, sponsor: Deutsche Glasfaser, host: speed2.dg-sys.net:8080
id: 46569, sponsor: wirsNET, host: speed1.wirsnet.com:8080
id: 23712, sponsor: kko.me | avrx.de, host: speedtest.kko.me:8080
```

Remove the port number from the entry and run the container with the new
environment variable, for example:
- `docker run -e SPEEDTEST_SERVER_ID=32298 robinmanuelthiel/speedtest:latest`
- `docker run -e SPEEDTEST_HOSTNAME=speedtest1.synlinq.de robinmanuelthiel/speedtest:latest`
2024-06-17 13:41:28 +09:00
Robin-Manuel ThielandGitHub 9a5ce76de5 Merge pull request #18 from bazzani/fix-docker-build
Fix docker build - `apt-get install speedtest` failing
2024-06-09 12:29:24 +02:00
Barry Evans cd68f3e4cf Fix docker build - apt-get install speedtest failing
When building the image I am seeing problems trying to install the
speedtest package. This is fixed by using the current installation
command from the speedtest website:
- https://www.speedtest.net/apps/cli
- ```
  RUN curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash
  RUN apt-get install -y speedtest
  ```

---

Build error log:

```shell
docker build -t robinmanuelthiel/speedtest:latest .
[+] Building 18.5s (9/10)                                                                                        docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                             0.0s
 => => transferring dockerfile: 335B                                                                                             0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye                                                               1.5s
 => [auth] library/debian:pull token for registry-1.docker.io                                                                    0.0s
 => [internal] load .dockerignore                                                                                                0.0s
 => => transferring context: 2B                                                                                                  0.0s
 => CACHED [1/5] FROM docker.io/library/debian:bullseye@sha256:2c7a92a41cb814c00e7d455b2bc0c90ccdb9a4ced2ffdc10e562c7a84a186032  0.0s
 => [internal] load build context                                                                                                0.0s
 => => transferring context: 34B                                                                                                 0.0s
 => [2/5] RUN apt-get update && apt-get install -y curl jq gnupg1 apt-transport-https dirmngr                                    11.1s
 => [3/5] RUN curl -s https://install.speedtest.net/app/cli/install.deb.sh | bash                                                5.3s
 => ERROR [4/5] RUN apt-get install speedtest                                                                                    0.5s
------
 > [4/5] RUN apt-get install speedtest:
0.094 Reading package lists...
0.390 Building dependency tree...
0.458 Reading state information...
0.501 E: Unable to locate package speedtest
------
Dockerfile:8
--------------------
   6 |     # Install speedtest cli
   7 |     RUN curl -s https://install.speedtest.net/app/cli/install.deb.sh | bash
   8 | >>> RUN apt-get install speedtest
   9 |
  10 |     COPY ./speedtest.sh .
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get install speedtest" did not complete successfully: exit code: 100

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/tur2dm7wqi33zu9shh9s5zepd
```
2024-05-30 17:22:21 +09:00
Robin-Manuel ThielandGitHub 1f3c8db8a4 Add restart:always #10 2023-06-16 18:04:36 +02:00
Robin-Manuel ThielandGitHub a3975ce848 Update README.md 2022-02-17 13:27:31 +01:00
Robin-Manuel ThielandGitHub 2ecf18a95e Update README.md 2022-02-14 10:19:28 +01:00
Robin-Manuel ThielandGitHub 902cbf2c3b Update README.md 2022-01-31 10:50:13 +01:00
Robin-Manuel ThielandGitHub ba17b3d6b1 Update release.yaml v0.3.0 2022-01-17 14:20:53 +01:00
Robin-Manuel ThielandGitHub a8da8ce334 Merge pull request #5 from ignacioborrajo/master
Add ping value
2022-01-17 14:18:50 +01:00
ignacioborrajoandGitHub 40c369c68c Update speedtest.sh 2021-12-18 23:58:07 +01:00
Robin-Manuel ThielandGitHub 1c6edf9d96 Update Dockerfile v0.2.1 2021-11-03 14:47:41 +01:00
Robin-Manuel ThielandGitHub c12c716a17 Merge pull request #4 from mauritsderuiter95/master
Update Dockerfile
2021-11-03 14:46:38 +01:00
Maurits de RuiterandGitHub d69b710a10 Update Dockerfile 2021-11-02 12:18:58 +01:00
Robin-Manuel ThielandGitHub c7f86164e1 Update README.md 2021-11-02 10:48:39 +01:00
Robin-Manuel Thiel f261a4dbd9 Update pipeline v0.2.0 2021-11-02 09:48:42 +01:00
Robin-Manuel Thiel 926880e3ee Update Release Pipeline 2021-11-02 09:34:23 +01:00
Robin-Manuel Thiel 114a25af43 Update Pipeline 2021-11-02 01:02:49 +01:00
Robin-Manuel Thiel 54f3eabcce Pipeline updates 2021-11-02 00:43:56 +01:00
Robin-Manuel Thiel 033f6ea79a Update Dockerfile 2021-11-02 00:41:50 +01:00
Robin-Manuel Thiel 8a9bf9ce3e Update Pipeline 2021-11-02 00:18:02 +01:00
Robin-Manuel ThielandGitHub 8d406c9df6 Update release.yaml 2021-11-02 00:10:55 +01:00
Robin-Manuel ThielandGitHub 5d605a9c9a Update release.yaml 2021-11-02 00:10:27 +01:00
Robin-Manuel Thiel 78c780f9ff Update Pipeline 2021-11-02 00:08:51 +01:00
Robin-Manuel Thiel 7d6e9a0dab Simplofy Dockerfile 2021-11-02 00:02:20 +01:00
Robin-Manuel Thiel f3c4f4e0b0 Update Docker Pipeline 2021-11-01 23:55:48 +01:00
Robin-Manuel Thiel cb0ac5c919 Update release 2021-11-01 23:50:04 +01:00
Robin-Manuel Thiel 32859d4d70 Update pipeline 2021-11-01 20:59:32 +01:00
Robin-Manuel ThielandGitHub a46055d136 Update release.yaml 2021-11-01 20:32:02 +01:00
Robin-Manuel Thiel 2fd1a79bd4 Update Dockerfile 2021-11-01 20:25:58 +01:00
Robin-Manuel Thiel 0244ce6e80 Add Arch to Dockerfile 2021-11-01 20:18:55 +01:00
Robin-Manuel ThielandGitHub 44d1cf4545 Merge pull request #2 from meikmenzel/patch-1
Fixed spelling mistake
2021-11-01 19:26:56 +01:00
Meik MenzelandGitHub fb1c8ee5e9 Fixed spelling mistake 2021-10-24 02:36:27 +02:00
Robin-Manuel ThielandGitHub 6f24e83f16 Update README.md 2020-05-01 12:12:02 +02:00
Robin-Manuel ThielandGitHub 3cdaba5324 Update README.md 2020-04-18 10:58:00 +02:00
Robin-Manuel Thiel c43827e014 Add grafana screenshot 2020-04-18 10:52:57 +02:00
Robin-Manuel ThielandGitHub 52e07879f7 Update README.md 2020-04-18 10:41:26 +02:00
Robin-Manuel ThielandGitHub 0082faccfb Update README.md 2020-04-18 10:37:47 +02:00
Robin-Manuel Thiel 64cddf19d1 Add demo docker-compose file 2020-04-17 17:10:42 +02:00
Robin-Manuel Thiel 3fd0f8b73a Initial commit 2020-04-17 16:08:47 +02:00
Robin-Manuel ThielandGitHub e4ceb39bc4 Initial commit 2020-04-17 16:06:12 +02:00