我有一个Rails 3.1.1应用程序,我试图通过Capistrano部署。这是我第一次尝试这个,我通过大量的研究解决了几个问题,但是我已经找到了一个无法找到扩展方法的墙。
我可以运行上限部署:设置和上限部署:无事故检查。当我尝试运行cap deploy时,这就是我看到底部的内容(关于rake 0.9.2.2的分隔文本和底部的失败行)
Aaron-Johnsons-Macbook-Pro:webd2 aaronjohnsonis $ cap deploy * 执行
deploy' * executing
部署:更新'**事务: start *执行deploy:update_code' updating the cached checkout on all servers executing locally: "git ls-remote git@github.com:webdsquared/webd2.git master" command finished in 2351ms * executing "if [ -d /home/webdsqua/apps/webd2/shared/cached-copy ]; then cd /home/webdsqua/apps/webd2/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard 28e67c5f7e1ed4612dffd2ac4fb287356f51ce3b && git submodule init && for mod in
git子模块状态| awk'{print $ 2}'; do git config -f .git/config submodule.${mod}.url
git config -f .gitmodules --get 子模块。$ {mod} .url&& echo Synced $mod; done && git submodule sync && export GIT_RECURSIVE=$([ ! \"
git --version\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule update --init $GIT_RECURSIVE && git clean -d -x -f; else git clone --depth 1 git@github.com:webdsquared/webd2.git /home/webdsqua/apps/webd2/shared/cached-copy && cd /home/webdsqua/apps/webd2/shared/cached-copy && git checkout -b deploy 28e67c5f7e1ed4612dffd2ac4fb287356f51ce3b && git submodule init && git submodule sync && export GIT_RECURSIVE=$([ ! \"
git --version\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule update --init $GIT_RECURSIVE; fi" servers: ["webdsquared.com"] Password: [webdsquared.com] executing command ** [webdsquared.com :: out] HEAD is now at 28e67c5 initial commit command finished in 2428ms copying the cached version to /home/webdsqua/apps/webd2/releases/20111104183017 * executing "cp -RPp /home/webdsqua/apps/webd2/shared/cached-copy /home/webdsqua/apps/webd2/releases/20111104183017 && (echo 28e67c5f7e1ed4612dffd2ac4fb287356f51ce3b > /home/webdsqua/apps/webd2/releases/20111104183017/REVISION)" servers: ["webdsquared.com"] [webdsquared.com] executing command command finished in 2997ms * executing
deploy:finalize_update' 在deploy:finalize_update' * executing
部署的回调之前触发:资产:符号链接'*正在执行“rm -rf / home / webdsqua / apps / webd2 / releases / 20111104183017 / public / assets&amp;&amp; \\ n mkdir -p / home / webdsqua / apps / webd2 / releases / 20111104183017 / public &amp;&amp; \\ n mkdir -p / home / webdsqua / apps / webd2 / shared / assets&amp;&amp; \\ n ln -s / home / webdsqua / apps / webd2 / shared / assets /家庭/ webdsqua /应用/ webd2 /发行/ 20111104183017 /公/资产” 服务器:[“webdsquared.com”] [webdsquared.com]执行命令 命令在1104ms完成*执行“chmod -R g + w / home / webdsqua / apps / webd2 / releases / 20111104183017” 服务器:[“webdsquared.com”] [webdsquared.com]执行命令 命令在119ms完成*执行“rm -rf / home / webdsqua / apps / webd2 / releases / 20111104183017 / log /家庭/ webdsqua /应用/ webd2 /发行/ 20111104183017 /公/系统 / home / webdsqua / apps / webd2 / releases / 20111104183017 / tmp / pids&amp;&amp; \\ n
mkdir -p / home / webdsqua / apps / webd2 / releases / 20111104183017 / public &amp;&amp; \\ n mkdir -p / home / webdsqua / apps / webd2 / releases / 20111104183017 / tmp&amp;&amp; \\ n ln -s / home / webdsqua / apps / webd2 / shared / log / home / webdsqua / apps / webd2 / releases / 20111104183017 / log&amp;&amp; \\ n ln -s / home / webdsqua / apps / webd2 / shared / system / home / webdsqua / apps / webd2 / releases / 20111104183017 / public / system&amp;&amp; \\ n ln -s / home / webdsqua / apps / webd2 / shared / pids /家庭/ webdsqua /应用/ webd2 /发行/ 20111104183017的/ tmp / PID的” 服务器:[“webdsquared.com”] [webdsquared.com]执行命令 命令在3136ms完成 在deploy:update_code' * executing
部署的回调后触发:资产:预编译' * 执行“cd / home / webdsqua / apps / webd2 / releases / 20111104183017&amp;&amp;耙 RAILS_ENV =生产RAILS_GROUPS =资产资产:预编译“ 服务器:[“webdsquared.com”] [webdsquared.com]执行命令** [out :: webdsquared.com](在/ home / webdsqua / apps / webd2 / releases / 20111104183017)** [out&gt; :: webdsquared.com]在任何来源中找不到rake-0.9.2.2 命令在1108ms结束 * [deploy:update_code]回滚*执行“rm -rf / home / webdsqua / apps / webd2 / releases / 20111104183017; true” 服务器:[“webdsquared.com”] [webdsquared.com]执行命令 **命令在113ms完成失败:“sh -c'cd / home / webdsqua / apps / webd2 / releases / 20111104183017&amp;&amp; rake RAILS_ENV =生产RAILS_GROUPS =资产资产:预编译'“开启 webdsquared.com **
我的deploy.rb文件看起来像这样......
set :application, "app"
set :repository, "git@github.com:webdsquared/app.git"
set :scm, "git"
set :deploy_to, "/home/username/apps/#{application}"
set :user, "username"
set :use_sudo, false
set :deploy_via, :remote_cache
set :keep_releases, 3
set :normalize_asset_timestamps, false
set :git_enable_submodules, 1
set :branch, "master"
set :git_shallow_clone, 1
set :scm_verbose, true
role :web, "webdsquared.com"
role :app, "webdsquared.com"
role :db, "webdsquared.com", :primary => true
after "deploy", "deploy:restart"
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
Capfile看起来像这样......
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
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
任何建议都会非常感激。有没有人经历过同样的事情并找到了解决方案?
提前致谢。
答案 0 :(得分:0)
你在运行什么版本的capistrano?您是否在应用程序中使用了bundler?问题是capistrano在运行命令时没有使用bundle exec
...应该运行bundle exec rake...
而不仅仅是rake...