Answer the question
In order to leave comments, you need to log in
Can't start unicorn. It gives an error, how to fix it?
And so, perhaps, I will tell you what actions I performed and what I came to. I look forward to your help and moral support.
1) I bought a server with centos7 installed.
2) Installed nginx, rvm, ruby, rails. created an application in /home/petrov/lessonweb/ folder
3) added unicorn and therubyracer gems, bundle install. All OK.
4) I added the unicorn.rb file and wrote the following there:
worker_processes 2
working_directory "/home/petrov/lessonweb/"
preload_app true
timeout 30
listen "/home/petrov/lessonweb/tmp/sockets/unicorn.sock", :backlog => 64
pid "/home/petrov/lessonweb/tmp/pids/unicorn.pid"
stderr_path "/home/petrov/lessonweb/log/unicorn.stderr.log"
stdout_path "/home/petrov/lessonweb/log/unicorn.stdout.log"
before_fork do |server, worker|
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
unicorn_rails -c config/unicorn.rb -E production -D
upstream lessonweb {
server unix: /home/petrov/lessonweb/tmp/sockets/unicorn.sock;
}
server {
listen 80;
server_name lesson-web www.lesson-web.ru;
location / {
root /home/petrov/lessonweb/public;
if (!-f $request_filename) {
#делаем проксипасс на первый поток "project"
proxy_pass http://lessonweb;
break;
}
}
}
unicorn_rails -c config/unicorn.rb -E production -D
master failed to start, check stderr log for details
I, [2015-10-02T13:09:20.083650 #25092] INFO -- : Refreshing Gem list
I, [2015-10-02T13:09:21.289238 #25092] INFO -- : listening on addr=/home/petrov/lessonweb/tmp/sockets/unicorn.sock fd=11
I, [2015-10-02T13:09:21.293355 #25092] INFO -- : master process ready
I, [2015-10-02T13:09:21.308838 #25095] INFO -- : worker=0 ready
I, [2015-10-02T13:09:21.313020 #25097] INFO -- : worker=1 ready
/usr/local/rvm/gems/ruby-2.2.2/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:206:in `pid=': Already running on PID:25092 (or pid=/home/petrov/lessonweb/tmp/pids/unicorn.pid is stale) (ArgumentError)
from /usr/local/rvm/gems/ruby-2.2.2/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:135:in `start'
from /usr/local/rvm/gems/ruby-2.2.2/gems/unicorn-4.9.0/bin/unicorn_rails:209:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.2/bin/unicorn_rails:23:in `load'
from /usr/local/rvm/gems/ruby-2.2.2/bin/unicorn_rails:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
Answer the question
In order to leave comments, you need to log in
So it seems that everything is written in the log. If there is no second unicorn, then just delete the remaining pid file.
This is confusing:
7) reloaded nginx, run
unicorn_rails -c config/unicorn.rb -E production -D
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question