normalperson at yhbt.net
Wed Aug 18 03:14:10 EDT 2010
Jimmy Soho <jimmy.soho at gmail.com> wrote:
> If I now peek in /proc/31761/environ then I notice these:
> PATH=/srv/app/releases/20100818022900/vendor/bundler_gems/bin:[... etc.]
> which are all pointing to the working directory I pruned. Hence the
> message about Gemfile not found I guess.
> Any suggestions how / when to update those environment variables with
> correct values?
Aha! I believe there's an option for Bundler to use the /srv/app/shared
directory with Capistrano. That's probably your best option.
> > Other folks here may have more experience with Capistrano+Unicorn,
> > maybe they have portable recipes they can share.
> Maybe it's more a gem and/or bundler thing? Though it seems like a
> general issue to me that environment variables can have references to
> old working directories, which need to be updated if you restart
> Unicorn with USR2 all the time. Is this something Unicorn could
> possibly take care off?
You can also try force the environment variables with the
before_exec hook in your config file:
before_exec do |server|
ENV['GEM_HOME'] = '/srv/app/current/vendor/bundler_gems'
But I think the best option is to use a shared directory for Bundler
since it should speed up deploys, too. On the other hand, maybe Bundler
should be taught to respect symlink directories...
More information about the mongrel-unicorn