DesignAssembler

備忘録に近い

AWSAmazon Linuxrails+nginx+unicornの流行りの構成を乗っけようとした。

した。

I, [2015-07-11T15:47:40.571021 #18666]  INFO -- : Refreshing Gem list
F, [2015-07-11T15:47:41.619703 #18666] FATAL -- : error adding listener addr=/home/ec2-user/r_test/tmp/unicorn.sock
/usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb:152:in `bind_listen': socket=/home/ec2-user/r_test/tmp/unicorn.sock specified but it is not a socket! (ArgumentError)
        from /usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:242:in `listen'
        from /usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `block in bind_new_listeners!'
        from /usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `each'
        from /usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:813:in `bind_new_listeners!'
        from /usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:138:in `start'
        from /usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/bin/unicorn_rails:209:in `<top (required)>'
        from /usr/local/bin/unicorn_rails:23:in `load'
        from /usr/local/bin/unicorn_rails:23:in `<main>'


/usr/local/lib/ruby/gems/2.2.0/gems/unicorn-4.9.0/lib/unicorn/socket_helper.rb見てみます。

    sock = if address[0] == ?/
        if File.exist?(address)
          if File.socket?(address)
            begin
              UNIXSocket.new(address).close
              # fall through, try to bind(2) and fail with EADDRINUSE
              # (or succeed from a small race condition we can't sanely avoid).
            rescue Errno::ECONNREFUSED
              logger.info "unlinking existing socket=#{address}"
              File.unlink(address)
            end
          else
            raise ArgumentError,
                  "socket=#{address} specified but it is not a socket!"
          end
        end

if File.exist?(address)内を見ると、

          else
            raise ArgumentError,
                  "socket=#{address} specified but it is not a socket!"
          end

つまりunicorn.sockはソケットファイルと認識されていないのか。

qiita.com

unicorn.sockを削除したらいけるみたい。