Search code examples
ruby-on-railsrubynginxunicorncapistrano3

Unicorn Restart - master failed to start, check stderr log for details


Geting error while deployment with capistrano

DEBUG [aaaad896] Command: cd /home/dev/PROJECT-NAME/current && ( export RAILS_ENV="production" ; ~/.rvm/bin/rvm default do bundle exec unicorn -c /home/dev/PROJECT-NAME/current/config/unicorn.rb -E deployment -D  )
DEBUG [aaaad896]    master failed to start, check stderr log for details
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as dev@XX.XXX.XXX.XX: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: master failed to start, check stderr log for details

Other Log.

Errno::EADDRINUSE: Address already in use - bind(2) for 0.0.0.0:8080
  /home/dev/PROEJCT-NAME/shared/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/socket_helper.rb:149:in `bind'

unicorn.rb File : unicorn.rb

deploy.rb File deploy.rb

default (nginx/site-enables/default) File : default

While restarting unicorn everytime I'm getting this error in capistrano. So how can I fix this ?


Solution

  • The problem is that you have another service listening in port 8080, that's what your log says. If you're using linux you can check which service it is using lsof -i:8080. This will tell you who is using that port. If you can kill the service, just do it, if you can't, just change the port on your config files.