简体   繁体   English

Errno :: ENOENT:没有这样的文件或目录-home / ubuntu / GlucoMeDDC / shared / tmp / sockets / puma.sock的connect(2)

[英]Errno::ENOENT: No such file or directory - connect(2) for home/ubuntu/GlucoMeDDC/shared/tmp/sockets/puma.sock

I am deploying my rails app using Capistrano 3, and get this error from the Puma gem: 我正在使用Capistrano 3部署我的rails应用程序,并从Puma gem中得到以下错误:

bundler: failed to load command: puma (/home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/bin/puma)
Errno::ENOENT: No such file or directory - connect(2) for home/ubuntu/GlucoMeDDC/shared/tmp/sockets/puma.sock
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:367:in `initialize'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:367:in `new'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:367:in `add_unix_listener'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:141:in `block in parse'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:88:in `each'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/binder.rb:88:in `parse'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/runner.rb:144:in `load_and_bind'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/cluster.rb:397:in `run'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/launcher.rb:183:in `run'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/lib/puma/cli.rb:77:in `run'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/gems/puma-3.11.0/bin/puma:10:in `<top (required)>'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/bin/puma:22:in `load'
  /home/ubuntu/GlucoMeDDC/shared/bundle/ruby/2.4.0/bin/puma:22:in `<top (required)>'
puma stderr: Nothing written

I was looking here for an answer but none of it was helpful for me. 我在这里寻找答案,但对我没有帮助。 For example, if I do puma:config it will work, but using the DEFAULT Puma configurations, and not taken from my puma.rb file, even that I added conf pointing to it. 例如,如果我执行puma:config ,它将起作用,但是使用DEFAULT Puma配置,而不是从我的puma.rb文件中获取,即使我添加了指向它的conf。

Here is my deploy.rb: 这是我的deploy.rb:

lock '3.10.1'

set :application, 'GlucoMeDDC'
set :repo_url, 'git@github.com:user/GlucoMeDDC.git' # Edit this to match your repository
set :branch, ENV['BRANCH'] if ENV['BRANCH']
set :user, 'ubuntu'
set :deploy_to, '/home/ubuntu/GlucoMeDDC'
set :pty, true
set :linked_files, %w{config/application.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
set :keep_releases, 5
append :rvm_map_bins, 'puma', 'pumactl'
set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.4.1' # Edit this if you are using MRI Ruby

# set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"   #accept array for multi-bind
set :puma_conf, "#{current_path}/config/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_access.log"
set :puma_error_log, "#{shared_path}/log/puma_error.log"

namespace :puma do
  desc 'Create Directories for Puma Pids and Socket'
  task :make_dirs do
    on roles(:app) do
      execute "mkdir #{shared_path}/tmp/sockets -p"
      execute "mkdir #{shared_path}/tmp/pids -p"
    end
  end

  before :start, :make_dirs
end

namespace :deploy do

  desc 'Initial Deploy'
  task :initial do
    on roles(:app) do
      before 'deploy:restart', 'puma:start'
      invoke 'deploy'
    end
  end


desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      invoke! 'puma:restart'
    end
  end

  after  :finishing,    :compile_assets
  after  :finishing,    :cleanup
  after  :finishing,    :restart
end

# ps aux | grep puma    # Get puma pid
# kill -s SIGUSR2 pid   # Restart puma
# kill -s SIGTERM pid   # Stop puma

Any tips what else can I do? 还有什么提示我还能做什么?

I'm pretty sure I've encountered this before and it was a result of missing folders / bad permissions in the path raised in the error. 我敢肯定,我之前遇到过这种情况,这是由于错误引发的路径中缺少文件夹/权限错误导致的。 IE the tmp and / or sockets folders missing or inaccessable from: IE浏览器的tmp和/或sockets文件夹丢失或无法从以下位置访问:

... home/ubuntu/GlucoMeDDC/shared/tmp/sockets/puma.sock ... ...首页/ubuntu/GlucoMeDDC/shared/tmp/sockets/puma.sock ...

Double check these are being created as expected. 仔细检查是否正在按预期方式创建它们。 It looks as if they should be, although where's shared_path defined - is this definitely correct? 看起来好像应该这样,尽管在哪里定义了shared_path这绝对正确吗?

Otherwise check permissions on folders and the file to ensure they're correct. 否则,请检查文件夹和文件的权限,以确保它们是正确的。 You can run ls -la to check this, and adjust them as appropriate. 您可以运行ls -la进行检查,并进行适当调整。

Hope there's something in there that helps - keen to hear your feedback. 希望其中有所帮助-希望听听您的反馈。

That issue may caused by wrong puma_bind . 该问题可能是由于错误的puma_bind引起的。 It should be: 它应该是:

set :puma_bind, "unix:///#{shared_path}/tmp/sockets/puma.sock"

As far as I tried, there is no way to configure puma in both puma.rb and deploy.rb. 据我所试,在puma.rb和deploy.rb中都无法配置puma。 So I just did all configurations in deploy.rb and it works well. 因此,我只是在deploy.rb中进行了所有配置,并且运行良好。 Thank you all for the answers and comments. 谢谢大家的回答和评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM