【发布时间】:2015-07-28 16:31:33
【问题描述】:
我正在做一些故障排除以找出我的网站无法加载的原因。
我正在使用 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
【问题讨论】:
-
您是否看到任何独角兽进程在 top、ps 等中运行?
-
@errata 我用什么命令来查看这些信息?
-
ps或top来自终端 -
@errata 发布在顶部。独角兽似乎没有在运行。
-
你能从命令行手动运行 unicorn 看看会发生什么吗?如果无法启动,应该会出现某种可见的错误。
标签: ruby-on-rails nginx unicorn aws-opsworks