capistrano3-unicorn icon indicating copy to clipboard operation
capistrano3-unicorn copied to clipboard

Depend on `deploy:set_rails_env` for `unicorn:start` (or `load:defaults`)

Open eLod opened this issue 11 years ago • 7 comments

I'm not sure if I missed something but if I run bundle exec cap production unicorn:start it fails because rails_env is not set. With bundle exec cap production deploy:set_rails_env unicorn:start it works as expected.

eLod avatar Mar 08 '14 20:03 eLod

+1 when i only unicorn stop and start. RAILS_ENV is not set and can't start unicorn.

@eLod solution is works.

seapy avatar Mar 10 '14 02:03 seapy

+1

I didn’t notice before as I always set it manually.

set :rails_env, "production"

DavidBennettPIO avatar Mar 20 '14 01:03 DavidBennettPIO

Same problem here, I tried @eLod's solution and it worked.

jmcomets avatar Jun 06 '14 16:06 jmcomets

This won't be needed after capistrano-rails 1.1.2 is released as it adds these lines to it's task definitions:

Capistrano::DSL.stages.each do |stage|
  after stage, "deploy:set_rails_env"
end

This causes Rails env variables to be added at the beginning of each stage.

amw avatar Sep 08 '14 13:09 amw

Hi,

For me, whatever I do, it ends up with -E deployment :-/

aurels avatar Sep 15 '14 14:09 aurels

That's correct. -E is for setting RACK_ENV. Most setups use something like RAILS_ENV=production unicorn -E deployment.

amw avatar Sep 15 '14 14:09 amw

That's strange, setting :unicorn_rack_env does the trick for me.

aurels avatar Sep 15 '14 15:09 aurels