signalk-server icon indicating copy to clipboard operation
signalk-server copied to clipboard

[DOCKER][BUG] SeaTalk GPIO integration not working

Open xGuIInE opened this issue 11 months ago • 4 comments

Hello, I was integrating a SeaTalk module to my docker signalk server, and I faced with this issue. The python script is executed using the python -u -c '${cmd}' ${options.gpio} ${options.gpioInvert}, but python is only aliased by python3, so it can't be loaded.

https://github.com/SignalK/signalk-server/blob/master/packages/streams/pigpio-seatalk.js

I fixed this using a custom Docker image:

FROM cr.signalk.io/signalk/signalk-server

USER root

RUN apt-get update
RUN apt-get install -y python3-pigpio
RUN apt-get install -y python-is-python3

USER node

python-is-python3 package does the trick.

xGuIInE avatar Mar 22 '24 15:03 xGuIInE

Isn't this easiest to fix in pigpio-seatalk.js itself? To add test which python is installed and then use it.

KEGustafsson avatar Mar 23 '24 13:03 KEGustafsson

Yes... this was a workaround/temporal solution. I'm going to check if other modules use python call too and prepare a PR.

xGuIInE avatar Mar 23 '24 15:03 xGuIInE

@KEGustafsson after checking it further, pigpio package isn't installed in the docker image... throwing ModuleNotFoundError: No module named 'pigpio' Docker base image should be updated, maybe keeping python-is-python3 package is safer allowing to use both commands python | python3

xGuIInE avatar Mar 24 '24 15:03 xGuIInE

You could add check which version of python is installed and if required packages are installed too and if not then install ones with pip. Once checked which python in use, then modify excutive part accordingly. To my understanding all changes can be done application level, no need to touch image.

KEGustafsson avatar Mar 27 '24 02:03 KEGustafsson