Systemd service fails on boot with rbenv environment error

0

Having some issues with a service that is meant to boot a rails app. The ruby install is managed via rbenv, the service file is this:

[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 the system boots it throws this error when it comes to this service:

$ 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'.

Looks like there is an issue with the PATH and it fails when trying to execute the 'rails' command. How can this be avoided so the service launches the rails app successfully?

medright

Posted 2019-04-03T19:21:09.387

Reputation: 1

Answers

0

so it was simple yeah? looks like I forgot an 'exec' before 'bundle' in the ExecStart line and also needed the type to be set to 'simple' instead of 'forking'

medright

Posted 2019-04-03T19:21:09.387

Reputation: 1