0

我一直在尝试使用 Capistrano 部署到 VPS,以下命令给我带来了很多错误:

* executing "cd -- /home/work/for_linode/releases/20130317174830 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile && cp -- /home/work/for_linode/shared/assets/manifest.yml /home/work/for_linode/releases/20130317174830/assets_manifest.yml"

结果如下:

servers: ["50.116.11.160"]
    [50.116.11.160] executing command
*** [err :: 50.116.11.160] rake aborted!
*** [err :: 50.116.11.160] Could not find activesupport-3.2.11 in any of the sources
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/spec_set.rb:92:in `block in materialize'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/spec_set.rb:85:in `map!'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/spec_set.rb:85:in `materialize'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/definition.rb:114:in `specs'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/definition.rb:159:in `specs_for'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/definition.rb:148:in `requested_specs'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/environment.rb:18:in `requested_specs'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/runtime.rb:13:in `setup'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler.rb:120:in `setup'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.4/lib/bundler/setup.rb:17:in `<top (required)>'
*** [err :: 50.116.11.160] /home/work/for_linode/releases/20130317174830/config/boot.rb:6:in `<top (required)>'
*** [err :: 50.116.11.160] /home/work/for_linode/releases/20130317174830/config/application.rb:1:in `<top (required)>'
*** [err :: 50.116.11.160] /home/work/for_linode/releases/20130317174830/Rakefile:5:in `<top (required)>'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
*** [err :: 50.116.11.160] /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
*** [err :: 50.116.11.160] (See full trace by running task with --trace)
    command finished in 1888ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/work/for_linode/releases/20130317174830; true"
    servers: ["50.116.11.160"]
    [50.116.11.160] executing command
    command finished in 1591ms
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p392' -c 'cd -- /home/work/for_linode/releases/20130317174830 && rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile && cp -- /home/work/for_linode/shared/assets/manifest.yml /home/work/for_linode/releases/20130317174830/assets_manifest.yml'" on 50.116.11.160

我绝不是使用 capistrano 的专家,这里的类似问题与一个有点不同的问题有关,

请各位大神帮忙看看是怎么回事?

编辑:

set :application, "for_linode"
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
set :bundle_without, [:development]
set :rvm_install_ruby_params, '--1.9.3-p194' # for jruby/rbx default to 1.9 mode
set :rvm_install_pkgs, %w[libyaml openssl] # package list from https://rvm.io/packages
set :rvm_install_ruby_params, '--with-opt-dir=/root/.rvm/usr' # package support

before 'deploy:setup', 'rvm:install_rvm'   # install RVM
before 'deploy:setup', 'rvm:install_pkgs'  # install RVM packages before Ruby
before 'deploy:setup', 'rvm:install_ruby'  # install Ruby and create gemset, or:
before 'deploy:setup', 'rvm:create_gemset' # only create gemset
before 'deploy:setup', 'rvm:import_gemset' # import gemset from file

require "rvm/capistrano"
require "bundler/capistrano"

set :repository,  "git://github.com/jlstr/for_linode.git"
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :branch, "master"
set :scm, :git
set :user, "root"
set :scm_username, "joe"
set :use_sudo, true
set :deploy_to, '/home/work/for_linode'
#set :rvm_ruby_string, 'ruby-1.9.3-p392'
set :rvm_type, :system

role :web, "50.116.11.160"                          # Your HTTP server, Apache/etc
role :app, "50.116.11.160"                          # This may be the same as your `Web` server
#role :db,  "", :primary => true # This is where Rails migrations will run
#role :db,  "your slave db-server here"

# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
# namespace :deploy do
#   task :start do ; end
#   task :stop do ; end
#   task :restart, :roles => :app, :except => { :no_release => true } do
#     run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
#   end
# end

require "rvm/capistrano"
load 'deploy/assets'
4

1 回答 1

1

将这段代码用于资产:

set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
set :bundle_without, [:development]
require "rvm/capistrano"
require "bundler/capistrano"
load 'deploy/assets'

提取自 => https://github.com/mpapis/ad/blob/master/config/deploy.rb

于 2013-03-17T21:45:26.307 回答