Booting rbenv managed rails app with Systemd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Booting rbenv managed rails app with Systemd

Chris Vukin
Have been working on creating some systemd services to launch some features on a raspberrypi that is used for running a rails app. No issues with a service for launching a python script nor one for putting the pi in kiosk mode, when it comes to launching the systemd service for rails it is failing. 

Here is my service file:

[Unit] Description=evr server boot After=network.target After=local-fs.target [Service] Type=forking User=pi Group=pi WorkingDirectory=/home/pi/evr ExecStart=/home/pi/.rbenv/bin/rbenv bundle exec rails s -b 192.168.1.66 TimeoutSec=180 RestartSec=180s Restart=always [Install] WantedBy=multi-user.target


when running it produces this error:

$ systemctl status evrserver ● evrserver.service - evr server boot Loaded: loaded (/etc/systemd/system/evrserver.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Wed 2019-04-03 18:34:22 BST; 2min 51s ago Process: 425 ExecStart=/home/pi/.rbenv/bin/rbenv bundle exec rails s -b 192.168.1.66 (code=exited, status=1/FAILURE) CGroup: /system.slice/evrserver.service Apr 03 18:34:22 raspberrypi systemd[1]: Failed to start evr server boot. Apr 03 18:34:22 raspberrypi systemd[1]: evrserver.service: Unit entered failed state. Apr 03 18:34:22 raspberrypi systemd[1]: evrserver.service: Failed with result 'exit-code'.

any thoughts here? thinking the rbenv PATH is causing the issue, not sure how its needing to be structured to access that correct PATH to execute the 'rails' command.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ac3fc94d-5ac1-4091-a1e8-650949033f43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Booting rbenv managed rails app with Systemd

Chris Vukin
snap, missed the other exec before bundle in the ExecStart line, and needed to switch the type to =simple.
 
On Wednesday, April 3, 2019 at 2:23:55 PM UTC-7, [hidden email] wrote:
Have been working on creating some systemd services to launch some features on a raspberrypi that is used for running a rails app. No issues with a service for launching a python script nor one for putting the pi in kiosk mode, when it comes to launching the systemd service for rails it is failing. 

Here is my service file:

[Unit] Description=evr server boot After=network.target After=local-fs.target [Service] Type=forking User=pi Group=pi WorkingDirectory=/home/pi/evr ExecStart=/home/pi/.rbenv/bin/rbenv bundle exec rails s -b 192.168.1.66 TimeoutSec=180 RestartSec=180s Restart=always [Install] WantedBy=multi-user.target


when running it produces this error:

$ systemctl status evrserver ● evrserver.service - evr server boot Loaded: loaded (/etc/systemd/system/evrserver.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Wed 2019-04-03 18:34:22 BST; 2min 51s ago Process: 425 ExecStart=/home/pi/.rbenv/bin/rbenv bundle exec rails s -b 192.168.1.66 (code=exited, status=1/FAILURE) CGroup: /system.slice/evrserver.service Apr 03 18:34:22 raspberrypi systemd[1]: Failed to start evr server boot. Apr 03 18:34:22 raspberrypi systemd[1]: evrserver.service: Unit entered failed state. Apr 03 18:34:22 raspberrypi systemd[1]: evrserver.service: Failed with result 'exit-code'.

any thoughts here? thinking the rbenv PATH is causing the issue, not sure how its needing to be structured to access that correct PATH to execute the 'rails' command.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/21c8557d-1f1e-4410-a291-c82727efb838%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Booting rbenv managed rails app with Systemd

botp


On Thu, Apr 4, 2019 at 11:30 AM <[hidden email]> wrote:
ExecStart=/home/pi/.rbenv/bin/rbenv bundle exec rails s -b 192.168.1.66
 
i havent used rbenv like that, but, have you tested that statement alone on a command line?
have you tried running without rbenv in that line?

any thoughts here? thinking the rbenv PATH is causing the issue, not sure how its needing to be structured to access that correct PATH to execute the 'rails' command.

you already have a working directory; and assumming that directory is a rails app dir, you can run bundle and rails among others in there.

--
many thanks and many regards,
--botp

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAAwHHQhYukfXmyjLJ6a5en%2BMyzix5y_mS2mFoHPXYVqrZTyxDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.