一直在使用 Capistrano 在我的服务器和我的开发机器之间进行自动部署。我几乎已经配置好了,只是 Capistrano 似乎无法使用 bundle exec 命令启动我的服务器。我总是收到以下错误:
编辑:配置文件现在位于 /var/www/apps/current/thin.yml
... * 执行“sudo -p 'sudo 密码:' bundle exec thin start -C /var/www/thin.config.yml” 服务器:[“85.255.206.157”] [85.255.206.157] 执行命令 ** [out :: 85.255.206.157] 找不到 Gemfile 命令在 216 毫秒内完成 失败:“sh -c 'sudo -p '\\''sudo 密码:'\\'' 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 错误:服务器的启动
不执行迁移
我似乎也无法手动启动集群了。只有一个瘦实例正在启动。
更新:这是我部署到的服务器的 gem env 设置。该信息是通过使用 cap shell 然后运行以下命令获得的:
==================================================== =================== 欢迎使用交互式 Capistrano shell!这是一个实验 功能,并且可能会在未来的版本中更改。输入“帮助” 关于如何使用 shell 的总结。 -------------------------------------------------- ------------------ 帽>回声$ PATH [建立到 85.255.206.157 的连接] 密码: ** [out :: 85.255.206.157] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games 帽>宝石环境 ** [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] - 红宝石 ** [out :: 85.255.206.157] - x86_64-linux ** [out :: 85.255.206.157] - 宝石路径: ** [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/