Puma: "Operation not permitted"

Created on 1 Oct 2015  路  1Comment  路  Source: puma/puma

My stack:

  • Ubuntu Vagrant box 14.04
  • Ruby 2.2 & Rails 4.2
  • Nginx
  • Puma (obviously)

I have followed this guide: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04

The issue (nginx.log):

2015/09/30 12:40:32 [crit] 10291#0: *33 connect() to
unix:///usr/share/nginx/html/projectbox/shared/sockets/puma.sock failed
(2: No such file or directory) while
connecting to upstream, client: 192.168.33.1, server: ticketbox.local,
request: "GET / HTTP/1.1", upstream:
"http://unix:///usr/share/nginx/html/projectbox/shared/sockets/puma.sock:/",
host: "192.168.33.15"
`

If I execute rails s then it runs ok with Puma (says in the header).

I have checked:

  • the nginx user is vagrant
  • the puma user is vagrant
  • I 've chowned and chmoded -R all permissions open for this user (temporarily)

Things I've witnessed:

  • no pid file is created in the shared folder
  • no socket file
  • no logs

Any ideas will be appreciated. It's my first attempt going from passenger to Puma which has become quite popular lately.

EDIT (config/puma.rb):

 # Change to match your CPU core count
workers 1

# Min and Max threads per worker
threads 1, 6

# Default to production
rails_env = ENV['RAILS_ENV'] || "development"
environment rails_env

# Set up socket location
bind "unix://usr/share/nginx/html/projectbox/shared/sockets/puma.sock"

# Logging
stdout_redirect "/usr/share/nginx/html/projectbox/shared/log/puma.stdout.log",     "/usr/share/nginx/html/projectbox/shared/log/puma.stderr.log", true

# Set master PID and state locations
pidfile "/usr/share/nginx/html/projectbox/shared/pids/puma.pid"
state_path "/usr/share/nginx/html/projectbox/shared/pids/puma.state"
activate_control_app

on_worker_boot do
  require "active_record"
  ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished

ActiveRecord::Base.establish_connection(YAML.load_file("/usr/share/nginx/html/projectbox/shared/config/database.yml")[rails_env])
 end

When I enter puma -C config/puma.rb I get the same error. I also tried with sudo puma -b unix:///var/run/puma.sock and it started fine. Then with sudo puma -b unix:///usr/share/nginx/html/projectbox/shared/sockets/puma.sock and the error re-appeared. Any ideas will be appreciated.

Most helpful comment

Looks like Puma can't store a .sock file on a Virtual Box Shared Folder
via http://stackoverflow.com/questions/16388342/unicorn-fails-to-start-on-vagrant-box-due-to-errnoeperm

>All comments

Looks like Puma can't store a .sock file on a Virtual Box Shared Folder
via http://stackoverflow.com/questions/16388342/unicorn-fails-to-start-on-vagrant-box-due-to-errnoeperm

Was this page helpful?
0 / 5 - 0 ratings