capistrano部署不使用gemset

时间:2013-10-24 14:34:14

标签: ruby rvm capistrano bundler

警告:我对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

如果有任何其他信息有帮助,请告诉我。谢谢!

1 个答案:

答案 0 :(得分:0)

我90%确定您需要使用此https://github.com/wayneeseguin/rvm-capistrano#disabling-bundle---deployment-when-using-gemsets

set :bundle_dir, ''
set :bundle_flags, '--system --quiet'