I'm following this tutorial to set up a Rails server, but when I try to start the unicorn application server I encounter this error:
$ sudo service unicorn_appname start
Job for unicorn_appname.service failed because the control process exited with error code. See "systemctl status unicorn_appname.service" and "journalctl -xe" for details.
More details:
$ systemctl status unicorn_appname.service
● unicorn_appname.service - LSB: starts the unicorn app server
Loaded: loaded (/etc/init.d/unicorn_appname; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2016-11-23 20:22:36 UTC; 1min 33s ago
Docs: man:systemd-sysv-generator(8)
Process: 39284 ExecStart=/etc/init.d/unicorn_appname start (code=exited, status=1/FAILURE)
Nov 23 20:22:36 azure systemd[1]: Starting LSB: starts the unicorn app server...
Nov 23 20:22:36 azure unicorn_appname[39284]: /etc/init.d/unicorn_appname: 30: cd: can't cd to /home/deploy/appname
Nov 23 20:22:36 azure systemd[1]: unicorn_appname.service: Control process exited, code=exited status=1
Nov 23 20:22:36 azure systemd[1]: Failed to start LSB: starts the unicorn app server.
Nov 23 20:22:36 azure systemd[1]: unicorn_appname.service: Unit entered failed state.
Nov 23 20:22:36 azure systemd[1]: unicorn_appname.service: Failed with result 'exit-code'.
I tried typing these error messages on google but none gave any helpful results, and I'm kind of stuck now because I'm a total beginner with Rails and setting up web servers in general. Any tips?
As it was pointed out in the comments the problem was in this line:
/etc/init.d/unicorn_appname: 30: cd: can't cd to /home/deploy/appname
In the tutorial there is a file called /etc/init.d/unicorn_appname
and I forgot to replace the user of the author (deploy
) by mine. Later I encountered another problem. Same immediate output, different answer by systemctl
but it all came down to this line:
bundler: command not found: unicorn
I solved it by installing the dependencies of my project globally:
sudo bundle install
I don't know if this is the best option and I still don't know if the overall system will work as a whole because I haven't configued nginx
yet but I had no error messages from the command sudo service unicorn_appname start
. Other answers are welcomed.