我想在foreman procfile中控制unicorn进程。这是我的Procfile
web: bundle exec unicorn -c config/unicorn/local.rb -E local
thinking_sphinx: bundle exec rake ts:start
delayed_job: ./script/delayed_job start
delayed_delta: ./script/delayed_delta start
mail_receiver: ./scripts/mail_receiver_runner start
这是我的独角兽配置。
app_path = /home/deploy/apps/local.myapp.com/myapp/current
worker_processes 1
preload_app false
timeout 180
listen "#{app_path}/tmp/pids/unicorn.sock", backlog: 1024
pid "#{app_path}/tmp/pids/unicorn.pid"
working_directory app_path
stderr_path "log/unicorn.log"
stdout_path "log/unicorn.log"
当我使用cap foreman:start
启动时,它会引发这些错误:
adding listener failed addr=/home/deploy/apps/local.myapp.com/myapp/current/tmp/pids/unicorn.sock (in use)
/home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/socket_helper.rb:140:in `initialize': Address already in use - /home/deploy/apps/local.myapp.com/myapp/current/tmp/pids/unicorn.sock (Errno::EADDRINUSE)
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/socket_helper.rb:140:in `new'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/socket_helper.rb:140:in `bind_listen'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:228:in `listen'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:751:in `block in bind_new_listeners!'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:751:in `each'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:751:in `bind_new_listeners!'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:140:in `start'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn:121:in `<top (required)>'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load'
from /home/deploy/apps/local.myapp.com/myapp/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>'
它与独角兽或工头的配置问题有关吗?
答案 0 :(得分:1)
从unicorn配置中删除此行可以解决问题。
pid "#{app_path}/tmp/pids/unicorn.pid"