Giter Site home page Giter Site logo

Comments (9)

imrehg avatar imrehg commented on May 27, 2024

Hey @owarek, are you deploying this project as it is, or are you combining it with other containers in a multicontainer setup?

from balena-node-red.

owarek avatar owarek commented on May 27, 2024

I have it as multicontainer setup. This is my compose file:

version: '2'
volumes:
node-red-data:
services:
wpe:
restart: always
build: ./wpe
privileged: true
scheduler:
restart: always
build: ./scheduler
privileged: true
mqtt:
image: panuwitp/mosquitto-arm
ports:
- "1883:1883"
node-red:
build: ./node-red
privileged: true
volumes:
- 'node-red-data:/data'
ports:
- "1880:1880"
depends_on:
- mqtt
restart: always

from balena-node-red.

imrehg avatar imrehg commented on May 27, 2024

Hi, probably you need to paste that in not a ">" style of "quoting" but the code block as triple-backticks (`), see more in the help https://help.github.com/en/articles/creating-and-highlighting-code-blocks

And since you are using a completely different way of deploying the project, it's harder to answer what might be the issue. If you just deploy this particular project as it is in the repo, do you have the same error?

My guess would have been the privileged: true setting being required (that "read-only" warning being more a permission issue, than actual read only file system issue for /sys, as much as I know). Since it seems in your code you already use that, we will need to check further what other source of that error might be.

from balena-node-red.

imrehg avatar imrehg commented on May 27, 2024

Also, how are you changing the backlight of a display, and what display are you using?
Do you have things shown on the display normally besides this issue? I'm guessing that the WPE service manages the display normally?

from balena-node-red.

imrehg avatar imrehg commented on May 27, 2024

I think you have the 7" Raspberry Pi display, right?
Just tried that with this particular project, and use echo to write to that setting. The command returns an error, but the value is being set correctly. Here's the log from the node-red service's container (deployed as this project)

bash-4.4# echo 1 > /sys/class/backlight/rpi_backlight/bl_power
bash: echo: write error: Invalid argument
bash-4.4# cat /sys/class/backlight/rpi_backlight/bl_power
1
bash-4.4# echo 0 > /sys/class/backlight/rpi_backlight/bl_power
bash: echo: write error: Invalid argument
bash-4.4# cat /sys/class/backlight/rpi_backlight/bl_power
0

and looking at the screen, indeed it turns it off when 1 is sent, and turn it on when 0 is sent.

Thus it should work from the container, just have to find what setting is required. This does not seem to be the issue of this node-red project, however, regardless of the outcome.

from balena-node-red.

owarek avatar owarek commented on May 27, 2024

Thank you for investigating this. Here is the compose file again:

volumes:
    node-red-data:
services:
  wpe:
    restart: always
    build: ./wpe
    privileged: true
  scheduler:
    restart: always
    build: ./scheduler
    privileged: true
  mqtt:
    image: panuwitp/mosquitto-arm
    ports:
      - "1883:1883"
  node-red:
    build: ./node-red
    privileged: true  
    volumes:
       - 'node-red-data:/data'
    ports:
       - "1880:1880"
    depends_on:
        - mqtt
    restart: always

and here is the dockerfile for node-red:


COPY ./settings.js /data/settings.js

USER root
RUN apt-get update && apt-get install nano
USER node-red

RUN npm install node-red-contrib-resinio
RUN npm install node-red-dashboard
RUN npm install node-red-contrib-credentials
RUN npm install node-red-admin
RUN npm install --save rpi-backlight

And yes I have the 7" RPi touch display. This is the output from terminal of node-red container:

node-red@cc2011243739:~$ echo 1 > /sys/class/backlight/rpi_backlight/bl_power
bash: /sys/class/backlight/rpi_backlight/bl_power: Permission denied
node-red@cc2011243739:~$ cat /sys/class/backlight/rpi_backlight/bl_power
0

In wpe and scheduler it works. In mqtt and node-red it does not.

from balena-node-red.

imrehg avatar imrehg commented on May 27, 2024

@owarek I think the issue is that you are setting the user in node-red:

USER node-red

thus that user doesn't have the privileges to modify the file. So I think you will have to set up that user to have the right permissions, or keep using the root user?

from balena-node-red.

owarek avatar owarek commented on May 27, 2024

Yes, that may be the reason but I do not know how to add permisions to write to that file to nodered user. I have tried to add sudo chmod 777 after ther USER root in dockerfile and also tried to chown node-red in host OS both with no success. Only thing that worked is chmod 777 in host OS. Do you have any idea how to set this differently or more safe?

from balena-node-red.

imrehg avatar imrehg commented on May 27, 2024

You are already running a privileged container, not sure what's the reason you are trying to switch the user. As you see in this project as well, that the user is not switched. I think the main way to solve this to use a root user as you already do in the other two containers anyways.

from balena-node-red.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.