我正在尝试使用Capistrano将本地工作的Rails 3应用程序部署到Dreamhost。 当我在我的本地应用程序根目录中运行'cap deploy -v'时,我得到了它在“捆绑安装”之前窒息。以下是错误消息的结尾:
**交易:开始** [abunchofletters.co.uk :: out] my_username@abunchofletters.co.uk的密码: 密码:** [abunchofletters.co.uk :: out] ** [abunchofletters.co.uk :: out] HEAD现在在62f9cdb初始部署到Dreamhost ** [out :: abunchofletters.co.uk] sh:bundle:找不到命令 * [deploy:update_code]回滚 失败:“sh -c'bund install --gemfile /home/my_username/abunchofletters.co.uk/releases/20110111100145/Gemfile --path /home/my_username/abunchofletters.co.uk/shared/bundle-deployment-安静 - 没有开发测试'“在abunchofletters.co.uk
然而,当我通过SSH连接到我的服务器并检查gem列表时,显示安装了bundler 1.0.7 [也运行Ruby 1.8.7,Rails 3.0.3,RubyGems 1.3.6]。这是我第一次部署Rails应用程序以及Capistrano的经验,所以我接近无能为力,但我猜想某些路径或变量设置不正确。
这是我的deploy.rb [从以下http://railstips.org/blog/archives/2008/12/14/deploying-rails-on-dreamhost-with-passenger/创建,因此可能已过时]:
require "bundler/capistrano" # http://gembundler.com/deploying.html
default_run_options[:pty] = true
# be sure to change these
set :user, 'my_username'
set :domain, 'abunchofletters.co.uk'
set :application, 'abunchofletters'
# the rest should be good
set :repository, "#{user}@#{domain}:git/#{application}.git"
set :deploy_to, "/home/#{user}/#{domain}"
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
set :use_sudo, false
server domain, :app, :web
role :db, domain, :primary => true
namespace :deploy do
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
end
任何想法如何进步?如果您需要更多信息,只需提示我,我就会提供。
答案 0 :(得分:0)
我对我提出的解决方案不太满意,但它使部署工作和捆绑器更新。
这是我更新的deploy.rb:
#require "bundler/capistrano"
default_run_options[:pty] = true
# be sure to change these
set :user, 'futureproof'
set :domain, 'abunchofletters.co.uk'
set :application, 'abunchofletters'
# the rest should be good
set :repository, "#{user}@#{domain}:git/#{application}.git"
set :deploy_to, "/home/#{user}/#{domain}"
set :deploy_via, :remote_cache
set :shared_path, "/home/#{user}/.gems"
set :scm, 'git'
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
set :use_sudo, false
server domain, :app, :web
role :db, domain, :primary => true
namespace :deploy do
desc "expand the gems"
task :gems, :roles => :web, :except => { :no_release => true } do
run "cd #{current_path}; #{shared_path}/bin/bundle unlock"
run "cd #{current_path}; nice -19 #{shared_path}/bin/bundle install vendor/" # nice -19 is very important otherwise DH will kill the process!
run "cd #{current_path}; #{shared_path}/bin/bundle lock"
end
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
end
:gems任务在这里看到:http://grigio.org/deploy_rails_3_passenger_apache_dreamhost,虽然捆绑锁定/解锁现在已弃用。可以简单地用bundle install / update替换,但是今晚会弃用。