bundle install doesn't work from capistrano

后端 未结 9 1698
再見小時候
再見小時候 2021-02-01 15:14

I want to deploy my simple rails 4.0 application via capistrano 3.0.

I use bundler 1.3.5 so I add capistrano-bundler gem to integ

相关标签:
9条回答
  • 2021-02-01 15:42

    Just ran into the same issue. What worked for me was this:

    1) Installing the capistrano-rvm gem and adding

    require 'capistrano/rvm'
    

    to the Capfile.

    2) Adding my deployment user to the rvm group on the server:

    # usermod deploy -a -G rvm
    

    3) Creating two directories in my deployment user's home folder: .rvm and .rvm/bin

    4) Adding this line to my deploy.rb file:

    set :default_env, { rvm_bin_path: '~/.rvm/bin' }
    

    Phew! That took a few hours.

    0 讨论(0)
  • 2021-02-01 15:42

    in your config/deploy/production.rb file put

    set :rvm_ruby_version, '2.0.0-p247'  
    

    see https://github.com/capistrano/rvm

    0 讨论(0)
  • 2021-02-01 15:45

    I had:

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

    Changed to:

    set :bundle_flags, '--deployment --quiet'
    

    This resolved a problem.

    0 讨论(0)
  • 2021-02-01 15:49

    To debug it try to remove the --quiet flag:

    set :bundle_flags, '--deployment'

    Are you using rbenv, rvm or something similar? It might be possible that when bundle is running the Ruby version is not set yet. By removing the --quite flag you might get some debugging information.

    0 讨论(0)
  • 2021-02-01 15:55

    The error sounds like it can't find bundle in your PATH. It's possible that when you SSH in manually, it's running something in your ~/.profile or ~/.bash_profile that adds it to your path.

    Find the path to bundle by logging in and running which bundle. Then, try to find how that path is added to your PATH environment variable. If there's something in your ~/.bash_profile, try moving it to~/.bashrc` instead.

    You can also try Command Mapping to specify an exact path.

    There are some more troubleshooting tips at http://www.capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/

    0 讨论(0)
  • 2021-02-01 15:56

    This works in capistrano 3:

      task :bundle_list do
        on roles(:app) do
          within release_path do
            with rails_env: fetch(:rails_env) do
              execute :bundle, "list"
            end
          end
        end
      end
    

    Use this for rake task :

    execute :rake, 'some_rake_task'
    
    0 讨论(0)
提交回复
热议问题