【发布时间】:2011-09-03 00:53:34
【问题描述】:
尝试使用捆绑/安装选项部署我的应用时,我不断收到以下错误:
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
【问题讨论】:
-
您是否使用 RVM 或任何可能使您的会话在登录时与 capistrano 连接时不同的东西?
-
不,我没有使用 RVM - 原来解决方案是显示 bundle 在 deploy.rb 文件中的位置。我对这个 $PATH 东西不是很了解。我觉得这个解决方案很奇怪,因为过去几周,我从来没有在部署文件中看到过这个选项。
标签: ruby-on-rails capistrano bundler