Reputation: 1627
I am doing some troubleshooting to figure out why my site will not load.
I am using Amazon OopsWorks. I have an Amazon Linux server running Rails 4.2.0 and Ruby 2.2.0. I'm using Nginx and Unicorn. I have verified Nginx is running. When I try to start Unicorn with bundle exec unicorn -E production -c /srv/www/likeminds/current/config/unicorn.rb
I do not get an error. I do not get anything, actually. That's the problem, nothing happens.
What's going on with Unicorn? It seems like it is freezing on start. Thanks in advance for the help.
Here is what is running on my server.
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
Updating my Unicorn.rb file did not work. Now EC2 outputs
/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)
Here is the Unicorn.rb that causes Unicorn to freeze
# 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
Here is the version that outputs an error, but does run successfully on my localhost.
if ENV["RAILS_ENV"] == "development"
worker_processes 1
else
worker_processes 3
end
timeout 30
After changing permissions I was able to start Unicorn. But I am receiving errors.
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
Upvotes: 0
Views: 643
Reputation: 26962
checking manually from the command line should show you some output. for example, I see:
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
Do you see anything using this method or in unicorn.sterr.log? Please post your unicorn config file.
SOLUTION: it appears that the pid filepath was not writable by the unicorn process. Changing the permission to allow for access by the owner of the process seems to have worked.
Upvotes: 1