Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running pi_piper in Rails #40

Closed
canedy opened this issue May 7, 2015 · 3 comments
Closed

Running pi_piper in Rails #40

canedy opened this issue May 7, 2015 · 3 comments

Comments

@canedy
Copy link

canedy commented May 7, 2015

Looking for some advise or if anyone has been able to get a basic blinking light scenario website up and running using pi_piper. I'm starting as simple and basic as I can. Created a rails app and in my controller added same ruby code (that works when ran as ruby). Was expecting page I navigated to see lights blink, nothing fancy yet just wanted the code to execute. But i received a Permission denied error.

Error Message: Permission denied @ rb_sysopen - /sys/class/gpio/gpio23/direction

Anyone out there have experience with getting pi_piper to work with rails?

@elmatou
Copy link
Contributor

elmatou commented May 8, 2015

Hi,
PiPiper needs root permission to work, it access to /dev/mem (via a kernel module or directly wih the C library) which need root permission.

As it is not advised to run a webserver as root, I will recommend you to escalate permissions only for a PiPiper dedicated process, there is an issue about it, but nothing as been properly written as of now.

If you make any progress on this front keep us up to date.

@bguest
Copy link
Contributor

bguest commented May 8, 2015

I'm not going to say it's the best idea performance becomes an issue when running the full rails stack but ... This is a site I wrote to do LED stuff: https://github.com/bguest/blinky... If you look at the pusher_example branch its pretty basic. Also, yeah, you need to deploy to root.
Also, here's a write up on how to set up the pi: http://www.blogithub.com/bguest/pi_on_rails ...

@canedy
Copy link
Author

canedy commented Jun 23, 2015

So after much trial and error I end up installing everything as root. I could not get rails to write to GPIO pins with out installing ruby, rails, pi piper all as root. It works, but there has to be a better way other than installing as root.

@canedy canedy closed this as completed Jun 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants