Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Some nodes are no more working on alpine #5

Closed
TristanCP opened this issue Jul 12, 2017 · 16 comments
Closed

Some nodes are no more working on alpine #5

TristanCP opened this issue Jul 12, 2017 · 16 comments
Assignees
Labels

Comments

@TristanCP
Copy link
Contributor

Hi,

I've finally took time to test this new slim node-red Dockerfile, but I've met some problems :

12.07.17 18:20:34 (+0200) 12 Jul 16:20:34 - [rpi-srf] Info : Can't find Pi RPi.GPIO python library.
12.07.17 18:20:34 (+0200) 12 Jul 16:20:34 - [warn] ------------------------------------------------------
12.07.17 18:20:34 (+0200) 12 Jul 16:20:34 - [warn] [rpi-srf] Warning : Can'tfind Pi RPi.GPIO python library.

Here is my the relevant RUN where you can see I've added py-rpigpio but maybe this library is not the same as python-rpi.gpio debian package :

# Install node modules, including i2c-bus without carrying all the deps in the layers
RUN apk add --no-cache \ 
          tzdata \
          make \
	  gcc \
	  g++ \
	  python \
	  py-rpigpio \

 && JOBS=MAX npm install -g --production --silent \
                  node-red \
		  node-red-contrib-resinio \
		  node-red-node-pisrf \
				  
# Setup timezone
 && cp /usr/share/zoneinfo/Europe/Paris /etc/localtime \
 && echo "Europe/Paris" >  /etc/timezone \
 
# Remove non runtime dependencies
 && apk del \
         tzdata \
         make \
	 gcc \
	 g++ \
&& npm cache clean --force \
&& rm -rf /tmp/*

As a conclusion, maybe you should keep a second Dockerfile template for those who need packages not available on alpine.

@curcuz
Copy link
Contributor

curcuz commented Jul 12, 2017

@TristanCP this project is meant to be generic, targeting multiple device types. The "issue" you are describing is specific to the Raspberry Pi and could be "fixed" by leaving python installed and adding the py-rpigpio package

like:

# base-image for node on any machine using a template variable,
# see more about dockerfile templates here:http://docs.resin.io/pages/deployment/docker-templates
# Note the node:slim image doesn't have node-gyp
FROM resin/%%RESIN_MACHINE_NAME%%-alpine-node:6-slim

# Defines our working directory in container
RUN mkdir -p /usr/src/app/
WORKDIR /usr/src/app

# Install node modules, including i2c-bus without carrying all the deps in the layers
RUN apk add --no-cache make gcc g++ python py-rpigpio && \
  JOBS=MAX npm install -g node-red node-red-contrib-resinio node-red-node-pisrf --production --silent && \
  apk del make gcc g++ && \
  npm cache clean --force && rm -rf /tmp/*

# This will copy all files in our root to the working  directory in the container
COPY ./app ./

# Enable systemd init system in container
ENV INITSYSTEM=on

# server.js will run when container starts up on the device
CMD ["bash", "/usr/src/app/start.sh"]


@curcuz
Copy link
Contributor

curcuz commented Jul 12, 2017

note that this will result in a container around 150MB vs the 110MB of the "generic" default one

@curcuz curcuz self-assigned this Jul 12, 2017
@TristanCP
Copy link
Contributor Author

Could you just read the 6th and 7th lines of the RUN I copy pasted for you ? And now watch the edit time, I haven't changed it for 21 hours. So yeah you are telling me to do what I've already done ;)

@TristanCP
Copy link
Contributor Author

To be clear : I don't expect you to fix my specific problem, but if your generic setup doesn't allow some very common use case, I think it should be changed or propose an alternative (like the Debian setup).

@curcuz
Copy link
Contributor

curcuz commented Aug 1, 2017

@TristanCP I tested what I suggested before writing back to you. I don't give random canned answers ;)

Did you try exactly as suggested? if the problem still persists, the issue might be somewhere else in the project

@TristanCP
Copy link
Contributor Author

I doubt you tested, since you said "could be "fixed" by leaving python installed and adding the py-rpigpio package", and not will be fixed.

Moreover, you get the exact same result with your Dockerfile, which is not surprising since it's almost the same as mine :

09.08.17 15:02:56 (+0200) 9 Aug 13:02:56 - [rpi-srf] Info : Can't find Pi RPi.GPIO python library.
09.08.17 15:02:56 (+0200) 9 Aug 13:02:56 - [warn] ------------------------------------------------------
09.08.17 15:02:56 (+0200) 9 Aug 13:02:56 - [warn] [rpi-srf] Warning : Can't find Pi RPi.GPIO python library.
09.08.17 15:02:56 (+0200) 9 Aug 13:02:56 - [warn] ------------------------------------------------------

@esaheiskanen
Copy link

esaheiskanen commented Aug 15, 2017

I can confirm that this works.
my dockerfile template

# base-image for node on any machine using a template variable,
# see more about dockerfile templates here:http://docs.resin.io/pages/deployment/docker-templates
# Note the node:slim image doesn't have node-gyp
FROM resin/%%RESIN_MACHINE_NAME%%-alpine-node:6-slim

# Defines our working directory in container
RUN mkdir -p /usr/src/app/
WORKDIR /usr/src/app

# Install node modules, including i2c-bus without carrying all the deps in the layers
RUN apk add --no-cache make gcc g++ python py-rpigpio && \
  JOBS=MAX npm install -g node-red node-red-contrib-resinio --production --silent && \
  apk del make gcc g++ && \
  npm cache clean --force && rm -rf /tmp/*


# This will copy all files in our root to the working  directory in the container
COPY ./app ./

# Enable systemd init system in container
# ENV INITSYSTEM=on

# server.js will run when container starts up on the device
CMD ["bash", "/usr/src/app/start.sh"]``` 

@TristanCP
Copy link
Contributor Author

Hey, if u want to participate to this thread, you should copy paste the template proposed by curcuz, not bring your own which "works" ;)

You don't have "node-red-node-pisrf" in your own, which is the component not supported on alpine and not recognizing py-rpigpio as a valid dependency.

@curcuz
Copy link
Contributor

curcuz commented Aug 18, 2017

@TristanCP I asked you if you were testing the same example I was using while trying to reproduce the issue in an attempt to help you get sorted on this project, which I made in order to allow people to get started quickly and easily with node-red on resin. I assume you are using this, since you were the one asking for alpine in the first instance. I don't understand the sarcasm you are showcasing here, I'm here to help for what I can with the limited time I can put on this project.

Not to mention that the node-red library you are referring ( node-red-node-pisrf ) is not included in this project and wasn't advertised to be working without a little effort put in figuring out the dependencies. Effort that I'm spending in order to help you.

@TristanCP
Copy link
Contributor Author

Sorry about what you think is "sarcasm", it's just you don't understand my point on this.

Let's stay as much close to the facts as possible :
On this comment, you say I should add "py-rpigpio" to fix my issue with "node-red-node-pisrf" :
#5 (comment)

This comment was just ignoring what I just did and showed (exactly what u suggested).
Later, you tell me my example doesn't work because it's not exactly like yours and yours is tested.
I do exactly like your example and have the same error. After this you tell me it's not your fault, you don't have time, you don't understand the sarcasm, ...

Ok now let's just forget about this, maybe you are very exhausted by your other activities and you forget everything between each message : the only thing I say now is "Let people chose, your first node-red demo was useful on debian, while the alpine one is not useable for some basic use cases just don't burry the working thing deep into a git history."

@curcuz
Copy link
Contributor

curcuz commented Aug 24, 2017

@TristanCP I think my last message was clear and it wasn't neither an attempt to forget this conversation nor a rant from an "exhausted guy". Let me try to be clearer: arrogance is not the best way to ask a maintainer for help, having some days of delays between replies on an issue doesn't allow you to mock the maintainer and your issue is being worked within a limited time per week ( Friday hack project , so only 1 day a week spread across a bunch of projects I maintain)

@TristanCP
Copy link
Contributor Author

TristanCP commented Aug 25, 2017

I hope you understand now the "delay" between answers was not the cause of my disappointment, but more the fact that you did a false answer, and then insisted on the fact it was a tested answer when it was not.

One more thing : I'm not asking for help, just suggesting things to make your work "hack friday" useful to the community.

@curcuz
Copy link
Contributor

curcuz commented Aug 25, 2017

@TristanCP what I tested was the ability to run RPI.GPIO on alpine, assuming the specific library you are trying to use (and for which I don't have a specific test case) would work too. No false answers, maybe misunderstanding?

@curcuz
Copy link
Contributor

curcuz commented Aug 25, 2017

I was planning on digging the rpi-srf issue today (it's Friday :P ) - I'll keep you updated

@curcuz
Copy link
Contributor

curcuz commented Aug 25, 2017

@TristanCP a quick google search led me here

so I tuned the suggested Dockerfile accordingly and the error disappeared from my logs

# base-image for node on any machine using a template variable,
# see more about dockerfile templates here:http://docs.resin.io/pages/deployment/docker-templates
# Note the node:slim image doesn't have node-gyp
FROM resin/%%RESIN_MACHINE_NAME%%-alpine-node:6-slim

# Defines our working directory in container
RUN mkdir -p /usr/src/app/ && mkdir -p /usr/share/doc/python-rpi.gpio
WORKDIR /usr/src/app

# Install node modules, including i2c-bus without carrying all the deps in the layers
RUN apk add --no-cache make gcc g++ python py-rpigpio && \
  JOBS=MAX npm install -g node-red node-red-contrib-resinio node-red-node-pisrf --production --silent && \
  apk del make gcc g++ && \
  npm cache clean --force && rm -rf /tmp/*

# This will copy all files in our root to the working  directory in the container
COPY ./app ./

# Enable systemd init system in container
ENV INITSYSTEM=on

# server.js will run when container starts up on the device
CMD ["bash", "/usr/src/app/start.sh"]

Dashboard logs:

25.08.17 09:37:17 (+0200) 25 Aug 07:37:17 - [info]
25.08.17 09:37:17 (+0200)
25.08.17 09:37:17 (+0200) Welcome to Node-RED
25.08.17 09:37:17 (+0200) ===================
25.08.17 09:37:17 (+0200)
25.08.17 09:37:17 (+0200) 25 Aug 07:37:17 - [info] Node-RED version: v0.17.5
25.08.17 09:37:17 (+0200) 25 Aug 07:37:17 - [info] Node.js  version: v6.11.1
25.08.17 09:37:17 (+0200) 25 Aug 07:37:17 - [info] Linux 4.4.50 arm LE
25.08.17 09:37:19 (+0200) 25 Aug 07:37:19 - [info] Loading palette nodes
25.08.17 09:37:24 (+0200) 25 Aug 07:37:24 - [info] Settings file  : /usr/src/app/settings.js
25.08.17 09:37:24 (+0200) 25 Aug 07:37:24 - [info] User directory : /data/node-red/user/
25.08.17 09:37:24 (+0200) 25 Aug 07:37:24 - [info] Flows file     : /data/node-red/user/flows_98c2995.json
25.08.17 09:37:24 (+0200) 25 Aug 07:37:24 - [info] Creating new flow file
25.08.17 09:37:24 (+0200) 25 Aug 07:37:24 - [info] Server now running at http://127.0.0.1:80/
25.08.17 09:37:24 (+0200) 25 Aug 07:37:24 - [info] Starting flows
25.08.17 09:37:24 (+0200) 25 Aug 07:37:24 - [info] Started flows

I do not have the sensor the node-red-node-pisrf is meant to control so please report back if this indeed fixes the issue

@curcuz curcuz closed this as completed Aug 25, 2017
@curcuz curcuz reopened this Aug 25, 2017
@curcuz
Copy link
Contributor

curcuz commented Jan 24, 2018

issue got fixed, but left open for the user to confirm with real hardware. Since no reply has been received since 6 months ago, I consider this closed.

@curcuz curcuz closed this as completed Jan 24, 2018
thankthemaker pushed a commit to thankthemaker/carddispenser that referenced this issue Mar 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants