tagyoureit / nodejs-poolController

An application to control pool equipment from various manufacturers.
GNU Affero General Public License v3.0
315 stars 94 forks source link

Docker not working #356

Closed fgonza2 closed 2 years ago

fgonza2 commented 2 years ago

Describe the bug Ueed docker compose in Ubuntu

To Reproduce Steps to reproduce the behavior: implemented the docker-compose examples in the wiki

This is what i get: Init state for Pool Controller /bin/sh: git: not found /bin/sh: git: not found Pentair EasyTouch System Detected! RS485 Stats:{ "bytesReceived": 527 "success": 11, "failed": 1, "bytesSent": 60, "collisions": 0, "failureRate": 8.33% }

tagyoureit commented 2 years ago

I'm really not a Docker expert. Have you gone over the docker wiki closely?

These were contributed by @emes & @wurmr. Tagging them in case they can help.

rstrouse commented 2 years ago

I did find this. It describes a scenario where git is not installed in the container. https://forums.docker.com/t/bin-sh-git-not-found/105865

EDIT: If git isn't in the container it will throw this message while trying to get the latest version information from github.

wurmr commented 2 years ago

Does the project now self update itself from github?

rstrouse commented 2 years ago

No but it shows the current version and indicates whether there is an update available.

wurmr commented 2 years ago

Is it using git to figure out the latest version? Or are we tracking down something different?

rstrouse commented 2 years ago

It is using it to get the latest version.

wurmr commented 2 years ago

How does it do that? Is it looking at contents of a specific file or is it peeking at git tags?

Typically you wouldn't want full blown git client in a docker image as it is a dev tool.

Solutions that come to mind are:

  1. Use a different mechnaism to determine latest version (wget is likely in the image).
  2. Add git to the container image. This isn't something I'd do in a comercial production project but since this is a hobby project maybe that's ok.
wurmr commented 2 years ago

Digging further git is already in the running production image. https://github.com/tagyoureit/nodejs-poolController/blob/a2903da6c15f08d44883aa50ce325a005358ab21/Dockerfile#L11

Trying it quickly it looks like it works as intended: image

@fgonza2 can you provide specific steps to reproduce?

wurmr commented 2 years ago

Oh I see it, the msmi/nodejs-poolcontroller image does not have git on it. However it still runs as the git command fails with a warning. The project still starts up and runs.

It appears that msmi/nodejs-poolcontroller isn't built with the Dockerfile that is in this project, I don't know who owns or maintains that repo. @rstrouse do you know who owns it and/or how the build gets triggered?

@fgonza2 you might have another error further down that is causing a crash.

rstrouse commented 2 years ago

I do not know who owns it but @tagyoureit probably does. He knows everything.

tagyoureit commented 2 years ago

I don't know...

tagyoureit commented 2 years ago

BTW, the code to check the git release is in a try/catch block and other than the messages /bin/sh: git: not found /bin/sh: git: not found can be safely ignored. It's only used to display the Git checksum in njsPC if it is in a Git directory that was cloned from the repo. I'll see if I can redirect the output solely to node so it doesn't hit the console.

Like @wurmr said, this is ISN'T the bug causing a crash.

fgonza2 commented 2 years ago

Repro steps are simple, run the docker-compose.yaml that is in the wiki. Here is mine:

version: 3.7 services: poolcontroller: image: msmi/nodejs-poolcontroller container_name: poolcontroller restart: always user: node:dialout ports:

  • "4200:4200" volumes:
  • /home/myuser/containers/pool/config.json:/app/config.json
  • /home/myuser/containers/pool/data:/app/data

So if the git error is not the issue then what else could it be?

wurmr commented 2 years ago

@fgonza2 can you include the full output of your docker compose up command?

Alternatively you can run that container directly just to see what the output looks like: docker run -it --rm msmi/nodejs-poolcontroller

Another thing I can think of is make sure you perodically run docker pull msmi/nodejs-poolcontroller to get the latest version of the image, the compose file you are using does not include a version.

snagytx commented 2 years ago

I would recommend to run in the same folder where you have docker-compose.yaml the following commands periodically:

docker-compose pull docker-compose up -d

These commands will pull the latest version of the images you declared in the yaml file, then it will drop the containers, if they already exist, and create new containers using the latest images.

putnam commented 2 years ago

Piggybacking here, but the sample Dockerfile is currently broken due to referring to the deprecated python package. That should be replaced with python3.

rstrouse commented 2 years ago

Piggybacking here, but the sample Dockerfile is currently broken due to referring to the deprecated python package. That should be replaced with python3.

This change was added to the repo for njsPC and dashPanel