警告:我对 capistrano 和 rvm 有点陌生。不带导轨。我在部署脚本中使用 rvm-capistrano在 ruby 1.9.3 上创建 gemset。看来这工作正常。问题是当它尝试预编译资产时,它使用的是我的 shared/bundle/ruby/1.9.1/gems 目录中的 gem。这是一个问题,但我不知道该怎么做......是捆绑器放置宝石的问题,宝石集位置指向的位置,还是只是不尝试使用宝石集。有任何想法吗?这是我的部署脚本:
require 'mana/server_ec2'
# setup rvm
require 'rvm/capistrano'
set :rvm_ruby_string, :local # use the same ruby as used locally for deployment
#set :rvm_autolibs_flag, "read-only" # more info: rvm help autolibs
#before 'deploy', 'rvm:install_rvm' # install/update RVM
#before 'deploy', 'rvm:install_ruby' # install Ruby and create gemset, OR:
# before 'deploy:setup', 'rvm:create_gemset' # only create gemset
before :deploy, 'rvm:create_gemset'
set :default_stage, :vagrant
set :ruby_version, :brightbox
set :care_about_ruby_version, false
set :chef_version, '~> 11.4.0'
set :railsapp,
server_names: '_'
set :run_list, %w(
recipe[monit]
recipe[resque]
)
set :runner, 'nobody'
set :keep_releases, 10
task :set_permissions, :roles => :web do
run "sudo chmod 777 #{current_release}/tmp #{current_release}/tmp/pids -R"
end
after 'deploy:restart', 'deploy:restart_unicorn'
after 'deploy:finalize_update', :set_permissions
before 'deploy:assets:precompile' do
#upload 'vendor/assets/components.zip', "#{latest_release}/vendor/assets", via: :scp
#run "cd #{latest_release}/vendor/assets && unzip -o #{latest_release}/vendor/assets/components.zip"
run "cd #{latest_release} && bower install"
end
set :resque, queues: { "*" => 2 }
after 'deploy:update', 'deploy:cleanup'
after 'deploy:restart' do
sudo "monit -g #{application}-resque restart"
end
让我知道是否有任何其他信息会有所帮助。谢谢!