加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Capistrano和Bundler问题 – 捆绑:未找到

发布时间:2020-12-17 04:33:37 所属栏目:百科 来源:网络整理
导读:尝试使用捆绑/安装选项部署我的应用程序时,我一直收到以下错误: failed: "sh -c 'cd /home/deploy/swamp/releases/20110903003336 bundle install --gemfile /home/deploy/swamp/releases/20110903003336/Gemfile --path /home/deploy/swamp/shared/bundle
尝试使用捆绑/安装选项部署我的应用程序时,我一直收到以下错误:
failed: "sh -c 'cd /home/deploy/swamp/releases/20110903003336 
    && bundle install --gemfile /home/deploy/swamp/releases/20110903003336/Gemfile 
    --path /home/deploy/swamp/shared/bundle --deployment --quiet 
    --without development test'" on 12.345.678.98

**更新 – 看起来我错过了一个错误:

[err :: 12.345.678.98] sh: bundle: not found

我在deploy.rb中试过这个:

require "bundler/capistrano"

我试过这个:

namespace :bundler do
  task :create_symlink,:roles => :app do
    shared_dir = File.join(shared_path,'bundle')
    release_dir = File.join(current_release,'.bundle')
    run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
  end
  task :bundle_new_release,:roles => :app do
    bundler.create_symlink
    run "cd #{release_path} && bundle install --without test"
  end
end
after 'deploy:update_code','bundler:bundle_new_release'

我还将我的包移到了供应商路径:

bundle install --path vendor/bundle

我不认为这是一个权限问题,因为我可以直接在服务器上使用deploy和bundle install手动登录没问题.这是整个deploy.rb文件:

require "bundler/capistrano"


 set :application,"swamp"
 set :domain,"12.345.678.98"
 set :repository,"git@github.com:***/**.git"
 set :deploy_to,"/home/deploy/#{application}"
 set :rails_env,'production'
 set :branch,"master"

 role :app,domain
 role :web,domain
 role :db,domain,:primary => true

 set :deploy_via,:remote_cache

 set :scm,:git
 set :user,"deploy"
 set :runner,"deploy"
 ssh_options[:port] = ****
 set :use_sudo,false

 after "deploy","deploy:cleanup"

namespace :deploy do

    desc "Restarting mod_rails with restart.txt"
    task :restart,:roles => :app,:except => { :no_release => true } do
        run "touch #{current_path}/tmp/restart.txt"
    end

    [:start,:stop].each do |t|
        desc "#{t} task is a no-op with mod_rails"
        task t,:roles => :domain do ; end
    end
end

task :after_update_code do  
 run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
end

解决方法

我在这里找到了解决方案:

http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/

In you config/deploy.rb add the following snippet

set :default_environment,{
      'PATH' => "/opt/ruby-enterprise/bin/:$PATH"
    }

然后我不得不将gemfile.lock和gemfile添加到存储库和BAM!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读