Unicorn doesn't play nice with Capistrano deployment?

Eric Wong normalperson at yhbt.net
Wed May 9 20:07:30 UTC 2012

Luis Fernando Urrea <lfurrea at simplecs.net> wrote:
> I am having issues when using unicorn with a Capistrano deployment.
> >From what I have been able to understand Capistrano uses a scheme in
> wich every release is deployed inside the releases directory under a
> unique name and if the transaction was successful, creates a symlink
> named current that will point to that release.


> So I end up with a deployment directory such as:
> /home/deployer/apps/sample_app/current
> Then when I try to start unicorn from the binstubs directory all the
> unicorn methods look for things in the following path, particularly in
> the configurator.rb module:
> /home/deployer/apps/sample_app
> I haven't been able to fully understand how unicorn sets the
> working_directory from here:
> https://github.com/defunkt/unicorn/raw/master/lib/unicorn/configurator.rb

Just put the following line at the top of your config file:

  working_directory "/home/deployer/apps/sample_app/current"

When I used Capistrano, I would start unicorn inside the "current"
directory to avoid that config line:

  cd /home/deployer/apps/sample_app/current
  unicorn -c $PWD/config/unicorn.conf.rb

That said, I don't deploy with Capistrano anymore.  I package apps into
gem/rpm/deb/any-other-packaging-system for multi-machine deployments,
and use a git checkout for single-instance deployments.

More information about the mongrel-unicorn mailing list