Bundle install failing when deploying a Rails 3 app to Dreamhost with Capistrano

后端 未结 1 776
深忆病人
深忆病人 2021-01-06 16:45

I am trying to deploy a locally working Rails 3 app to Dreamhost with Capistrano. When I run \'cap deploy -v\' in my local app root I get so far before it chokes on \'bundle

相关标签:
1条回答
  • 2021-01-06 17:01

    I'm not too satisfied with the solution I came up with, but it got the deploy to work and bundler to update.

    Here's my updated 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
    

    The :gems task was seen here: http://grigio.org/deploy_rails_3_passenger_apache_dreamhost, though the bundle lock/unlock are deprecated now. Might be able to simply replace with bundle install/update, but deprecated will do for tonight.

    0 讨论(0)
提交回复
热议问题