While deploying a Rails 3 application we are getting following error. Please help to fix this issue.
$ cap deploy
triggering load callbacks
* 2015-03-17 19:25:22 executing `deploy'
* 2015-03-17 19:25:22 executing `deploy:update'
** transaction: start
* 2015-03-17 19:25:22 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:BoTreeConsultingTeam/IntegrityMatters.git master"
command finished in 3579ms
* executing "if [ -d /home/ubuntu/integrity_matters/shared/cached-copy ]; then cd /home/ubuntu/integrity_matters/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard eb49600f7de21f4b2b1de8884f70dd5a88837f41 && git clean -q -d -x -f; else git clone -q -b master git@github.com:BoTreeConsultingTeam/IntegrityMatters.git /home/ubuntu/integrity_matters/shared/cached-copy && cd /home/ubuntu/integrity_matters/shared/cached-copy && git checkout -q -b deploy eb49600f7de21f4b2b1de8884f70dd5a88837f41; fi"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 4644ms
copying the cached version to /home/ubuntu/integrity_matters/releases/20150317135535
* executing "cp -RPp /home/ubuntu/integrity_matters/shared/cached-copy /home/ubuntu/integrity_matters/releases/20150317135535 && (echo eb49600f7de21f4b2b1de8884f70dd5a88837f41 > /home/ubuntu/integrity_matters/releases/20150317135535/REVISION)"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 1212ms
* 2015-03-17 19:25:36 executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* 2015-03-17 19:25:36 executing `deploy:assets:symlink'
* executing "rm -rf /home/ubuntu/integrity_matters/releases/20150317135535/public/assets && mkdir -p /home/ubuntu/integrity_matters/releases/20150317135535/public && mkdir -p /home/ubuntu/integrity_matters/shared/assets && ln -s /home/ubuntu/integrity_matters/shared/assets /home/ubuntu/integrity_matters/releases/20150317135535/public/assets"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 986ms
* 2015-03-17 19:25:37 executing `bundle:install'
* executing "cd /home/ubuntu/integrity_matters/releases/20150317135535 && bundle install --gemfile /home/ubuntu/integrity_matters/releases/20150317135535/Gemfile --path /home/ubuntu/integrity_matters/shared/bundle --deployment --quiet --without development test"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 1302ms
* executing "chmod -R -- g+w /home/ubuntu/integrity_matters/releases/20150317135535 && rm -rf -- /home/ubuntu/integrity_matters/releases/20150317135535/public/system && mkdir -p -- /home/ubuntu/integrity_matters/releases/20150317135535/public/ && ln -s -- /home/ubuntu/integrity_matters/shared/system /home/ubuntu/integrity_matters/releases/20150317135535/public/system && rm -rf -- /home/ubuntu/integrity_matters/releases/20150317135535/log && ln -s -- /home/ubuntu/integrity_matters/shared/log /home/ubuntu/integrity_matters/releases/20150317135535/log && rm -rf -- /home/ubuntu/integrity_matters/releases/20150317135535/tmp/pids && mkdir -p -- /home/ubuntu/integrity_matters/releases/20150317135535/tmp/ && ln -s -- /home/ubuntu/integrity_matters/shared/pids /home/ubuntu/integrity_matters/releases/20150317135535/tmp/pids"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 982ms
triggering after callbacks for `deploy:finalize_update'
* 2015-03-17 19:25:39 executing `deploy:symlink_config'
* executing "ln -nfs /home/ubuntu/integrity_matters/shared/config/database.yml /home/ubuntu/integrity_matters/releases/20150317135535/config/database.yml"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 976ms
triggering after callbacks for `deploy:update_code'
* 2015-03-17 19:25:40 executing `deploy:assets:precompile'
triggering before callbacks for `deploy:assets:precompile'
* 2015-03-17 19:25:40 executing `deploy:assets:update_asset_mtimes'
* executing "[ -e /home/ubuntu/integrity_matters/shared/assets/manifest* ] && cat /home/ubuntu/integrity_matters/shared/assets/manifest* || echo"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 991ms
* executing "cd -- /home/ubuntu/integrity_matters/releases/20150317135535 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] rake aborted!
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] Please require this file from within a Capistrano recipe
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:18:in `instance'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/helpers/base.rb:16:in `rvm_with_capistrano'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/helpers/_cset.rb:3:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/base.rb:1:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/selector.rb:1:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.r
** [out :: 52.10.245.227] b:251:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano.rb:3:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:85:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:85:in `rescue in block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:68:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `each'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler.rb:134:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/releases/20150317135535/config/application.rb:7:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/releases/20150317135535/Rakefile:5:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/releases/20150317135535/Rakefile:5:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] (See full trace by running task with --trace)
** [out :: 52.10.245.227]
command finished in 2630ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/ubuntu/integrity_matters/releases/20150317135535; true"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 1025ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cd -- /home/ubuntu/integrity_matters/releases/20150317135535 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile'" on 52.10.245.227
Gemfile
gem 'capistrano'
gem 'capistrano-ext'
gem 'rvm-capistrano', require: false
deploy.rb
require "bundler/capistrano"
require "rvm/capistrano"
server "IP_ADDRESS", :web, :app, :db, primary: true
set :application, "integrity_matters"
set :user, "ubuntu"
ssh_options[:keys] = ["~/.ssh/im_ec2_free.pem"]
set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "git@github.com:BoTreeConsultingTeam/IntegrityMatters.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
after "deploy", "deploy:migrate"
namespace :deploy do
# Reference: http://ift.tt/1MIWfEE
task :symlink_assets, :roles => [:app, :db, :web] do
run "ln -nfs #{shared_path}/assets #{deploy_to}/assets"
end
after "deploy", "deploy:symlink_assets"
# Reference: http://ift.tt/1FvEqZj
task :cold do
transaction do
update
setup_db #replacing migrate in original
start
end
end
task :setup_db, :roles => :app do
raise RuntimeError.new('db:setup aborted!') unless Capistrano::CLI.ui.ask("About to `rake db:setup`. Are you sure to wipe the entire database (anything other than 'yes' aborts):") == 'yes'
run "cd #{current_path}; bundle exec rake db:setup RAILS_ENV=#{rails_env}"
end
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
after "deploy", "deploy:assets:precompile"
end
Capfile
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
$ gem list | grep bundler
bundler (1.8.5, 1.3.5)
bundler-unload (1.0.1)
rubygems-bundler (1.2.2)
Aucun commentaire:
Enregistrer un commentaire