brennentsmith / internet-speed-logger

Open source application to track your internet download and upload speeds with an elegant web interface.
GNU General Public License v3.0
176 stars 33 forks source link

Requirements #1

Open ghost opened 4 years ago

ghost commented 4 years ago

I'm trying to get this running on a Debian server- the docker image doesn't seem to work on it's own (I'm getting an error connecting to mongodb and the container just keeps restarting, it's been like that for a while now)

Do I need to also clone this repo or install mongo myself?

brennentsmith commented 4 years ago

Are you running the docker-compose file, or just the docker image itself? If you are running compose, that will provide MongoDB. However if you are running just the docker image, you will need to provide a running MongoDB server and update the connection url in /config/default.js

brennentsmith commented 4 years ago

I'll make it so you can provide an ENV var to update those values so it's easier to run the base image.

ghost commented 4 years ago

I'm running the docker-compose file now. I've left it running for about an hour and I'm still getting the "failed to connect to server" image

brennentsmith commented 4 years ago

Interesting - it does appear that there are known oddities with the DNS resolver and Docker on Windows. Can you confirm that the mongo container is starting correctly? It also appears that there may be a firewall rule to adjust. https://forums.docker.com/t/embedded-dns-not-working/38425/2

What version of Docker are you using?

ghost commented 4 years ago

Accidentally got too much screenshot in there - it's a Debian VM that I just spun up for this. Docker CE 19.03.4.

docker ps shows no containers running.

If I do ps -a I get this:

CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS                            PORTS               NAMES
64d526d11665        brennentsmith/internet-speed-logger   "node run-speedtest.…"   33 minutes ago      Exited (137) About a minute ago                       internet-speed-logger_speedlogger-runner_1
239c3f5b7c24        brennentsmith/internet-speed-logger   "docker-entrypoint.s…"   33 minutes ago      Exited (1) About a minute ago                         internet-speed-logger_speedlogger-web_1
ee9e7c90243b        bitnami/mongodb                       "/entrypoint.sh /run…"   33 minutes ago      Exited (1) 33 minutes ago                             internet-speed-logger_mongo_1
root@speedtester:/home/jonathan/internet-speed-logger#

Looks like MongoDB is starting then immedietly stopping - I'm not too familiar with Docker in general so I'm not sure what's causing it.

The logs show this:

root@speedtester:/home/jonathan# docker logs ee9e7c90243b
 16:53:57.99
 16:53:57.99 Welcome to the Bitnami mongodb container
 16:53:57.99 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb
 16:53:57.99 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb/issues
 16:53:57.99 Send us your feedback at containers@bitnami.com
 16:53:57.99
 16:53:57.99 INFO  ==> ** Starting MongoDB setup **
 16:53:58.00 INFO  ==> Validating settings in MONGODB_* env vars...
 16:53:58.00 INFO  ==> Initializing MongoDB...
 16:53:58.01 INFO  ==> Deploying MongoDB from scratch...
mkdir: cannot create directory '/bitnami/mongodb': Permission denied
 17:28:50.25
 17:28:50.25 Welcome to the Bitnami mongodb container
 17:28:50.25 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb
 17:28:50.25 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb/issues
 17:28:50.25 Send us your feedback at containers@bitnami.com
 17:28:50.25
 17:28:50.25 INFO  ==> ** Starting MongoDB setup **
 17:28:50.26 INFO  ==> Validating settings in MONGODB_* env vars...
 17:28:50.27 INFO  ==> Initializing MongoDB...
 17:28:50.27 INFO  ==> Deploying MongoDB from scratch...
mkdir: cannot create directory '/bitnami/mongodb': Permission denied
root@speedtester:/home/jonathan#

Looks like a permissions issue but I wouldn't know how I would go about fixing it.

ghost commented 4 years ago

OK - I found a solution on a forum somewhere. I added an extra bit to the compose file which gave mongo full access to the /bitnami/ directory.

https://github.com/JonathanTF2/internet-speed-logger/blob/master/docker-compose.yml

Now I've done that Mongo opens fine and everything opens!

Only issue I've got now is that the "speedlogger-runner" container is erroring saying it can't find Speedtest:

Error executing Speedtest
Error: Command failed: speedtest -f json --accept-license
/bin/sh: 1: speedtest: not found

    at ChildProcess.exithandler (child_process.js:295:12)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:210:5)
    at Pipe.<anonymous> (net.js:658:12) {
  killed: false,
  code: 127,
  signal: null,
  cmd: 's

I've put speedtest from the tar archive in the /bin/ directory and it runs fine on host.

brennentsmith commented 4 years ago

Great solution! I'll make sure that is noted in the readme.

As for the command not found, did you change the path of the speedtest.commandString? The actual speedtest binary is burned into the docker image at bin/speedtest so as long as that is still the default, all should work. (The docker images were designed to be as self-contained as possible - you only need to download the binaries if you are running it outside of Docker.)