Running unicorn as a service on centos to work with capistrano

610 views Asked by At

I am trying to use capistrano 3 for my deployment, using nginx-unicorn on centos 6.5. I was able to run cap production deploy, and then ssh into the server and restart it manually.

I tried to include the gem - https://github.com/kalys/capistrano-nginx-unicorn - to automate restarting of unicorn and nginx, but it fails when attempting to restart unicorn as a service, running this command

/usr/bin/env sudo service unicorn_app_name_production stop
*service does not exist*

I checked the services when unicorn is running manually and it is not in there, I generally start it with this command

unicorn_rails -c config/unicorn.rb -E production -D

I setup the server using this tutorial - https://www.digitalocean.com/community/tutorials/how-to-deploy-rails-apps-using-unicorn-and-nginx-on-centos-6-5

Any help?

1

There are 1 answers

0
AudioBubble On

You can check this issue on a similar gem (capistrano-unicorn-nginx is basically an improved fork of kalys/capistrano-nginx-unicorn). Disclaimer: I currently maintain that gem.

The core issue is that both gems are tested to work on Ubuntu (not on CentOS) so they are using Ubuntu specifics (directories etc).

I'd suggest forking the gem you're currently using and manually tweaking the tasks for your needs. For example, you'll probably need to change this so the task uses commands that work on centos.

If you manage to make this work, I'd appreciate you leave the feedback in this issue as it will help me work on a solution for both Ubuntu, CentOS and other distros eventually.