oslabs-beta / docker-watch-app

Collects and visualizes Docker container metrics over time. Operates as a container itself.
https://docker.watch
MIT License
71 stars 1 forks source link

SENSOR container not initializing/installing properly. #41

Open lnxredir opened 1 year ago

lnxredir commented 1 year ago

I'm getting the following errors on the sensor container:

> sensor1@0.0.1 start

> node index.js

TypeError: Cannot read properties of undefined (reading 'value')

    at IncomingMessage.<anonymous> (/code/index.js:65:80)

    at IncomingMessage.emit (node:events:525:35)

    at endReadableNT (node:internal/streams/readable:1359:12)

    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

The installation was done using the official method, the web container displays this: Invalid Host header My docker compose version is: v2.14.2 and my docker version is: 20.10.22

rob-mosher commented 1 year ago

Thank you for your detailed bug report, @lnxredir

What OS and version of that OS are you using?

lnxredir commented 1 year ago

Ah, sorry, forgot about that. Ubuntu Server 20.04

rob-mosher commented 1 year ago

All good! Are you using a GUI, and is so, which? What was your process for installing Docker?

lnxredir commented 1 year ago

No GUI involved, just doing the curl https://raw.githubusercontent.com/oslabs-beta/docker-watch-app/main/install.yaml | docker-compose -p dockerwatch -f - up -d command as shown, I then try check the logs (using portainer and cli) and get the issue above, weird eh?

rob-mosher commented 1 year ago

Thank you. If you could also share your process for installing Docker it would be helpful in assisting. Our product depends on Docker being installed, as it utilizes the docker socket, typically found at /var/run/docker.sock on *nix-based OS's.

Ingestion of the metrics will require a web browser, which likely requires a GUI unless you have port forwarding manually configured in some way. I suppose CURLing localhost could work but the graphs would likely not be legible as we're using React.

lnxredir commented 1 year ago

It's fine, the process I used is the official docker installation method, using the latest version, I have other containers that use the privileged flag and they work fine, maybe my version of docker is too recent?

rob-mosher commented 1 year ago

Thank you. I'm spinning up an Ubuntu Server 20.04 VM to experiment on. Will follow up.

lnxredir commented 1 year ago

Thank you so much for the support man, if there's anything I can help with or information to give just hit me up.

lnxredir commented 1 year ago

Ah, something I just remembered, if I run the install using docker-compose I get this error: ERROR: Version in "None" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under theserviceskey, or omit theversionkey and place your service definitions at the root of the file to use version 1. For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

I already know about this from other compose files that require new compose versions, if I run it using docker compose instead, it runs normally but the error persists.

EDIT The same error persists if I downgrade the docker version, allowing the old docker-compose command to work.

rob-mosher commented 1 year ago

Thank you for the additional information. I'll try with docker-compose and docker compose to see where it gets me.

rob-mosher commented 1 year ago

I've installed the Ubuntu 20.04 VM and am troubleshooting.

For next steps, from the terminal, what response do you get when running curl localhost:8854/api/v1/containers? It should be something like

[{"name":"/dockerwatch-db-1","id":"c478dd5a57e08b53c12a04a27f97753040e6d916cd205f107885ec5d043621a9"}]

Also, I wish to correct myself that the stats can be viewed from any other host on your network/subnet by visiting your host-ip on port 8855 via a web broswer. We may lock this down (or make it on option) in future versions.

Continuing to investigate the sensor1 issue.

lnxredir commented 1 year ago

From this specific command I got a few more options on my output, Ill just post the relevant ones.

{"name":"/dockerwatch-db-1","id":"3e026b58cfc61fb6db3a79dbfb9f70b9906e17b5dbe69217183bf9c1c5be4cb4"} {"name":"/dockerwatch-web-1","id":"9282d3e10b35e0515deab3f8836514fe7d65078da3b9f2ad61e9965da8a9d601"} {"name":"/dockerwatch-api-1","id":"9d699284c68737a4fc1b1b47850456f0f2f81d2d3c19e342a0714ebf86088122"}

Note that docker-sensor is not present on the list.

rob-mosher commented 1 year ago

Thank you. I was able to get the sensor working on my VM, however it is throwing the following errors:

TypeError: Cannot read properties of undefined (reading 'value')
    at IncomingMessage.<anonymous> (/code/index.js:65:80)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

I believe the next course of action is the Docker Watch team adjusting the software so that it works on Ubuntu 20.04 (the VM I just spun up), and from there taking further steps with you. It's possible that resolving the issue I'm able to produce may resolve your issue, but if not we'll take next steps with you from there. I'll coordinate with the team on Tuesday for next steps, as we are observing MLK day tomorrow.

Adding bug tag to issue.

lnxredir commented 1 year ago

Okay, thanks man, really appreciate all the support! Thanks for everything, Ill wait for a response back and happy MLK day for you and the team. Cheers!

rob-mosher commented 1 year ago

Thanks very much for your patience, @lnxredir ! Spoke with the team and the next window we have to continue troubleshooting this is on Sunday. We will follow up with you then.

lnxredir commented 1 year ago

Small update, I managed to get the sensor working properly, I did a 'wipe' of everything related to dockerwatch and re-run the compose and it's now up, now however the web container shows Invalid Host header.

The logs from the sensor container:

> sensor1@0.0.1 start

> node index.js

The logs from the web container:


> dockervision@0.0.1 dev:docker

> concurrently "npm run build:tailwindcss" "NODE_ENV=development webpack-dev-server --port 8855 "

[0] 

[0] > dockervision@0.0.1 build:tailwindcss

[0] > npx tailwindcss -i ./client/app.css -o ./dist/output.css

[0] 

[1] Failed to load ../../.env.

[1] <i> [webpack-dev-server] Project is running at:

[1] <i> [webpack-dev-server] Loopback: http://localhost:8855/

[1] <i> [webpack-dev-server] Content not from webpack is served from '/code/dist' directory

[0] 

[0] Rebuilding...

[0] 

[0] 🌼 daisyUI components 2.46.0  https://daisyui.com

[0]   ✔︎ Including:  base, components, 29 themes, utilities

[0]   ❤︎ Support daisyUI:  https://opencollective.com/daisyui 

[0]   

[0] 

[0] Done in 897ms.

[0] npm run build:tailwindcss exited with code 0

[1] 

[1] 🌼 daisyUI components 2.46.0  https://daisyui.com

[1]   ✔︎ Including:  base, components, 29 themes, utilities

[1]   ❤︎ Support daisyUI:  https://opencollective.com/daisyui 

[1]   

[1] asset bundle.js 2.37 MiB [emitted] (name: main)

[1] asset index.html 263 bytes [emitted]

[1] runtime modules 26.4 KiB 13 modules

[1] modules by path ./node_modules/ 2.02 MiB 49 modules

[1] modules by path ./client/ 92.3 KiB

[1]   modules by path ./client/containers/*.jsx 15.6 KiB

[1]     ./client/containers/App.jsx 4.95 KiB [built] [code generated]

[1]     ./client/containers/Sidebar.jsx 6.32 KiB [built] [code generated]

[1]     ./client/containers/GraphDisplay.jsx 4.36 KiB [built] [code generated]

[1]   modules by path ./client/*.css 70.9 KiB

[1]     ./client/app.css 2.45 KiB [built] [code generated]

[1]     ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/postcss-loader/dist/cjs.js!./client/app.css 68.4 KiB [built] [code generated]

[1]   modules by path ./client/components/*.jsx 5.38 KiB

[1]     ./client/components/ContainerButton.jsx 4.25 KiB [built] [code generated]

[1]     ./client/components/LineChart.jsx 1.14 KiB [built] [code generated]

[1]   ./client/index.jsx 473 bytes [built] [code generated]

[1] webpack 5.75.0 compiled successfully in 4959 ms

[1] assets by path *.js 2.37 MiB

[1]   asset bundle.js 2.37 MiB [emitted] (name: main)

[1]   asset main.8b072c01824ee5330600.hot-update.js 855 bytes [emitted] [immutable] [hmr] (name: main)

[1] asset index.html 263 bytes [emitted]

[1] asset main.8b072c01824ee5330600.hot-update.json 28 bytes [emitted] [immutable] [hmr]

[1] Entrypoint main 2.37 MiB = bundle.js 2.37 MiB main.8b072c01824ee5330600.hot-update.js 855 bytes

[1] cached modules 2.04 MiB [cached] 56 modules

[1] runtime modules 26.4 KiB 13 modules

[1] ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/postcss-loader/dist/cjs.js!./client/app.css 68.4 KiB [built]

[1] webpack 5.75.0 compiled successfully in 228 ms

> dockervision@0.0.1 dev:docker

> concurrently "npm run build:tailwindcss" "NODE_ENV=development webpack-dev-server --port 8855 "

[0] 

[0] > dockervision@0.0.1 build:tailwindcss

[0] > npx tailwindcss -i ./client/app.css -o ./dist/output.css

[0] 

[1] Failed to load ../../.env.

[1] <i> [webpack-dev-server] Project is running at:

[1] <i> [webpack-dev-server] Loopback: http://localhost:8855/

[1] <i> [webpack-dev-server] Content not from webpack is served from '/code/dist' directory

[0] 

[0] Rebuilding...

[0] 

[0] 🌼 daisyUI components 2.46.0  https://daisyui.com

[0]   ✔︎ Including:  base, components, 29 themes, utilities

[0]   ❤︎ Support daisyUI:  https://opencollective.com/daisyui 

[0]   

[0] 

[0] Done in 897ms.

[0] npm run build:tailwindcss exited with code 0

[1] 

[1] 🌼 daisyUI components 2.46.0  https://daisyui.com

[1]   ✔︎ Including:  base, components, 29 themes, utilities

[1]   ❤︎ Support daisyUI:  https://opencollective.com/daisyui 

[1]   

[1] asset bundle.js 2.37 MiB [emitted] (name: main)

[1] asset index.html 263 bytes [emitted]

[1] runtime modules 26.4 KiB 13 modules

[1] modules by path ./node_modules/ 2.02 MiB 49 modules

[1] modules by path ./client/ 92.3 KiB

[1]   modules by path ./client/containers/*.jsx 15.6 KiB

[1]     ./client/containers/App.jsx 4.95 KiB [built] [code generated]

[1]     ./client/containers/Sidebar.jsx 6.32 KiB [built] [code generated]

[1]     ./client/containers/GraphDisplay.jsx 4.36 KiB [built] [code generated]

[1]   modules by path ./client/*.css 70.9 KiB

[1]     ./client/app.css 2.45 KiB [built] [code generated]

[1]     ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/postcss-loader/dist/cjs.js!./client/app.css 68.4 KiB [built] [code generated]

[1]   modules by path ./client/components/*.jsx 5.38 KiB

[1]     ./client/components/ContainerButton.jsx 4.25 KiB [built] [code generated]

[1]     ./client/components/LineChart.jsx 1.14 KiB [built] [code generated]

[1]   ./client/index.jsx 473 bytes [built] [code generated]

[1] webpack 5.75.0 compiled successfully in 4959 ms

[1] assets by path *.js 2.37 MiB

[1]   asset bundle.js 2.37 MiB [emitted] (name: main)

[1]   asset main.8b072c01824ee5330600.hot-update.js 855 bytes [emitted] [immutable] [hmr] (name: main)

[1] asset index.html 263 bytes [emitted]

[1] asset main.8b072c01824ee5330600.hot-update.json 28 bytes [emitted] [immutable] [hmr]

[1] Entrypoint main 2.37 MiB = bundle.js 2.37 MiB main.8b072c01824ee5330600.hot-update.js 855 bytes

[1] cached modules 2.04 MiB [cached] 56 modules

[1] runtime modules 26.4 KiB 13 modules

[1] ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/postcss-loader/dist/cjs.js!./client/app.css 68.4 KiB [built]

[1] webpack 5.75.0 compiled successfully in 228 ms

And again, thanks for the support and sorry if I'm bothering the team too much.

rob-mosher commented 1 year ago

Thank you so much for your coordination on this @lnxredir, and we appreciate your patience. I've created a temporary branch for troubleshooting the most recent issue you reported. I believe that setting --allowed-hosts all in the package.json file may resolve the issue. Please purge docker-watch from your system and run the below, which includes these temporary changes:

git clone --single-branch --branch bugfix/issue-41 https://github.com/oslabs-beta/docker-watch-app.git
cd docker-watch-app
docker compose -p dockerwatch -f install.yaml up -d
lnxredir commented 1 year ago

Hey, thanks for the response! The webpage opens correctly now, however the sensor container is displaying an error still (different error than last time at least) and the web page shows no graphs.

TypeError: Cannot read properties of undefined (reading 'value')

    at IncomingMessage.<anonymous> (/code/index.js:65:80)

    at IncomingMessage.emit (node:events:525:35)

    at endReadableNT (node:internal/streams/readable:1359:12)

    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

It repeats this message over and over, here's a screenshot of the webpage.