title: bundler: failed to load command: puma - Errno::EACCES: Permission denied - connect(2)
body: <p>When I run</p>
  
  <pre><code>vagrant@localhost:/app$ /home/vagrant/.rbenv/shims/bundle exec puma -C /app/config/puma.development.rb -b unix:/var/tmp/app/sockets/puma.development.sock
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>[7159] Puma starting in cluster mode...
  [7159] * Version 3.10.0 (ruby 2.5.1-p57), codename: Russell's Teapot
  [7159] * Min threads: 5, max threads: 5
  [7159] * Environment: development
  [7159] * Process workers: 2
  [7159] * Preloading application
  [7159] * Listening on unix:/var/tmp/app/sockets/puma.development.sock
  bundler: failed to load command: puma (/home/vagrant/.rbenv/versions/2.5.1/bin/puma)
  Errno::EACCES: Permission denied - connect(2) for /var/tmp/app/sockets/puma.development.sock
  </code></pre>
  
  <p>The issue seems to be that the .sock file is not created.  Or it's created and then deleted when Puma shuts down:</p>
  
  <pre><code>vagrant@localhost:/var/tmp/app/sockets$ ls -al
  total 8
  drwxr-xr-x 2 root root 4096 Jun  1 13:27 .
  drwxr-xr-x 4 root root 4096 May 28 16:09 .. 
  </code></pre>
  
  <p>Here's my nginx site.conf:</p>
  
  <pre><code>vagrant@localhost:/var/tmp/app/sockets$ cat /etc/nginx/sites-enabled/localhost.conf
  # Ansible managed    
  
  upstream app {
    server unix:/var/tmp/app/sockets/puma.development.sock fail_timeout=0;
  }    
  
  server {
    listen 80;
    listen 443 ssl;    
  
    sendfile off;    
  
    server_name localhost;    
  
    root /app/public;    
  
    try_files $uri/index.html $uri @app;    
  
    location @app {
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_pass http://app;
    }    
  
    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;    
  
  }
  </code></pre>
  
  <p>As you might expect, the nginx logs show an error connecting upstream:</p>
  
  <pre><code>2018/06/01 14:15:54 [crit] 1941#0: *5 connect() to unix:/var/tmp/app/sockets/puma.development.sock failed (2: No such file or directory) while connecting to upstream, client: 10.0.2.2, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/var/tmp/app/sockets/puma.development.sock:/", host: "localhost:8080"
  </code></pre>
  
  <p>Here's my puma.development.rb file:</p>
  
  <pre><code># Ansible managed    
  
  # Feel free to experiment with this, 0/16 is a good starting point.
  threads_count = Integer(ENV['MAX_THREADS'] || 5)
  threads threads_count, threads_count    
  
  # Go with at least 1 per CPU core, a higher amount will usually help for fast
  # responses such as reading from a cache.
  workers Integer(ENV['WEB_CONCURRENCY'] || 2)    
  
  # Listen on a tcp port or unix socket.
  bind "unix:/var/tmp/app/sockets/puma.development.sock"    
  
  # Set Port/Rack/Env
  rackup DefaultRackup
  port 3000
  environment "development    
  
  # The path where the pid file will be written to.
  pidfile "/var/tmp/app/pids/puma.development.pid"    
  
  # Use a shorter timeout instead of the 60s default. If you are handling large
  # uploads you may want to increase this.
  worker_timeout 3    
  
  # The file that gets logged to.
  stdout_redirect "/app/log/puma.development.log", "/app/log/puma.development.err.log"    
  
  # Preload the application before starting the workers.
  preload_app!    
  
  # The path to the puma binary without any arguments, it will inherit everything
  # from the original process.
  restart_command 'bin/puma'    
  
  on_worker_boot do
    # Don't bother having the master process hang onto older connections.
    defined?(ActiveRecord::Base) and
      ActiveRecord::Base.connection.disconnect    
  
    defined?(ActiveRecord::Base) and
      ActiveRecord::Base.establish_connectio    
  
  
  end
  </code></pre>
  
  <p>Feels like I'm missing something obvious here but for the life of me I can't figure out what it is. </p>
  
  <p>Thanks in advance!</p>