Closed nicksardo closed 3 weeks ago
njsPC v8 and the SerialPort module require node v16 or greater (16 or 18 recommended). You will need to rebuild the dependencies (npm i
).
Others have v8.0.x running - https://github.com/tagyoureit/nodejs-poolController/issues/786.
Why isn't the docker image shipped with the correct node version? Nobody should have to go into a container to update dependencies.
@emes Owns the docker image and build.
Hey. Sorry for the delay @nicksardo
As I've said before. I'd be super happy not to own this. It really should be done via GitHub Actions or similar by the maintainers or if someone else wants to volunteer.
Yes, something definitely changed in the source after 7.6.1. I looked through the commits and I cannot determine what change hurt docker. If I recall, I had to make some changes to my dockerfile to get around it.
Having said that, it is working for me. I am running on x86_64.
/app $ node -v v18.18.1
Here's the Dockerfile I am using:
FROM node:lts-alpine AS build
RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata
WORKDIR /app
COPY package*.json ./
COPY defaultConfig.json config.json
RUN npm ci
COPY . .
RUN npm run build
RUN npm ci --omit=dev
FROM node:lts-alpine as prod
ARG SOURCE_BRANCH
ARG SOURCE_COMMIT
ENV SOURCE_BRANCH=$SOURCE_BRANCH
ENV SOURCE_COMMIT=$SOURCE_COMMIT
RUN mkdir /app && chown node:node /app
WORKDIR /app
COPY --chown=node:node --from=build /app .
USER node
ENV NODE_ENV=production
ENTRYPOINT ["node", "dist/app.js"]
this runs using docker buildx over a buildx cluster so I can build natively for multiple architectures.
So I'm not sure how you'd be getting a node version other than v18.18.1 from the current image as npm ci
installs whatever package.json asks.
Also probably best to pull latest rather than 8.0.3 as updates come after each tagged version and occasionally package.json version gets updated and git tags don't get pushed at the same time.
if after pulling msmi/nodejs-poolcontroller (without the version tag) and if it's not working let me know.
also, you can try with socat...
pool-controller:
...
environment:
- POOL_NET_CONNECT=true
- POOL_NET_HOST=socat
socat:
command: tcp-listen:9801,fork,reuseaddr file:/dev/ttyUSB0,b9600,raw,echo=0
container_name: socat
restart: always
ports:
- "9801:9801"
devices:
- /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0OHEL7-if00-port0:/dev/ttyUSB0
image: alpine/socat
I tried building a new image with the latest node, didn't help. I also tried using switching the base image to debian instead of alpine. I just ran into other problems that I ran out of interest in solving.
Thanks for posting that socat bypass, but the pool controller container still fails with the same log message. I'm just going to stick with 7.6.1. Dependency jankiness like this is why I've spent the last ten years coding in Go.
Yup. I get it. But just so I know, did you pull/use msmi/nodejs-poolcontroller:latest for those last tests?
Yep, I pulled the latest that you pushed. Thanks for trying.
Not that this helps at all, but I'm in the same boat.
No docker image version past the 7.6.1 one will run/stay running for me either.
Can you post whatever error you're seeing and uname -a
It doesn't stay running long enough to shell in and get a uname -a.... Unless I'm missing a clever way of doing it that I'm not thinking of?
Docker log for the container:
Init state for Pool Controller
[10/27/2023, 2:41:12 PM] info: The current git branch output is master
[10/27/2023, 2:41:12 PM] info: The current git commit output is 0bc57fc
[10/27/2023, 2:41:12 PM] info: Starting up SSDP server
[10/27/2023, 2:41:12 PM] info: Init mqtt interface: MQTT
[10/27/2023, 2:41:12 PM] info: Initializing MQTT client MQTT
Init state for Pool Controller
[10/27/2023, 2:41:17 PM] info: The current git branch output is master
[10/27/2023, 2:41:17 PM] info: The current git commit output is 0bc57fc
[10/27/2023, 2:41:17 PM] info: Starting up SSDP server
[10/27/2023, 2:41:17 PM] info: Init mqtt interface: MQTT
[10/27/2023, 2:41:17 PM] info: Initializing MQTT client MQTT
Init state for Pool Controller
[10/27/2023, 2:41:22 PM] info: The current git branch output is master
[10/27/2023, 2:41:22 PM] info: The current git commit output is 0bc57fc
[10/27/2023, 2:41:22 PM] info: Starting up SSDP server
[10/27/2023, 2:41:22 PM] info: Init mqtt interface: MQTT
[10/27/2023, 2:41:22 PM] info: Initializing MQTT client MQTT
My compose file (running on an rpi4 - Linux pool 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux):
services:
poolcontroller:
container_name: poolcontroller
restart: always
environment:
- TZ=America/Chicago
group_add:
- dialout
devices:
- /dev/ttyUSB0
ports:
- "4200:4200"
volumes:
- /home/jason/poolcontroller/config.json:/app/config.json
- /home/jason/poolcontroller/data:/app/data
# image: msmi/nodejs-poolcontroller:7.6.1
image: msmi/nodejs-poolcontroller:latest
poolcontroller-dashpanel:
restart: always
container_name: poolcontroller-dashpanel
environment:
- TZ=America/Chicago
ports:
- "5150:5150"
volumes:
- /home/jason/poolcontroller-dashpanel/config.json:/app/config.json
image: msmi/nodejs-poolcontroller-dashpanel
depends_on:
- poolcontroller
+1 I migrated my install to docker, with a brand new install and ran in to this issue starting, it gets in a restart loop, same logs as Botched1 Node.js v18.15.0
Please pull the latest and let me know how it goes:
docker pull msmi/nodejs-poolcontroller
Please pull the latest and let me know how it goes:
docker pull msmi/nodejs-poolcontroller
Sorry for the delay. I repulled latest today, and it seems to work fine. Unlike my other attempts on v8 this version came right up and stayed running.
Not sure what you changed, but THANKS!
That’s great to hear. I’ve switched from alpine to Debian slim base image. Alpine is smaller but there have been constant dependency issues so let’s see how Debian does.
@emes Using the latest image, I'm getting the following.
Error: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1473:18)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at bindings (/app/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/app/node_modules/@serialport/bindings/lib/linux.js:2:36)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/app/node_modules/@serialport/bindings/lib/index.js:14:22)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
Thanks @nicksardo I will continue to investigate. Obviously pointing to serialport. If you have time/interest, I'd be curious if using socat (not as a fix but to test if there are other issues) works. Anyway config template is above if you want to give it a try.
Would you tell me/remind me what you're running this on? Output of hostnamectl
or uname -a
would be great.
Also output of docker image ls msmi/nodejs-poolcontroller
I'll try using socat again.
$ hostnamectl
Static hostname: -------
Icon name: computer-desktop
Chassis: desktop
Machine ID: -------
Boot ID: -------
Operating System: Ubuntu 22.04.3 LTS
Kernel: Linux 5.19.11-051911-generic
Architecture: x86-64
Hardware Vendor: Micro-Star International Co., Ltd.
Hardware Model: MS-7D25
$ docker image ls msmi/nodejs-poolcontroller
REPOSITORY TAG IMAGE ID CREATED SIZE
msmi/nodejs-poolcontroller latest 16ded5d0076b 2 days ago 404MB
msmi/nodejs-poolcontroller 7.6.1 43995527478e 22 months ago 190MB
@emes I tried using socat again, but the controller fails with the same No such file or directory
error as I posted above. There are zero log messages besides that error, so it fails pretty fast.
closing due to lack of activity.
nodejs-poolController Version/commit
8.0.3
nodejs-poolController-dashPanel Version/commit
No response
relayEquipmentManager Version/commit
No response
Node Version
No response
Platform
No response
RS485 Adapter
No response
Are you using Docker?
OCP
No response
Pump(s)
No response
Chlorinator(s)
No response
What steps will reproduce the bug?
My docker-compose file:
What happens?
Image 7.6.1 works perfectly fine, but using anything fails immediately with the following:
What should have happened?
Logs show the following with 7.6.1:
Additional information
No response