Joaquin Diaz
Joaquin Diaz

Reputation: 175

Puma starts but does not create the processes

I try run my puma application server with the following command

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

and then i see that everthing is going fine..

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...

but at real the processes never startup if i try to check with ps aux | grep puma


so my 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])

What i missing up? Thanks at advance

Upvotes: 0

Views: 905

Answers (3)

chinacheng
chinacheng

Reputation: 211

please be sure that these fold in shared , "log \ pids \ sockets", who will be used by puma. if these fold is not found, please mkdir to create them

Upvotes: 0

Joaquin Diaz
Joaquin Diaz

Reputation: 175

The problem apparently was with the puma socket, my nginx was not be able to bind it.

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

Upvotes: 0

Myst
Myst

Reputation: 19221

Puma worker processes are forked from the original, parent, process, which is a ruby process.

Consider testing for processes named ruby rather than puma... i.e. (using your approach):

ps aux | grep ruby

Upvotes: 0

Related Questions