簡體   English   中英

獨角獸開始凍結

[英]Unicorn Freezes on Start

我正在做一些故障排除,以弄清為什么我的網站無法加載。

我正在使用Amazon OopsWorks。 我有一台運行Rails 4.2.0和Ruby 2.2.0的Amazon Linux服務器。 我正在使用Nginx和Unicorn。 我已驗證Nginx正在運行。 當我嘗試使用bundle exec unicorn -E production -c /srv/www/likeminds/current/config/unicorn.rb啟動Unicorn時,我沒有收到錯誤。 我什么也沒得到。 那是問題,什么都沒有發生。

獨角獸怎么了? 似乎一開始就凍結了。 先謝謝您的幫助。

這是我的服務器上正在運行的內容。

 2278 aws       20   0  323m  69m 4212 S  0.7  7.0   0:00.99 opsworks-agent     
    1 root      20   0 19596 1608 1292 S  0.0  0.2   0:00.55 init               
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd           
    3 root      20   0     0    0    0 S  0.0  0.0   0:00.81 ksoftirqd/0        
    5 root       0 -20     0    0    0 S  0.0  0.0   0:00.00 kworker/0:0H       
    6 root      20   0     0    0    0 S  0.0  0.0   0:00.08 kworker/u30:0      
    7 root      20   0     0    0    0 S  0.0  0.0   0:00.54 rcu_sched          
    8 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rcu_bh             
    9 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0        
   10 root       0 -20     0    0    0 S  0.0  0.0   0:00.00 khelper            
   11 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kdevtmpfs          
   12 root       0 -20     0    0    0 S  0.0  0.0   0:00.00 netns              
   13 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kworker/u30:1      
   19 root      20   0     0    0    0 S  0.0  0.0   0:00.00 xenwatch           
   20 root      20   0     0    0    0 S  0.0  0.0   0:00.00 xenbus             
   21 root      20   0     0    0    0 S  0.0  0.0   0:00.09 kworker/0:1        
  115 root       0 -20     0    0    0 S  0.0  0.0   0:00.00 writeback   

更新我的Unicorn.rb文件不起作用。 現在EC2輸出

/home/deploy/.bundler/likeminds/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:657:in `parse_rackup_file': rackup file (config.ru) not readable (ArgumentError)

這是導致Unicorn凍結的Unicorn.rb

# Set the working application directory
# working_directory "/path/to/your/app"
working_directory "/srv/www/likeminds/current/"

# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/srv/www/likeminds/shared/pids/unicorn.pid"

# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/srv/www/likeminds/shared/log/unicorn.log"
stdout_path "/srv/www/likeminds/shared/log/unicorn.log"

# Unicorn socket
listen "/srv/www/likeminds/shared/sockets/unicorn.likeminds.sock"
listen "/srv/www/likeminds/shared/sockets/unicorn.likeminds.sock"

# Number of processes
# worker_processes 4
worker_processes 2

# Time-out
timeout 30

這是一個輸出錯誤但在我的本地主機上成功運行的版本。

if ENV["RAILS_ENV"] == "development"
  worker_processes 1
else
  worker_processes 3
end

timeout 30

更新##

更改權限后,我能夠啟動Unicorn。 但是我收到錯誤。

E, [2015-05-17T00:21:47.129959 #7004] ERROR -- : reaped #<Process::Status: pid 8943 exit 1> worker=0
I, [2015-05-17T00:21:47.130085 #7004]  INFO -- : worker=0 spawning...
I, [2015-05-17T00:21:47.130878 #8953]  INFO -- : worker=2 spawned pid=8953
I, [2015-05-17T00:21:47.132421 #8953]  INFO -- : Refreshing Gem list
I, [2015-05-17T00:21:47.136806 #8955]  INFO -- : worker=0 spawned pid=8955
I, [2015-05-17T00:21:47.140432 #8955]  INFO -- : Refreshing Gem list
E, [2015-05-17T00:21:50.288644 #8950] ERROR -- : undefined local variable or method `ru' for #<LikeMinds::Apps

從命令行手動檢查應該顯示一些輸出。 例如,我看到:

I, [2015-05-16T16:36:12.487217 #63958]  INFO -- : listening on addr=0.0.0.0:8080 fd=9
I, [2015-05-16T16:36:12.487321 #63958]  INFO -- : worker=0 spawning...
I, [2015-05-16T16:36:12.488381 #63958]  INFO -- : master process ready
I, [2015-05-16T16:36:12.489353 #63959]  INFO -- : worker=0 spawned pid=63959
I, [2015-05-16T16:36:12.489799 #63959]  INFO -- : Refreshing Gem list
I, [2015-05-16T16:36:16.198329 #63959]  INFO -- : worker=0 ready

使用此方法或在unicorn.sterr.log中是否看到任何內容? 請發布您的獨角獸配置文件​​。

解決方案:看來麒麟進程無法寫入pid文件路徑。 更改權限以允許該進程的所有者進行訪問似乎已奏效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM