Capistrano 3和Rbenv使用Chef安装了系统范围(bash:bundle:command not found)

时间:2014-05-13 09:34:17

标签: capistrano

我的Capfile

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rbenv'
require 'capistrano/bundler'
require 'capistrano/rails/migrations'

Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

Rake::Task[:production].invoke

我的deploy.rb文件

    set :application, 'mmweb'
    set :scm,           :git
    set :repo_pwd, "Fischer"
    set :repo_url, "https://hash_bush:#{fetch(:repo_pwd)}@bitbucket.org/hash_bush/mm-server.git"
    set :migrate_target,  :current
    set :ssh_options, {:user => 'vagrant',keys: ['C:/Users/hrr/Desktop/insecure_private_key']}
    set :rails_env,       "development"
    set :deploy_to,       "/var/www/mm/"
    set :default_environment, {
    'PATH' => "/opt/rbenv/shims:/opt/rbenv/bin:$PATH"
   }
    set :rbenv_ruby, '1.9.2-p320'
    set :rbenv_path, "/opt/rbenv"
    set :use_sudo, true
    set :log_level, :debug
    set :linked_files, %w{config/database.yml}
    set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
    set :keep_releases, 1

    task :migrate do
     on roles(:web) do
        puts current_path
        puts shared_path
        puts execute "pwd"
        execute "cd #{current_path}/mm-web && rm -rf Gemfile.lock"
        execute "cd #{current_path}/mm-web && bundle exec install"
        execute "bundle exec rake:db migrate"
        #execute "cd #{current_path}/mm-api && rake db:migrate"
        #execute "bundle install"
      end  
      end


    task :restart do
      on roles(:web), in: :sequence, wait: 1 do
         execute "sudo /etc/init.d/nginx restart"
      end
    end
    after :deploy, :migrate

在进行封面部署和排除命令cd#{current_path} / mm-web&&捆绑exec安装 我正在

  

cd / var / www / mm / current / mm-web&& bundle exec install stderr:bash:   bundle:comma nd not found

我的部署机器rbenv在 的/ opt / rbenv /垫片

不仅捆绑命令rake也不起作用。我知道它与我的路径有关。我真的陷入了这个问题。请帮忙。

1 个答案:

答案 0 :(得分:-1)

试试这个表格

task :migrate do
  on roles(:web) do
    within release_path do
      execute 'bundle', 'exec rake db:migrate'
    end
  end
end