Skip to content

Commit

Permalink
fix(api,docker): replaced speedtest-cli with speedtest
Browse files Browse the repository at this point in the history
  • Loading branch information
arghyadipchak committed Jun 11, 2022
1 parent 55ec6b2 commit 3f1b5ac
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ steps:
- docker buildx create --name builder --driver docker-container --use
- docker buildx inspect --bootstrap --builder builder
- docker buildx build
--platform linux/amd64,linux/arm/v7,linux/arm64/v8
--platform linux/amd64,linux/arm/v7,linux/arm64
--target prod
--label org.opencontainers.image.title="dash."
--label org.opencontainers.image.description="dash. - a modern server dashboard"
Expand Down
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,24 @@ RUN \
lsblk \
dmidecode \
util-linux \
lm-sensors \
speedtest-cli &&\
lm-sensors &&\
apk --no-cache add \
raspberrypi \
|| true

ARG TARGETPLATFORM
RUN \
if [ "$TARGETPLATFORM" = "linux/amd64" ] ; \
then wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-x86_64.tgz \
| tar xmoz -C /bin speedtest ; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ] ; \
then wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-aarch64.tgz \
| tar xmoz -C /bin speedtest ; \
elif [ "$TARGETPLATFORM" = "linux/arm/v7" ] ; \
then wget -qO- https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-armel.tgz \
| tar xmoz -C /bin speedtest ; \
fi

# DEV #
FROM base AS dev

Expand Down
4 changes: 1 addition & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ To run this repository from source, you need to have the following installed:
- [node.js](https://nodejs.org/) (recommended version 18.x)
- [yarn](https://yarnpkg.com/)
- [git](https://git-scm.com/)
- [speedtest-cli](https://github.com/sivel/speedtest-cli)
> Note: On Ubuntu, `speedtest-cli` can be installed using: `sudo apt install speedtest-cli`
- [speedtest](https://www.speedtest.net/apps/cli)
### Setup
Expand Down
9 changes: 5 additions & 4 deletions apps/api/src/static-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ export const runSpeedTest = async (): Promise<void> => {
const { stdout, stderr } = await exec('which speedtest');

if (stderr === '' && stdout.trim() !== '') {
const { stdout } = await exec('speedtest --json');
const { stdout } = await exec('speedtest -f-json');
const json = JSON.parse(stdout);

STATIC_INFO.network.speedDown =
json.download ?? STATIC_INFO.network.speedDown;
STATIC_INFO.network.speedUp = json.upload ?? STATIC_INFO.network.speedUp;
json.download.bandwidth * 8 ?? STATIC_INFO.network.speedDown;
STATIC_INFO.network.speedUp =
json.upload.bandwidth * 8 ?? STATIC_INFO.network.speedUp;
STATIC_INFO.network.publicIp =
json.client.ip ?? STATIC_INFO.network.publicIp;
json.interface.externalIp ?? STATIC_INFO.network.publicIp;
} else {
const universalSpeedtest = new UniversalSpeedtest({
measureUpload: true,
Expand Down

0 comments on commit 3f1b5ac

Please sign in to comment.