Report this

What is the reason for this report?

puma.sock failed (111: Connection refused) while connecting to upstream(mina,puma,nginx,rails)

Posted on July 1, 2016
skoz

By skoz

this my error puma.sock failed (111: Connection refused) while connecting to upstream

pua.rb

#!/usr/bin/env puma

environment ENV['RAILS_ENV'] || 'production'

daemonize true

pidfile "/home/alif/www/ozinteractive/shared/tmp/pids/puma.pid"
stdout_redirect "/home/alif/www/ozinteractive/shared/tmp/log/stdout", "/home/alif/www/ozinteractive/shared/tmp/log/stderr"

threads 0, 16

bind "unix:///home/alif/www/ozinteractive/shared/tmp/sockets/puma.sock"

puma.sh

#! /bin/sh

PUMA_CONFIG_FILE=/home/alif/www/ozinteractive/current/config/puma.rb
PUMA_PID_FILE=/home/alif/www/ozinteractive/shared/tmp/pids/puma.pid
PUMA_SOCKET=/home/alif/www/ozinteractive/shared/tmp/sockets/puma.sock

# check if puma process is running
puma_is_running() {
  if [ -S $PUMA_SOCKET ] ; then
    if [ -e $PUMA_PID_FILE ] ; then
      if cat $PUMA_PID_FILE | xargs ps -p -P > /dev/null ; then
        return 0
      else
        echo "No puma process found"
      fi
    else
      echo "No puma pid file found"
    fi
  else
    echo "No puma socket found"
  fi

  return 1
}

case "$1" in
  start)
    echo "Starting puma..."
      rm -f $PUMA_SOCKET
      if [ -e $PUMA_CONFIG_FILE ] ; then
        bundle exec puma -C $PUMA_CONFIG_FILE
      else
        bundle exec puma
      fi

    echo "done"
    ;;

  stop)
    echo "Stopping puma..."
      kill -s TERM `cat $PUMA_PID_FILE`
      rm -f $PUMA_PID_FILE
      rm -f $PUMA_SOCKET

    echo "done"
    ;;

  restart)
    if puma_is_running ; then
      echo "Hot-restarting puma..."
      kill -s USR2 `cat $PUMA_PID_FILE`

      echo "Doublechecking the process restart..."
      sleep 5
      if puma_is_running ; then
        echo "done"
        exit 0
      else
        echo "Puma restart failed :/"
      fi
    fi

    echo "Trying cold reboot"
    bin/puma.sh start
    ;;

  *)
    echo "Usage: bin/puma.sh {start|stop|restart}" >&2
    ;;
esac



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Is there any solution

in my particular case, the problem was an error in my code. check the puma.error.log file

Hope this is helpful!!!

Is there any news regarding this issue?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.