Using Capistrano and error occurs during execution of cap deploy

198 views Asked by At

I'm using Capistrano to help deploy a Rails project and when I run the command cap deploy I get the following error produced below. Anyone have an idea what's going wrong?

Here is the error that is being generated when it's trying to execute the command.

* executing "cd -- /var/www/crowdcode/releases/20130831210643 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
 servers: ["54.215.187.53"]
 [54.215.187.53] executing command
*** [err :: 54.215.187.53] Faraday: you may want to install system_timer for reliable timeouts
*** [err :: 54.215.187.53]
*** [err :: 54.215.187.53] rake aborted!
*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/initializers/redis.rb:1: syntax error, unexpected ':', expecting ')'
*** [err :: 54.215.187.53] $redis = Redis.new(host: 'localhost', port: 6379, driver: :hiredis)
*** [err :: 54.215.187.53] ^
*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/initializers/redis.rb:1: syntax error, unexpected ',', expecting $end
*** [err :: 54.215.187.53] $redis = Redis.new(host: 'localhost', port: 6379, driver: :hiredis)
*** [err :: 54.215.187.53] ^
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/engine.rb:588
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/engine.rb:587
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `run_initializers'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `send'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/environment.rb:5
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/application.rb:297:in `initialize_tasks'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:93
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:205:in `invoke_prerequisites'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:183:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:60
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:246:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:184:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:73:in `run'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
*** [err :: 54.215.187.53] /var/www/crowdcode/shared/bundle/ruby/1.8/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
*** [err :: 54.215.187.53] Tasks: TOP => environment
*** [err :: 54.215.187.53] (See full trace by running task with --trace)
command finished in 2472ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/crowdcode/releases/20130831210643; true"
    servers: ["54.215.187.53"]
    [54.215.187.53] executing command
    command finished in 21ms
failed: "sh -c 'cd -- /var/www/crowdcode/releases/20130831210643 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile'"

Edit: Here's what's in redis.rb

$redis = Redis.new(host: 'localhost', port: 6379, driver: :hiredis)
class << $redis

  def get_json_list(key)
    str = "[" <<  $redis.lrange(key, 0, -1).join(',') << "]"
    JSON.parse(str)
  end

end

Edit 2:

The issue was that it was somehow running the wrong version of Ruby and from the error we can see that it says 1.8. So I had to make sure my system defaulted to 1.9.3 and voila! No more syntax error and it was able to run fine.

2

There are 2 answers

2
AudioBubble On BEST ANSWER

This is a shot in the dark. I would also verify that the environment that you are deploying this app to is using the same version of ruby and rails.

I was getting all kinds of syntax errors when I deployed my last app and went about crazy until I realized I hadn't adjusted my rvm.

2
ErJab On

This is not an error because of Faraday. It's a syntax error in your initializer as this line indicates:

*** [err :: 54.215.187.53] /var/www/crowdcode/releases/20130831210643/config/initializers/redis.rb:1: syntax error, unexpected ':', expecting ')'

You want to check config/initializers/redis.rb for any syntax errors.