2012-08-09 92 views
6

部署我有一個Capistrano的TAKS這樣與Capistrano的失敗

require "bundler/capistrano" 

set :application, "cloudoc" 
set :repository, "[email protected]:luizkowalski/cloudoc.git" 

set :scm, :git 

role :web, "xx.xx.xx.xxx" 
role :app, "xx.xx.xx.xxx" 
role :db, "xx.xx.xx.xxx", :primary => true 

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true 

after "deploy:restart", "deploy:cleanup" 

set :user, "deploy" 
set :use_sudo, true 

set :deploy_to, "/home/deploy" 
set :deploy_via, :remote_cache 

role :web, "xx.xx.xx.xxx" 
role :app, "xx.xx.xx.xxx" 
role :db, "xx.xx.xx.xxx", :primary => true 

cap deploy後,這是輸出。
由於某種原因,他失敗了,我不知道爲什麼。我已經嘗試了use_sudo false和root,同樣的事情發生。

[xx.xx.xx.xxx] executing command 
    command finished in 4714ms 
    copying the cached version to /home/deploy/releases/20120809223144 
    * executing "cp -RPp /home/deploy/shared/cached-copy /home/deploy/releases/20120809223144 && (echo 61eeff328c40e104962f96bf6ffc5150bd1162e4 > /home/deploy/releases/20120809223144/REVISION)" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 604ms 
    * executing `deploy:finalize_update' 
    triggering before callbacks for `deploy:finalize_update' 
    * executing `deploy:assets:symlink' 
    * executing "rm -rf /home/deploy/releases/20120809223144/public/assets &&\\\n  mkdir -p /home/deploy/releases/20120809223144/public &&\\\n  mkdir -p /home/deploy/shared/assets &&\\\n  ln -s /home/deploy/shared/assets /home/deploy/releases/20120809223144/public/assets" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 544ms 
    * executing `bundle:install' 
    * executing "cd /home/deploy/releases/20120809223144 && bundle install --gemfile /home/deploy/releases/20120809223144/Gemfile --path /home/deploy/shared/bundle --deployment --quiet --without development test" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 1990ms 
    * executing "chmod -R g+w /home/deploy/releases/20120809223144" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 1042ms 
    * executing "rm -rf /home/deploy/releases/20120809223144/log /home/deploy/releases/20120809223144/public/system /home/deploy/releases/20120809223144/tmp/pids &&\\\n  mkdir -p /home/deploy/releases/20120809223144/public &&\\\n  mkdir -p /home/deploy/releases/20120809223144/tmp" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 534ms 
    * executing "ln -s /home/deploy/shared/system /home/deploy/releases/20120809223144/public/system" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 517ms 
    * executing "ln -s /home/deploy/shared/log /home/deploy/releases/20120809223144/log" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 519ms 
    * executing "ln -s /home/deploy/shared/pids /home/deploy/releases/20120809223144/tmp/pids" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 521ms 
    triggering after callbacks for `deploy:update_code' 
    * executing `deploy:assets:precompile' 
    * executing "cd /home/deploy/releases/20120809223144 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
** [out :: xx.xx.xx.xxx] Compiled jquery.js (2ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled jquery_ujs.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-transition.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-alert.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-modal.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-dropdown.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-scrollspy.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-tab.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-tooltip.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-popover.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-button.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-collapse.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-carousel.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap/bootstrap-typeahead.js (0ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled twitter/bootstrap.js (247ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled ios-checkboxes/ios-checkboxes.js (20642ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled ios-checkboxes.js (22403ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled rails.validations.js (418ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled best_in_place.js (327ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled autosize.js (76ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled bootstrap.js (5870ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled dashboard.js (1388ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled documents.js (896ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled home.js (377ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled sessions.js (563ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Compiled application.js (51370ms) (pid 1075) 
** [out :: xx.xx.xx.xxx] Killed 
    command finished in 68972ms 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /home/deploy/releases/20120809223144; true" 
    servers: ["xx.xx.xx.xxx"] 
    [xx.xx.xx.xxx] executing command 
    command finished in 612ms 
failed: "sh -c 'cd /home/deploy/releases/20120809223144 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" on xx.xx.xx.xxx 

有什麼想法?
如果有人需要更多的信息,請讓我知道提前

+0

也許你是內存不足?你看過'dmesg'的輸出了嗎?也許OOM殺手只是終止了你的耙子任務? – iblue 2012-08-09 22:40:54

+0

什麼是dmseg?我怎麼知道OOM是否在做這個? – 2012-08-09 22:42:07

+2

只需將ssh放入服務器並在終端中運行'dmesg'即可。它會顯示內核日誌。如果有任何關於「OOM殺手」的提法,你就跑出了內存。你也可以看看'free'來看看有多少ram。 – iblue 2012-08-09 22:44:27

回答

18


由於內核主動註銷過程時,RAM短,工藝使用多的內存。您可以使用dmesg來查看進程是否被內核殺死。這樣的消息將出現:

[ 3380.091822] Out of memory: Kill process 1075 (ruby1.9.1) score 382 or sacrifice child 

您可以激活交換空間或關閉其他進程。如果您使用的是VPS,請確保您有足夠的RAM。最簡單的解決方案 - 如果問題實際上是空閒RAM的短缺 - 只是購買更多的RAM。

1

如果您使用的是亞馬遜EC2微型實例,請嘗試刪除應用程序的舊版本,然後重新啓動服務器實例。這對我有效。 帽部署:清理 帽橡膠:重新啓動

8

我在Digital Ocean上運行我的rails應用程序。創建一個2GB交換似乎解決了這個問題。

+0

我在數字海洋也是如此,但是「創建2GB交換」意味着什麼? – Catfish 2014-08-13 04:42:11

+0

鮎魚,你可以很容易地添加一些像這樣的交換空間:「dd if =/dev/zero of =/tmp/swap.img bs = 1M count = 1024」這將在/tmp/swap.ing中創建一個空文件1G。然後,你可以調用「mkswap /tmp/swap.img」和「swapon /tmp/swap.img」 – 2014-10-02 13:37:48

0

我遇到了這個錯誤,並意識到我正在存儲我以前的所有版本。我只是使用cap deploy:cleanup,它很棒。