capistrano-nginx-unicorn icon indicating copy to clipboard operation
capistrano-nginx-unicorn copied to clipboard

cap unicorn:restart (missing argument: -E)

Open matthieupinte opened this issue 10 years ago • 3 comments

Hi, I experiment your gem since few hours, so I'm not sure is missed something or it's an issue for you. When I run cap unicorn:restart it's returning this:

INFO[b9e6e3c4] Running /usr/bin/env sudo service unicorn_appname_staging restart on 162.243.251.XXX
DEBUG[b9e6e3c4] Command: /usr/bin/env sudo service unicorn_appname_staging restart
DEBUG[b9e6e3c4]     Couldn't reload, starting 'cd /var/www/appname/current; bundle exec unicorn -D -c /var/www/appname/shared/config/unicorn.rb -E ' instead
DEBUG[b9e6e3c4]     /var/www/appname/shared/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:110:in `block in <top (required)>'
DEBUG[b9e6e3c4]     : 
DEBUG[b9e6e3c4]     missing argument: -E
DEBUG[b9e6e3c4]      (
DEBUG[b9e6e3c4]     OptionParser::MissingArgument
DEBUG[b9e6e3c4]     )
DEBUG[b9e6e3c4]         from /var/www/appname/shared/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:10:in `new'
DEBUG[b9e6e3c4]         from /var/www/appname/shared/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:10:in `<top (required)>'
DEBUG[b9e6e3c4]         from /var/www/appname/shared/bundle/ruby/2.1.0/bin/unicorn:23:in `load'
DEBUG[b9e6e3c4]         from /var/www/appname/shared/bundle/ruby/2.1.0/bin/unicorn:23:in `<main>'
cap aborted!

If you can help me to know what I missed? Thanks.

matthieupinte avatar Jun 10 '14 16:06 matthieupinte

I think you should set rails_env variable in one of your project_root/config/deploy/[env].rb, here is a simple example for this:

set :rails_env, "staging"

simoniong avatar Jun 13 '14 18:06 simoniong

@simoniong but it should not be necessary, since capistrano_rails sets the :rails_env for you automagically.
I ran into the same error and don't think, that setting this var in each environment's deploy settings is the correct way.

rockaBe avatar Jun 16 '14 10:06 rockaBe

@simoniong if you set explicitly the rails environment in your deploy configuration files: set :rails_env, "staging" working.

But why when you do cap staging unicorn:setup_initializer your rails environment is not "used"?

matthieupinte avatar Jun 16 '14 12:06 matthieupinte