2013-05-21 38 views
1

我試圖從2天部署在我的vps(Ubuntu 12.04服務器(64位))使用:ruby(1.9.3 -rc1),rails,capistrano,nginx和獨角獸。錯誤 - :收穫#<進程::狀態:pid 4335退出1>工人= 0

我也關注來自Ryan Bates的railscast教程,展示瞭如何從零開始部署VPS。

實際的帽子部署︰冷命令似乎工作正常(作爲所有其他人),但當我嘗試去我的網址我倒下了「我們很抱歉,但事情發生了」=>默認的錯誤頁面軌。

在我的生產日誌,我得到:

Migrating to CreateQuestionAnswers (20130317152603) 
Migrating to CreateRegions (20130502212531) 
Migrating to AddRegionIdToSection (20130502212557) 
Migrating to CreateAnnonceImages (20130510130906) 
Migrating to AddAttachmentImageToAnnonceImages (20130510130925) 
Migrating to CreateFormations (20130510195503) 
Migrating to CreateInscriptions (20130510195627) 
Migrating to AddAttachmentImageToFormations (20130511182928) 
Migrating to AddParamsToInscription (20130514231201) 
Migrating to AddPaypalidToInscription (20130514234243) 
    (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
Connecting to database specified by database.yml 
Connecting to database specified by database.yml 
Creating scope :all. Overwriting existing method User.all. 
Creating scope :all. Overwriting existing method User.all. 
Creating scope :all. Overwriting existing method Echange.all. 
Creating scope :all. Overwriting existing method Echange.all. 
Creating scope :validate. Overwriting existing method Annonce.validate. 
Creating scope :validate. Overwriting existing method Annonce.validate. 
Creating scope :all. Overwriting existing method Article.all. 
Creating scope :all. Overwriting existing method Article.all. 

所以,我看着我的麒麟日誌,我發現這一點:

E, [2013-05-21T03:20:08.751341 #31081] ERROR -- : reaped #<Process::Status: pid 4335 exit   1> worker=0 
I, [2013-05-21T03:20:08.753997 #31081] INFO -- : worker=0 spawning... 
E, [2013-05-21T03:20:08.790666 #31081] ERROR -- : reaped #<Process::Status: pid 4332 exit 1> worker=1 
I, [2013-05-21T03:20:08.791251 #31081] INFO -- : worker=1 spawning... 
I, [2013-05-21T03:20:08.794600 #4341] INFO -- : worker=0 spawned pid=4341 
I, [2013-05-21T03:20:08.796302 #4341] INFO -- : Refreshing Gem list 
I, [2013-05-21T03:20:08.802089 #4344] INFO -- : worker=1 spawned pid=4344 
I, [2013-05-21T03:20:08.803227 #4344] INFO -- : Refreshing Gem list 
I, [2013-05-21T03:20:37.871677 #31081] INFO -- : reloading config_file=/home/deployer/apps/avocat-immo/current/config/unicorn.rb 
I, [2013-05-21T03:20:37.876045 #31081] INFO -- : done reloading config_file=/home/deployer/apps/avocat-immo/current/config/unicorn.rb 
I, [2013-05-21T03:20:38.002451 #31081] INFO -- : reaped #<Process::Status: pid 4344 exit 0> worker=1 
I, [2013-05-21T03:20:38.002640 #31081] INFO -- : worker=1 spawning... 
I, [2013-05-21T03:20:38.007280 #4674] INFO -- : worker=1 spawned pid=4674 
I, [2013-05-21T03:20:38.007595 #4674] INFO -- : Refreshing Gem list 
I, [2013-05-21T03:20:38.010511 #31081] INFO -- : reaped #<Process::Status: pid 4341 exit 0> worker=0 
I, [2013-05-21T03:20:38.010714 #31081] INFO -- : worker=0 spawning... 
I, [2013-05-21T03:20:38.012600 #4678] INFO -- : worker=0 spawned pid=4678 
I, [2013-05-21T03:20:38.012886 #4678] INFO -- : Refreshing Gem list 
I, [2013-05-21T03:21:08.079364 #4678] INFO -- : worker=0 ready 
I, [2013-05-21T03:21:08.080779 #4674] INFO -- : worker=1 ready 
I, [2013-05-21T03:21:46.897404 #31081] INFO -- : reloading config_file=/home/deployer/apps/avocat-immo/current/config/unicorn.rb 
I, [2013-05-21T03:21:46.900599 #31081] INFO -- : done reloading config_file=/home/deployer/apps/avocat-immo/current/config/unicorn.rb 
I, [2013-05-21T03:21:47.237973 #31081] INFO -- : reaped #<Process::Status: pid 4678 exit 0> worker=0 
I, [2013-05-21T03:21:47.238160 #31081] INFO -- : worker=0 spawning... 
I, [2013-05-21T03:21:47.241018 #31081] INFO -- : reaped #<Process::Status: pid 4674 exit 0> worker=1 
I, [2013-05-21T03:21:47.241296 #31081] INFO -- : worker=1 spawning... 
I, [2013-05-21T03:21:47.243055 #4919] INFO -- : worker=0 spawned pid=4919 
I, [2013-05-21T03:21:47.243287 #4919] INFO -- : Refreshing Gem list 
I, [2013-05-21T03:21:47.245830 #4921] INFO -- : worker=1 spawned pid=4921 
I, [2013-05-21T03:21:47.246122 #4921] INFO -- : Refreshing Gem list 
I, [2013-05-21T03:22:17.055549 #4919] INFO -- : worker=0 ready 
I, [2013-05-21T03:22:17.057331 #4921] INFO -- : worker=1 ready 
I, [2013-05-21T03:29:57.149534 #31081] INFO -- : reloading config_file=/home/deployer/apps/avocat-immo/current/config/unicorn.rb 
I, [2013-05-21T03:29:57.181644 #31081] INFO -- : done reloading config_file=/home/deployer/apps/avocat-immo/current/config/unicorn.rb 
I, [2013-05-21T03:29:57.997267 #31081] INFO -- : reaped #<Process::Status: pid 4919 exit 0> worker=0 
I, [2013-05-21T03:29:57.997689 #31081] INFO -- : worker=0 spawning... 
I, [2013-05-21T03:29:58.003458 #31081] INFO -- : reaped #<Process::Status: pid 4921 exit 0> worker=1 
I, [2013-05-21T03:29:58.003691 #31081] INFO -- : worker=1 spawning... 
I, [2013-05-21T03:29:58.010269 #7783] INFO -- : worker=0 spawned pid=7783 

一遍又一遍......

因此,這裏是我的配置:

my unicorn.rb:

root = "/home/deployer/apps/avocat-immo/current" 
working_directory root 
pid "#{root}/tmp/pids/unicorn.pid" 
stderr_path "#{root}/log/unicorn.log" 
stdout_path "#{root}/log/unicorn.log" 
listen "/tmp/unicorn.avocat.sock" 
worker_processes 2 
timeout 30 

這裏是我的unicorn_init.sh

#!/bin/sh 
set -e 

# Feel free to change any of the following variables for your app: 
TIMEOUT=${TIMEOUT-60} 
APP_ROOT=/home/deployer/apps/avocat-immo/current 
PID=$APP_ROOT/tmp/pids/unicorn.pid 
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production" 
AS_USER=deployer 
set -u 

OLD_PIN="$PID.oldbin" 

sig() { 
    test -s "$PID" && kill -$1 `cat $PID` 
} 

oldsig() { 
    test -s $OLD_PIN && kill -$1 `cat $OLD_PIN` 
} 

run() { 
    if [ "$(id -un)" = "$AS_USER" ]; then 
    eval $1 
    else 
    su -c "$1" - $AS_USER 
    fi 
} 

case "$1" in 
start) 
    sig 0 && echo >&2 "Already running" && exit 0 
    run "$CMD" 
    ;; 
stop) 
    sig QUIT && exit 0 
    echo >&2 "Not running" 
    ;; 
force-stop) 
    sig TERM && exit 0 
    echo >&2 "Not running" 
    ;; 
restart|reload) 
    sig HUP && echo reloaded OK && exit 0 
    echo >&2 "Couldn't reload, starting '$CMD' instead" 
    run "$CMD" 
    ;; 
upgrade) 
    if sig USR2 && sleep 2 && sig 0 && oldsig QUIT 
    then 
n=$TIMEOUT 
    while test -s $OLD_PIN && test $n -ge 0 
    do 
     printf '.' && sleep 1 && n=$(($n - 1)) 
    done 
    echo 

    if test $n -lt 0 && test -s $OLD_PIN 
    then 
     echo >&2 "$OLD_PIN still exists after $TIMEOUT seconds" 
     exit 1 
    fi 
    exit 0 
    fi 
    echo >&2 "Couldn't upgrade, starting '$CMD' instead" 
    run "$CMD" 
    ;; 
reopen-logs) 
    sig USR1 
    ;; 
*) 
    echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>" 
    exit 1 
    ;; 
esac 

我已經試過

/etc/init.d/unicorn_avocat-immo start 
/etc/init.d/unicorn_avocat-immo stop 

我也nginx的重新啓動,但似乎沒有任何工作。該網站在錯誤頁面上載入的時間不到一秒,網站尚未正常工作,因爲它應該在製作中。

任何人都可以幫助我解決這個問題嗎?

在nginx的errors.log發現

附加信息

2013/05/21 12:23:08 [crit] 19097#0: *16 connect() to unix:/tmp/avocat.sock failed (2: No such file or directory) while connecting to upstream, client: **.***.**.***, server: , request: "GET/HTTP/1.1", upstream: "http://unix:/tmp/avocat.sock:/", host: "**.***.**.***" 

回答

2

只是在設定中新增config.log_level = :debug/production.rb

你會得到錯誤日誌中記錄的是/ production.log 粘貼輸出日誌,所以我可以幫你

也嘗試rake assets:precompile

+0

嗨,我已經嘗試了你所說的話。結果是在我編輯的主要帖子裏。似乎問題出現之前,軌甚至加載本身... – C404

+0

在配置 - >聆聽「/tmp/unicorn.avocat.sock」和nginx unix:/tmp/avocat.sock – Strik3r

+0

還檢查文件是否存在或不存在,如果存在然後刪除它並嘗試再次部署它。 – Strik3r

相關問題