Capistrano deploy is throwing following error, on assets precompile step.
rake aborted!
LoadError: cannot load such file -- ci/reporter/rake/rspec
/home/ubuntu/github/my_app/releases/20160806071639/Rakefile:4:in `require'
/home/ubuntu/github/my_app/releases/20160806071639/Rakefile:4:in `<top (required)>'
/home/ubuntu/github/my_app/shared/bundle/ruby/2.0.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/bin/bundle:23:in `load'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/bin/bundle:23:in `<main>'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
/home/ubuntu/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
I ran following command,
cap staging deploy
So, I tried running ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
in release folder to check if I've missed something in my deployment file. But it failed there as well.
But when I ran same command, ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
from my deployment directory (the place from which I'm running cap deploy
command), it runs successfully.
Following are the environment settings,
Ruby version = 2.0.0
Rails version = 3.2.21
Capistrano version = 3.4.0
My deploy.rb
file (I've changed github url),
# config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'my_app'
set :repo_url, 'git@github.com:xyz/my_app.git'
set :branch, ENV["REVISION"] || ENV["BRANCH_NAME"] || "master"
set :deploy_root, "/home/ubuntu/github/"
set :deploy_to, "#{fetch(:deploy_root)}my_app"
set :bundle_flags, "--local --no-cache"
set :scm_passphrase, ""
set :use_sudo, false
set :ssh_options, {:forward_agent => true}
set :copy_exclude, [ '.git' ]
set :rails_env, "staging"
set :keep_releases, 1
set :run_bundle_install, true
set :run_precompile, true
set :run_db_migrate, false
set :run_rspec, false
set :stage, :production
server "127.0.0.1", user: "ubuntu", roles: %w{web app}
set :linked_files, %w{config/database.yml config/database.yml}
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
# set :deploy_to, '/var/www/my_app_name'
# Default value for :scm is :git
# set :scm, :git
# Default value for :format is :pretty
# set :format, :pretty
# Default value for :log_level is :debug
# set :log_level, :debug
# Default value for :pty is false
set :pty, true
# Default value for :linked_files is []
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
# Default value for linked_dirs is []
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases, 5
namespace :deploy do
desc "Restart sidekiq"
task :restart_sidekiq do
run <<-CMD
cd fetch(current_path) && script/sidekiq restart -e #{rails_env}
CMD
end
desc "Restart application"
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join("tmp/restart.txt")
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
#after :finishing, "deploy:restart"
after :finishing, "deploy:restart_sidekiq"
after :finishing, "deploy:cleanup"
end
My Capfile,
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# http://ift.tt/PSLPeH
# http://ift.tt/1nFai6c
# http://ift.tt/1nFai6d
# http://ift.tt/1nFai6f
# http://ift.tt/1nFai6g
# http://ift.tt/1z5Iifp
#
require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
# require 'capistrano/passenger'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Gemfile snapshot,
gem 'capistrano', '3.4.0'
gem 'sshkit', '1.11.2'
gem 'net-scp', '1.2.1'
gem 'capistrano-rails', '1.1.7'
gem 'capistrano-bundler', '1.1.4'
gem 'capistrano-rvm', '0.1.2'
Do let me know, if you need more info.
Aucun commentaire:
Enregistrer un commentaire