本文介绍了"请需要从Capistrano的配方&QUOT在此文件;在使用Capistrano的部署的Rails 3应用程序在EC2上的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在部署一个Rails 3应用程序,我们正在以下错误。请帮助解决这个问题。
$上限部署
触发负荷回调
* 2015年3月17号19点25分22秒执行'部署'
* 2015年3月17号19点25分22秒执行`部署:更新
**交易:启动
* 2015年3月17号19点25分22秒执行`部署:update_ code'
更新缓存结账的所有服务器上
本地执行:混帐LS-远程[email protected]:BoTreeConsultingTeam / IntegrityMatters.git大师
命令3579ms完成
*执行如果[-d /家庭/ Ubuntu的/ integrity_matters /共享/缓存复制];然后是CD /家庭/ Ubuntu的/ integrity_matters /共享/缓存,复制和;&安培;混帐获取-q起源和放大器;&安培;混帐取--tags -q起源和放大器;&安培; git的复位-q - 硬eb49600f7de21f4b2b1de8884f70dd5a88837f41和放大器;&安培;混帐干净-q -d -x -f;否则混帐克隆-q -b主[email protected]:BoTreeConsultingTeam / IntegrityMatters git的/家庭/ Ubuntu的/ integrity_matters /共享/缓存,复制和;&安培; CD /家庭/ Ubuntu的/ integrity_matters /共享/缓存,复制和;&安培;混帐结帐-q -b部署eb49600f7de21f4b2b1de8884f70dd5a88837f41;网络连接
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令4644ms完成
缓存的版本复制到/ home / Ubuntu的/ integrity_matters /发行/ 20150317135535
*执行CP -RPp /家庭/ Ubuntu的/ integrity_matters /共享/缓存拷贝/家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535&安培;及(回声eb49600f7de21f4b2b1de8884f70dd5a88837f41>的/ home / Ubuntu的/ integrity_matters /发行/ 20150317135535 /修订)
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令1212ms完成
* 2015年3月17号19点25分36秒执行`部署:finalize_update
回调`部署之前触发:finalize_update
* 2015年3月17号19点25分36秒执行`部署:资产:符号链接
*执行室射频/家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 /公/资产和放大器;&放大器;的mkdir -p /家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 /公共及放大器;&放大器;的mkdir -p /家庭/ Ubuntu的/ integrity_matters /共享/资产和放大器;&安培; LN -s /家庭/ Ubuntu的/ integrity_matters /共享/资产/家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 /公/资产
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令,在986ms完成
* 2015年3月17号19点25分37秒执行`包:安装
*在执行CD /家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535&安培;&安培;捆绑安装--gemfile /家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 / Gemfile中--path /家庭/ Ubuntu的/ integrity_matters /共享/包 - 部署--quiet --without开发测试
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令1302ms完成
*执行搭配chmod -R - G + W /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535&安培;&安培;室射频 - /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535 /公/系统和放大器;&安培; MKDIR - 对 - /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535 /公/&安培;&安培; LN -s - /家用/ Ubuntu的/ integrity_matters /共享/系统的/ home / Ubuntu的/ integrity_matters /发行/ 20150317135535 /公/系统及放大器;&安培;室射频 - /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535 /日志和放大器;&安培; LN -s - /家用/ Ubuntu的/ integrity_matters /共享/日志/家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 /日志和放大器;&安培;室射频 - /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535的/ tmp / PID的&放大器;&放大器;的mkdir -p - /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535的/ tmp /&安培;&安培; LN -s - /家用/ Ubuntu的/ integrity_matters /共享/ PID的/家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 / tmp目录/ PID的
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令,在982ms完成
回调`部署后触发:finalize_update
* 2015年3月17号19时25分39秒执行`部署:symlink_config
*执行LN -nfs /home/ubuntu/integrity_matters/shared/config/database.yml /home/ubuntu/integrity_matters/releases/20150317135535/config/database.yml
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令,在976ms完成
回调后,引发了`部署:update_ code'
* 2015年3月17号19时25分四十零秒执行`部署:资产:precompile
回调之前触发了`部署:资产:precompile
* 2015年3月17号19时25分四十零秒执行`部署:资产:update_asset_mtimes
*执行[-e /家庭/ Ubuntu的/ integrity_matters /共享/资产/清单*]&功放;&安培;猫的/ home / Ubuntu的/ integrity_matters /共享/资产/清单* ||回声
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令,在991ms完成
*在执行CD - /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535&安培;&安培; RAILS_ENV =生产RAILS_GROUPS =资产包的exec耙资产:precompile
服务器:52.10.245.227]
[52.10.245.227]执行命令
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/values/time_zone.rb:270:警告:循环论证的参考 - 现在
** [出:: 52.10.245.227]
** [出:: 52.10.245.227]耙中止!
** [出:: 52.10.245.227]
** [出:: 52.10.245.227]请需要从Capistrano的配方中这个文件
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:18:in '比如'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/helpers/base.rb:16:in `rvm_with_capistrano
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/helpers/_cset.rb:3:in `<顶(必填)>
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in '需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `块需要
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in '需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/base.rb:1:in `<顶(必填)>
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in '需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `块需要
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in '需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/selector.rb:1:in `<顶(必填)>
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in '需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.r
** [出:: 52.10.245.227] B:251:在'块需要
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in '需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano.rb:3:in `<顶(必填)>
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:85:in'需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:85:in`救援块要求'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:68:in`块需要
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in`每个
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in'需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler.rb:134:in'需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /home/ubuntu/integrity_matters/releases/20150317135535/config/application.rb:7:in`<顶(必填)>
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 / Rake文件:5:'需要'
** [出:: 52.10.245.227]
** [出:: 52.10.245.227] /家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535 / Rake文件:5:`<顶(必填)>
** [出:: 52.10.245.227]
** [出:: 52.10.245.227](运行任务与--trace见完整跟踪)
** [出:: 52.10.245.227]
命令2630ms完成
*** [部署:update_ code]回滚
*执行室射频/家庭/ Ubuntu的/ integrity_matters /发行/ 20150317135535;真正的
服务器:52.10.245.227]
[52.10.245.227]执行命令
命令1025ms完成
失败:rvm_path = $ HOME / .rvm $ HOME / .rvm /斌/ RVM壳默认-cCD - /家用/ Ubuntu的/ integrity_matters /发行/ 20150317135535&安培;&安培; RAILS_ENV =生产RAILS_GROUPS =资产捆绑EXEC耙资产:在52.10.245.227 precompile'
的Gemfile
创业板Capistrano的'
创业板Capistrano的-EXT
创业板RVM-Capistrano的,要求:假的
deploy.rb
规定打捆/ Capistrano的
要求RVM / Capistrano的
服务器IP_ADDRESS:网络,:应用程序,:分贝,初级:真
设置:应用程序,integrity_matters
设置:用户,Ubuntu的
ssh_options [:密钥] = [的〜/ .ssh / im_ec2_free.pem]
设置:deploy_to,/家庭/#{}用户/#{}申请
设置:deploy_via,:remote_cache
设置:use_sudo,假
设置:SCM,混帐
设置:仓库,[email protected]:BoTreeConsultingTeam / IntegrityMatters.git
设置:分公司,大师
default_run_options [:PTY] =真
ssh_options [:forward_agent] =真
后部署,部署:清理#只保留最后5发布
后部署,部署:迁移
命名空间:部署做
#参考:https://www.ruby-forum.com/topic/85305
任务:symlink_assets,:角色=> [:应用程序,:DB,:网页]做
运行LN -nfs#{shared_path} /资产#{deploy_to} /资产
结束
后部署,部署:symlink_assets
#参考:http://stackoverflow.com/a/11462003/936494
任务:冷做
交易做
更新
setup_db #replacing迁移原
开始
结束
结束
任务:setup_db,:角色=> :应用程序做
提高RuntimeError.new(DB:安装中止!),除非斯特拉努:: CLI.ui.ask(关于为'耙分贝:setup`你一定要擦拭整个数据库(任何非'是'中止) :)==是
运行CD#{}的current_path;捆绑EXEC耙分贝:设置RAILS_ENV =#{} RAILS_ENV
结束
%W [开始停止重新开始]。每做|命令|
说明#{}命令麒麟服务器
任务命令,角色:应用程序,除了:{no_release:真}做
运行/etc/init.d/unicorn_#{application}#{}命令
结束
结束
任务:setup_config,角色:应用程序做
须藤LN -nfs#{}的current_path /config/nginx.conf的/ etc / nginx的/站点启用/#{}申请
须藤LN -nfs#{}的current_path /config/unicorn_init.sh /etc/init.d/unicorn_#{application}
运行命令mkdir -p#{shared_path} /配置
把File.read(配置/ database.example.yml),#{shared_path} /config/database.yml
提出现在,在#{} shared_path编辑配置文件。
结束
后部署:设置,部署:setup_config
任务:symlink_config,角色:应用程序做
运行LN -nfs#{shared_path} /config/database.yml#{release_path} /config/database.yml
结束
后部署:finalize_update,部署:symlink_config
后部署,部署:资产:precompile
结束
Capfile
负载部署如果的respond_to?(:命名空间)#CAP2微分
#取消,如果您使用Rails的资产管道
加载部署/资产
风向['供应商/宝石/ * /菜谱/ * RB。,供应商/插件/ * /菜谱/ * RB。']每个{|。插件|负载(插件)}
负载配置/部署'#删除此行跳过加载任何默认任务
$创业板上市| grep的打捆
打捆(1.8.5,1.3.5)
打捆 - 卸载(1.0.1)
RubyGems的打捆(1.2.2)
application.rb中
要求File.expand_path('../启动,__FILE__)
要求'导轨/全部
如果定义?(捆扎机)
#如果precompile资产部署到生产环境之前,使用该行
Bundler.require(* Rails.groups(:资产=>%W(开发测试)))
#如果你希望你的资产,懒洋洋地在生产中编译,使用这条线
#Bundler.require(:默认情况下,:资产,Rails.env)
结束
模块IntegrityMatters
一流的应用与LT;导轨::应用
config.time_zone ='孟买'
config.encoding =UTF-8
config.filter_parameters + = [:密码]
config.active_support.escape_html_entities_in_json =真
config.active_record.whitelist_attributes =真
config.assets.enabled =真
config.assets.version ='1.0'
config.i18n.enforce_available_locales = FALSE
config.assets.initialize_on_ precompile = FALSE
结束
结束
解决方案
这是一个非常愚蠢的错误。我忘了添加后推的Gemfile要求:假
到宝石RVM-Capistrano的
While deploying a Rails 3 application we are getting following error. Please help to fix this issue.
$ cap deploy
triggering load callbacks
* 2015-03-17 19:25:22 executing `deploy'
* 2015-03-17 19:25:22 executing `deploy:update'
** transaction: start
* 2015-03-17 19:25:22 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote [email protected]:BoTreeConsultingTeam/IntegrityMatters.git master"
command finished in 3579ms
* executing "if [ -d /home/ubuntu/integrity_matters/shared/cached-copy ]; then cd /home/ubuntu/integrity_matters/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard eb49600f7de21f4b2b1de8884f70dd5a88837f41 && git clean -q -d -x -f; else git clone -q -b master [email protected]:BoTreeConsultingTeam/IntegrityMatters.git /home/ubuntu/integrity_matters/shared/cached-copy && cd /home/ubuntu/integrity_matters/shared/cached-copy && git checkout -q -b deploy eb49600f7de21f4b2b1de8884f70dd5a88837f41; fi"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 4644ms
copying the cached version to /home/ubuntu/integrity_matters/releases/20150317135535
* executing "cp -RPp /home/ubuntu/integrity_matters/shared/cached-copy /home/ubuntu/integrity_matters/releases/20150317135535 && (echo eb49600f7de21f4b2b1de8884f70dd5a88837f41 > /home/ubuntu/integrity_matters/releases/20150317135535/REVISION)"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 1212ms
* 2015-03-17 19:25:36 executing `deploy:finalize_update'
triggering before callbacks for `deploy:finalize_update'
* 2015-03-17 19:25:36 executing `deploy:assets:symlink'
* executing "rm -rf /home/ubuntu/integrity_matters/releases/20150317135535/public/assets && mkdir -p /home/ubuntu/integrity_matters/releases/20150317135535/public && mkdir -p /home/ubuntu/integrity_matters/shared/assets && ln -s /home/ubuntu/integrity_matters/shared/assets /home/ubuntu/integrity_matters/releases/20150317135535/public/assets"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 986ms
* 2015-03-17 19:25:37 executing `bundle:install'
* executing "cd /home/ubuntu/integrity_matters/releases/20150317135535 && bundle install --gemfile /home/ubuntu/integrity_matters/releases/20150317135535/Gemfile --path /home/ubuntu/integrity_matters/shared/bundle --deployment --quiet --without development test"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 1302ms
* executing "chmod -R -- g+w /home/ubuntu/integrity_matters/releases/20150317135535 && rm -rf -- /home/ubuntu/integrity_matters/releases/20150317135535/public/system && mkdir -p -- /home/ubuntu/integrity_matters/releases/20150317135535/public/ && ln -s -- /home/ubuntu/integrity_matters/shared/system /home/ubuntu/integrity_matters/releases/20150317135535/public/system && rm -rf -- /home/ubuntu/integrity_matters/releases/20150317135535/log && ln -s -- /home/ubuntu/integrity_matters/shared/log /home/ubuntu/integrity_matters/releases/20150317135535/log && rm -rf -- /home/ubuntu/integrity_matters/releases/20150317135535/tmp/pids && mkdir -p -- /home/ubuntu/integrity_matters/releases/20150317135535/tmp/ && ln -s -- /home/ubuntu/integrity_matters/shared/pids /home/ubuntu/integrity_matters/releases/20150317135535/tmp/pids"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 982ms
triggering after callbacks for `deploy:finalize_update'
* 2015-03-17 19:25:39 executing `deploy:symlink_config'
* executing "ln -nfs /home/ubuntu/integrity_matters/shared/config/database.yml /home/ubuntu/integrity_matters/releases/20150317135535/config/database.yml"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 976ms
triggering after callbacks for `deploy:update_code'
* 2015-03-17 19:25:40 executing `deploy:assets:precompile'
triggering before callbacks for `deploy:assets:precompile'
* 2015-03-17 19:25:40 executing `deploy:assets:update_asset_mtimes'
* executing "[ -e /home/ubuntu/integrity_matters/shared/assets/manifest* ] && cat /home/ubuntu/integrity_matters/shared/assets/manifest* || echo"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 991ms
* executing "cd -- /home/ubuntu/integrity_matters/releases/20150317135535 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] rake aborted!
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] Please require this file from within a Capistrano recipe
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:18:in `instance'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/helpers/base.rb:16:in `rvm_with_capistrano'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/helpers/_cset.rb:3:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/base.rb:1:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano/selector.rb:1:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.r
** [out :: 52.10.245.227] b:251:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/shared/bundle/ruby/2.2.0/gems/rvm-capistrano-1.5.1/lib/rvm/capistrano.rb:3:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:85:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:85:in `rescue in block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:68:in `block in require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `each'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler/runtime.rb:61:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/.rvm/gems/ruby-2.2.0/gems/bundler-1.8.5/lib/bundler.rb:134:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/releases/20150317135535/config/application.rb:7:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/releases/20150317135535/Rakefile:5:in `require'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] /home/ubuntu/integrity_matters/releases/20150317135535/Rakefile:5:in `<top (required)>'
** [out :: 52.10.245.227]
** [out :: 52.10.245.227] (See full trace by running task with --trace)
** [out :: 52.10.245.227]
command finished in 2630ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/ubuntu/integrity_matters/releases/20150317135535; true"
servers: ["52.10.245.227"]
[52.10.245.227] executing command
command finished in 1025ms
failed: "rvm_path=$HOME/.rvm $HOME/.rvm/bin/rvm-shell 'default' -c 'cd -- /home/ubuntu/integrity_matters/releases/20150317135535 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile'" on 52.10.245.227
Gemfile
gem 'capistrano'
gem 'capistrano-ext'
gem 'rvm-capistrano', require: false
deploy.rb
require "bundler/capistrano"
require "rvm/capistrano"
server "IP_ADDRESS", :web, :app, :db, primary: true
set :application, "integrity_matters"
set :user, "ubuntu"
ssh_options[:keys] = ["~/.ssh/im_ec2_free.pem"]
set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :scm, "git"
set :repository, "[email protected]:BoTreeConsultingTeam/IntegrityMatters.git"
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
after "deploy", "deploy:cleanup" # keep only the last 5 releases
after "deploy", "deploy:migrate"
namespace :deploy do
# Reference: https://www.ruby-forum.com/topic/85305
task :symlink_assets, :roles => [:app, :db, :web] do
run "ln -nfs #{shared_path}/assets #{deploy_to}/assets"
end
after "deploy", "deploy:symlink_assets"
# Reference: http://stackoverflow.com/a/11462003/936494
task :cold do
transaction do
update
setup_db #replacing migrate in original
start
end
end
task :setup_db, :roles => :app do
raise RuntimeError.new('db:setup aborted!') unless Capistrano::CLI.ui.ask("About to `rake db:setup`. Are you sure to wipe the entire database (anything other than 'yes' aborts):") == 'yes'
run "cd #{current_path}; bundle exec rake db:setup RAILS_ENV=#{rails_env}"
end
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
task :setup_config, roles: :app do
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
run "mkdir -p #{shared_path}/config"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files in #{shared_path}."
end
after "deploy:setup", "deploy:setup_config"
task :symlink_config, roles: :app do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
after "deploy:finalize_update", "deploy:symlink_config"
after "deploy", "deploy:assets:precompile"
end
Capfile
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
$ gem list | grep bundler
bundler (1.8.5, 1.3.5)
bundler-unload (1.0.1)
rubygems-bundler (1.2.2)
application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module IntegrityMatters
class Application < Rails::Application
config.time_zone = 'Mumbai'
config.encoding = "utf-8"
config.filter_parameters += [:password]
config.active_support.escape_html_entities_in_json = true
config.active_record.whitelist_attributes = true
config.assets.enabled = true
config.assets.version = '1.0'
config.i18n.enforce_available_locales = false
config.assets.initialize_on_precompile = false
end
end
解决方案
It was a very silly mistake. I forgot to push Gemfile after adding require:false
to gem rvm-capistrano
这篇关于&QUOT;请需要从Capistrano的配方&QUOT在此文件;在使用Capistrano的部署的Rails 3应用程序在EC2上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!