Puma - 没有这样的文件或目录 - connect(2)。不知道它从哪里得到这个位置

Puma - No such file or directory - connect(2). No idea where it's getting this location from

所以,我正在尝试使用 Capistrano 部署 Sinatra 应用程序。我已成功部署应用程序,但无法启动 Puma。当我输入应用程序的 current 目录和 运行 pumactl -F config/puma.rb start 时,出现以下错误:

ubuntu@ip-10-0-0-195:/srv/apps/cx/current$ pumactl -F config/puma.rb start
[18512] Puma starting in cluster mode...
[18512] * Version 4.3.5 (ruby 2.5.1-p57), codename: Mysterious Traveller
[18512] * Min threads: 2, max threads: 6
[18512] * Environment: staging
[18512] * Process workers: 1
[18512] * Phased restart available
No such file or directory - connect(2) for /srv/apps/cx/releases/shared/tmp/sockets/puma.sock

我不知道它在 cx/releases 目录中的查找方式或原因。我在下面附上了我的一些文件,也许有人可以告诉我我做错了什么。

Puma.rb

# Change to match your CPU core count
workers 1

# Min and Max threads per worker
threads 2, 6

app_dir = File.expand_path('../../..', __FILE__)
shared_dir = "#{app_dir}/shared"

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

# Set up socket location
bind "unix://#{shared_dir}/tmp/sockets/puma.sock"

# Logging
stdout_redirect "#{shared_dir}/logs/puma.stdout.log", "#{shared_dir}/logs/puma.stderr.log", true

daemonize

# Set master PID and state locations
pidfile "#{shared_dir}/pids/puma.pid"
state_path "#{shared_dir}/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("#{app_dir}/current/config/database.yml")[rails_env])
end

lowlevel_error_handler do |ex, env|
  Raven.capture_exception(
    ex,
    message: ex.message,
    extra: { puma: env },
    transaction: 'Puma'
  )
  # note the below is just a Rack response
  [500, {}, ['An error has occurred, and engineers have been informed. Please reload the page']]
end

Puma.service

[Unit]
Description=Connect-Puma Server
After=network.target

[Service]
Type=simple
User=ubuntu
# EnvironmentFile=/srv/apps/cx-api/current/.rbenv-vars
Environment=RAILS_ENV=staging
WorkingDirectory=/srv/apps/cx/current/
ExecStart=/usr/bin/rbenv exec bundle exec puma -C /srv/apps/cx/current/config/puma.rb
ExecStop=/usr/bin/rbenv exec bundle exec pumactl -F /srv/apps/cx/current/config/puma.rb stop
ExecReload=/usr/bin/rbenv exec bundle exec pumactl -F /srv/apps/cx/current/config/puma.rb phased-restart
TimeoutSec=15
Restart=always
KillMode=process

[Install]
WantedBy=multi-user.target

etc/nginx/sites-enabled/cx

pstream sinatra {
    server unix:/srv/apps/cx/shared/tmp/puma.sock;
}
server {
    root /srv/apps/cx/current/public;
    server_name staging.ldelivers.com;
    location / {
        try_files $uri $uri/index.html @puma;
    }
    location @puma {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://sinatra;
  }
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/staging.lmdelivers.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/staging.lmdelivers.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = staging.lmdelivers.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    listen 80;
    server_name staging.lmdelivers.com;
    return 404; # managed by Certbot
}

如您所见,我没有在任何地方调用 /releases 目录。如果有人能让我指出正确的方向,我将非常感激。

谢谢

试试这个

app_dir = File.expand_path('../../../..', __FILE__)

此外,套接字路径在一个配置文件中设置为.../tmp/puma.sock,在另一个配置文件中设置为.../tmp/sockets/puma.sock