Rakefile not getting deployed with capistrano - ruby-on-rails

I am getting this error when deploying with capistrano:
executing "cd /opt/my_app/dev/releases/20100103021722; rake RAILS_ENV=staging db:migrate"
servers: ["96.30.33.84"]
[96.30.33.84] executing command
** [out :: 96.30.33.84] rake aborted!
** [out :: 96.30.33.84]
** [out :: 96.30.33.84] No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
** [out :: 96.30.33.84]
** [out :: 96.30.33.84] /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2377:in `raw_load_rakefile'
** [out :: 96.30.33.84]
** [out :: 96.30.33.84] (See full trace by running task with --trace)
** [out :: 96.30.33.84]
It randomly just started occurring. I found out the problem was that my new deploys are missing my rake file...however I am deploying from my staging branch and I can confirm that my staging branch has the Rakefile. Somehow it's not getting deployed. Does anyone know how to troubleshoot this?

I assume that you are using some sort of vcs (svn/git/etc.), have the files been ignored by the repo, ie. they aren't getting deployed with the app, thus not showing up on staging?

Related

deploy capistrano ruby 2.0

what it means, when i deploy my project i have error :
** transaction: commit
* 2014-01-10 15:52:54 executing `deploy:bundle'
* executing "cd /var/www/current; bundle install"
servers: ["10.3.27.72"]
[10.3.27.72] executing command
** [out :: 10.3.27.72] /home/shibanov/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'bundler' (>= 0) among 0 total gem(s) (
** [out :: 10.3.27.72] Gem::LoadError)
** [out :: 10.3.27.72] from /home/shibanov/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
** [out :: 10.3.27.72] from /home/shibanov/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
** [out :: 10.3.27.72] from /home/shibanov/.rvm/gems/ruby-2.0.0-p195#sprut/bin/bundle:22:in `<main>'
** [out :: 10.3.27.72] from /home/shibanov/.rvm/gems/ruby-2.0.0-p195#sprut/bin/ruby_executable_hooks:15:in `eval'
** [out :: 10.3.27.72] from /home/shibanov/.rvm/gems/ruby-2.0.0-p195#sprut/bin/ruby_executable_hooks:15:in `<main>'
command finished in 41ms
failed: "env PATH=/home/shibanov/.rvm/gems/ruby-2.0.0-p195#sprut/bin:/home/shibanov/.rvm/gems/ruby-2.0.0-p195#sprut/bin:/home/shibanov/.rvm/rubies/ruby-2.0.0-p195/bin:/home/shibanov/.rvm/bin:$PATH RUBY_VERSION=ruby-2.0.0-p195 GEM_HOME=/home/shibanov/.rvm/gems/uby-2.0.0-p195#sprut GEM_PATH=/home/shibanov/.rvm/gems/uby-2.0.0-p195#sprut:/home/shibanov/.rvm/gems/uby-2.0.0-p195#sprut BUNDLE_PATH=/home/shibanov/.rvm/gems/uby-2.0.0-p195#sprut sh -c 'cd /var/www/current; bundle install'" on 10.3.27.72
it error happen when i migrate project from ruby 1.9.3 to ruby 2.0
You have to set GEM_HOME accordingly:
$ export GEM_HOME='/home/shibanov/.rvm/gems/ruby-2.0.0-p195'

Rails: how to debug assets:precompile failure on cap deploy

I'm getting a cryptic error on cap deploy
$ cap deploy
. . .
* executing "cd -- /rails/myapp/releases/20130919002235 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
servers: ["persephone"]
[persephone] executing command
. . .
** [out :: persephone] rake aborted!
** [out :: persephone] Caught Encoding::CompatibilityError at '["ok","(function() {': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
** [out :: persephone] (in /rails/myapp/releases/20130919002235/app/assets/javascripts/disk_files.js.coffee)
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:242:in `rescue in parse_string'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:213:in `parse_string'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:257:in `parse_value'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/pure/parser.rb:121:in `parse'
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/json-1.8.0/lib/json/common.rb:155:in `parse'
. . .
In trying to debug the problem I've tried completely removing disk_files.js.coffee and then the same error occurs for application.js.
I've then changed my application.js manifest so that it doesn't require anything and then I get a similar error for application.css
I've commented out my custom css and now I get:
** [out :: persephone] rake aborted!
** [out :: persephone] undefined method `[]' for nil:NilClass
** [out :: persephone] (in /rails/myapp/releases/20130919200133/app/assets/stylesheets/application.css)
** [out :: persephone] /rails/myapp/shared/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/sass_functions.rb:63:in `sprockets_context'
Each of these steps requires a git commit to origin and then a cap deploy.
FWIW- adding #encoding: UTF-8 as per SO#9857443 doesn't help.
Anyone know what's going on? How can I debug this?

Moonshine Deployment Error

When I try to deploy my rails app to Rackspace using Moonshine, I get the following error:
* 2013-01-20 22:54:44 executing `app:symlinks:update'
* 2013-01-20 22:54:44 executing `deploy:create_symlink'
triggering before callbacks for `deploy:create_symlink'
* 2013-01-20 22:54:44 executing `moonshine:apply'
* executing "sudo -p 'sudo password: ' RAILS_ROOT=/srv/appname/releases/20130121065443 DEPLOY_STAGE= RAILS_ENV=production shadow_puppet /srv/appname/releases/20130121065443/app/manifests/application_manifest.rb"
servers: ["appname.com"]
[appname.com] executing command
** [out :: appname.com] Uncaught exception: LoadError: cannot load such file -- /srv/appname/releases/20130121065443/app/manifests/application_manifest.rb
** [out :: appname.com]
** [out :: appname.com]
** [out :: appname.com] /usr/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
** [out :: appname.com]
** [out :: appname.com]
** [out :: appname.com] /usr/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
** [out :: appname.com]
** [out :: appname.com]
** [out :: appname.com] /usr/lib/ruby/gems/1.9.1/gems/shadow_puppet-0.6.2/bin/shadow_puppet:130:in `<top (required)>'
** [out :: appname.com]
** [out :: appname.com]
** [out :: appname.com] /usr/bin/shadow_puppet:19:in `load'
** [out :: appname.com]
** [out :: appname.com]
** [out :: appname.com] /usr/bin/shadow_puppet:19:in `<main>'
** [out :: appname.com]
command finished in 2569ms
*** [deploy:update_code] rolling back
* executing "rm -rf /srv/appname/releases/20130121065443; true"
servers: ["appname.com"]
[appname.com] executing command
command finished in 364ms
failed: "sh -c 'sudo -p '\\''sudo password: '\\'' RAILS_ROOT=/srv/appname/releases/20130121065443 DEPLOY_STAGE= RAILS_ENV=production shadow_puppet /srv/appname/releases/20130121065443/app/manifests/application_manifest.rb'" on appname.com
How should I go about fixing this?
If you don't know how to fix it, what are other gems that would help me deploy my app to Rackspace.
I found the issue. Capistrano was pulling the source from git and I forgot to push the new code. That means, application_manifest.rb didn't exist on the server. After pushing, it worked perfectly.

Assets precompile fails on EC2: can't find jQuery

I'm configuring a new production deployment setup with a skeleton rails app, which I just generated using rails new with Rails 3.2.8. I have a production setup on my dev machine with apache2 and Phusion Passenger, which all works fine. When I try to push that configuration to EC2, the assets precompile step fails because it can't find jQuery.
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'capistrano'
gem 'jquery-rails'
gem 'haml'
group :assets do
gem 'less-rails'
gem 'uglifier', '>= 1.0.3'
gem 'therubyracer'
gem 'execjs'
end
group :deploy do
gem 'passenger'
end
group :production do
gem 'bigdecimal'
end
Relevant bit of deploy.rb
after "deploy:update_code" do
run "cd #{release_path}; rake assets:precompile RAILS_ENV=production "
end
Output
triggering after callbacks for `deploy:update_code'
* executing "cd /home/ec2-user/BWW/pages/bw-widget/releases/20121017095008; rake assets:precompile RAILS_ENV=production"
servers: ["bww-test"]
[bww-test] executing command
** [out :: bww-test] /usr/bin/ruby1.9 /usr/local/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
** [out :: bww-test]
** [out :: bww-test] rake aborted!
** [out :: bww-test]
** [out :: bww-test] couldn't find file 'jquery'
** [out :: bww-test] (in /home/ec2-user/BWW/pages/bw-widget/releases/20121017095008/app/assets/javascripts/application.js:13)
** [out :: bww-test]
** [out :: bww-test]
** [out :: bww-test] Tasks: TOP => assets:precompile:primary
** [out :: bww-test]
** [out :: bww-test] (See full trace by running task with --trace)
** [out :: bww-test]
** [out :: bww-test] rake aborted!
** [out :: bww-test] Command failed with status (1): [/usr/bin/ruby1.9 /usr/local/bin/rake asset...]
** [out :: bww-test]
** [out :: bww-test] Tasks: TOP => assets:precompile
** [out :: bww-test] (See full trace by running task with --trace)
command finished in 1819ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/ec2-user/BWW/pages/bw-widget/releases/20121017095008; true"
servers: ["bww-test"]
[bww-test] executing command
command finished in 168ms
failed: "sh -c 'cd /home/ec2-user/BWW/pages/bw-widget/releases/20121017095008; rake assets:precompile RAILS_ENV=production'" on bww-test
If I look on the server, the bundle including jQuery has been installed by Capistrano:
[ec2-user#ip-10-226-122-140 bw-widget]$ find . -name jquery\*
./shared/bundle/ruby/1.9.1/specifications/jquery-rails-2.1.3.gemspec
./shared/bundle/ruby/1.9.1/cache/jquery-rails-2.1.3.gem
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/jquery-rails.gemspec
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/lib/generators/jquery
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/lib/jquery
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/lib/jquery-rails.rb
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery_ujs.js
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery-ui.js
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery.min.js
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery.js
./shared/bundle/ruby/1.9.1/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery-ui.min.js
./shared/bundle/ruby/1.9.1/gems/rdoc-3.12/lib/rdoc/generator/template/darkfish/js/jquery.js
I'm slightly puzzled that the gems are in ruby/1.9.1 when I'm actually using 1.9.3p0 (the yum install version, not the rvm version), but I don't know if that is significant.
Update
Following a comment from Said, I changed the after update task to:
after "deploy:update_code" do
run "cd #{release_path}; bundle exec rake assets:precompile RAILS_ENV=production "
end
However, none of the documents I've read have suggested that bundle exec should be necessary, so I'm still concerned that while I have a work-around, something still isn't quite configured right.

Getting "stack level too deep" error when deploying with Capistrano, Rails 3.1 ruby 1.9.2

Here is the log for the cap deploy script output around where the error occurs. Anny suggestions why this might be happening? Thanks!
[yup.la] executing command
[yup.la] sh -c 'cd /srv/www/portrait/releases/20120406051647 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'
** [out :: yup.la] rake aborted!
** [out :: yup.la]
** [out :: yup.la] stack level too deep
** [out :: yup.la] (in /srv/www/portrait/releases/20120406051647/app/assets/stylesheets/mobile.css.scss)
** [out :: yup.la]
** [out :: yup.la] Tasks: TOP => assets:precompile:primary
** [out :: yup.la] (See full trace by running task with --trace)
** [out :: yup.la]
command finished in 30868ms
*** [deploy:update_code] rolling back
* executing "rm -rf /srv/www/portrait/releases/20120406051647; true"
servers: ["yup.la"]
[yup.la] executing command
[yup.la] sh -c 'rm -rf /srv/www/portrait/releases/20120406051647; true'
command finished in 288ms
failed: "sh -c 'cd /srv/www/portrait/releases/20120406051647 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on yup.la
/Users/victorstan/Sites/portrait ∴
Try to change your sass-rails version from 3.1.5 to 3.1.4 in your Gemfile.

Resources