Puma 启动但不创建流程

Puma starts but does not create the processes

我使用以下命令尝试 运行 我的 puma 应用程序服务器

RAILS_ENV=production puma -C config/puma.rb -e production -d 

然后我发现一切都很好..

production [3111] Puma starting in cluster mode... [3111] * Version 3.12.0 (ruby 2.2.4-p230), codename: Llamas in Pajamas [3111] * Min threads: 1, max threads: 6 [3111] * Environment: production [3111] * Process workers: 2 [3111] * Phased restart available [3111] * Listening on unix:///home/joaquin/Documents/ecommerce/vaypol-ecommerce/shared/sockets/puma.sock [3111] * Daemonizing...

但实际上,如果我尝试使用 ps aux | grep puma

检查,进程永远不会启动

所以我的 config/puma.rb

# Change to match your CPU core count
workers 2

# Min and Max threads per worker
threads 1, 6

daemonize true

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

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

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

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

# 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}/config/database.yml")[rails_env])

我错过了什么?提前致谢

Puma worker 进程是从原始父进程派生出来的,它是一个 ruby 进程。

考虑测试名为 ruby 而不是 puma 的进程...即(使用您的方法):

ps aux | grep ruby

问题显然出在 puma 套接字上,我的 nginx 无法绑定它。

upstream myapp_puma {
 server unix:///home/ubuntu/vaypol-ecommerce/shared/sockets/puma.sock fail_timeout=0;
}