【问题标题】:Bundle install failing when deploying a Rails 3 app to Dreamhost with Capistrano使用 Capistrano 将 Rails 3 应用程序部署到 Dreamhost 时捆绑安装失败
【发布时间】:2011-06-07 02:17:02
【问题描述】:

我正在尝试使用 Capistrano 将本地工作的 Rails 3 应用程序部署到 Dreamhost。 当我在本地应用程序根目录中运行 'cap deploy -v' 时,我会在它卡住 'bundle install' 之前走到这一步。以下是错误信息的结尾:

** 事务:开始 ** [abunchofletters.co.uk :: out] my_username@abunchofletters.co.uk 的密码: 密码: ** [abunchofletters.co.uk :: 出] ** [abunchofletters.co.uk :: out] HEAD 现在位于 62f9cdb 初始部署到 Dreamhost ** [out :: abunchofletters.co.uk] sh:捆绑:找不到命令 * [deploy:update_code] 回滚 失败:“sh -c 'bundle 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

任何想法如何进步?如果您需要更多信息,请提示我,我会提供。

【问题讨论】:

    标签: deployment ruby-on-rails-3 capistrano bundler dreamhost


    【解决方案1】:

    我对我提出的解决方案不太满意,但它使部署工作和捆绑程序更新。

    这是我更新后的 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,尽管现在不推荐使用捆绑锁定/解锁。可能可以简单地替换为捆绑安装/更新,但今晚不推荐使用。

    【讨论】:

      猜你喜欢
      • 2011-06-08
      • 1970-01-01
      • 1970-01-01
      • 2013-10-25
      • 1970-01-01
      • 1970-01-01
      • 2012-01-02
      • 2023-03-16
      • 1970-01-01
      相关资源
      最近更新 更多