我一直在使用Capistrano尝试自动化部署我的服务器和开发机之间的流程。我已经几乎配置好了,但是Capistrano似乎无法使用bundle exec命令启动我的服务器。我一直收到以下错误信息:
以下是处理所有Capistrano相关事物的deploy.rb文件:
... * 执行 "sudo -p 'sudo password: ' bundle exec thin start -C /var/www/thin.config.yml" 服务器: ["85.255.206.157"] [85.255.206.157] 正在执行命令 ** [out :: 85.255.206.157] Could not locate Gemfile 命令在 216ms 内完成 failed: "sh -c 'sudo -p '\\''sudo password: '\\'' bundle exec thin start -C /var/www/thin.config.yml'" on 85.255.206.157只复制了相关的最后一节。文件复制等所有工作都正常进行,只是似乎启动集群失败了。
以下是处理所有Capistrano相关事物的deploy.rb文件:
require "bundler/capistrano"
# define the application and Version Control settings
set :application, "ESCO Matching Demo"
set :repository, "svn://192.168.33.70/RubyOnRails/ESCO"
set :deploy_via, :copy
# Set the login credentials for Capistrano
set :user, "kurt"
# Tell Capistrano where to deploy
set :deploy_to, "/var/www/apps"
# Tell Capistrano the servers it can play with
server "85.255.206.157", :app, :web, :db, :primary => true
# Generate an additional task to fire up the thin clusters
namespace :deploy do
desc "Start the Thin processes"
task :start do
sudo "bundle exec thin start -C thin.yml"
end
desc "Stop the Thin processes"
task :stop do
sudo "bundle exec thin stop -C thin.yml"
end
desc "Restart the Thin processes"
task :restart do
sudo "bundle exec thin restart -C thin.yml"
end
desc "Create a symlink from the public/cvs folder to the shared/system/cvs folder"
task :update_cv_assets, :except => {:no_release => true} do
run "ln -s #{shared_path}/cvs #{latest_release}/public/cvs"
end
end
# Define all the tasks that need to be running manually after Capistrano is finished.
after "deploy:finalize_update", "deploy:update_cv_assets"
after "deploy", "deploy:migrate"
编辑:这是我的thin.yml文件
---
pid: tmp/pids/thin.pid
address: 0.0.0.0
timeout: 30
wait: 30
port: 4000
log: log/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
server: 4
daemonize: true
chdir: /var/www/apps/current
编辑: 目前存在以下问题:
当在我的系统上运行cap deploy命令时,在服务器启动的最后一步时,我收到了Cannot find GemFile错误。
迁移未执行
我似乎也无法手动启动集群。只有一个thin实例正在启动。
更新: 以下是我要部署到的服务器上的gem env设置。通过使用cap shell并运行以下命令获取此信息:
==================================================================== 欢迎使用Capistrano交互式shell!这是一个实验性功能,可能会在未来的版本中发生变化。输入“help”以获取如何使用shell的摘要。 -------------------------------------------------------------------- cap> echo $PATH [正在连接85.255.206.157] 密码: ** [out :: 85.255.206.157] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games cap> gem env ** [out :: 85.255.206.157] RubyGems环境: ** [out :: 85.255.206.157] - RUBYGEMS版本:1.3.6 ** [out :: 85.255.206.157] - RUBY版本:1.8.7(2010-01-10修订版249)[x86_64-linux] ** [out :: 85.255.206.157] - 安装目录:/usr/lib/ruby/gems/1.8 ** [out :: 85.255.206.157] - RUBY可执行文件:/usr/bin/ruby1.8 ** [out :: 85.255.206.157] - 可执行文件目录:/usr/bin ** [out :: 85.255.206.157] - RUBYGEMS平台: ** [out :: 85.255.206.157] - ruby ** [out :: 85.255.206.157] - x86_64-linux ** [out :: 85.255.206.157] - GEM路径: ** [out :: 85.255.206.157] - /usr/lib/ruby/gems/1.8 ** [out :: 85.255.206.157] - /home/kurt/.gem/ruby/1.8 ** [out :: 85.255.206.157] - GEM配置: ** [out :: 85.255.206.157] - :update_sources => true ** [out :: 85.255.206.157] - :verbose => true ** [out :: 85.255.206.157] - :benchmark => false ** [out :: 85.255.206.157] - :backtrace => false ** [out :: 85.255.206.157] - :bulk_threshold => 1000 ** [out :: 85.255.206.157] - 远程来源: ** [out :: 85.255.206.157] - http://rubygems.org/