지정된 사용자/그룹에서 어떻게 퓨마를 시작할 수 있나요?

지정된 사용자/그룹에서 어떻게 퓨마를 시작할 수 있나요?

저는 CentOS에서 Rails 5와 Puma 3 게임을 사용하고 있습니다. puma가 시작될 때 실행되는 사용자와 그룹을 지정하는 것이 가능합니까(그리고 어떻게?)? 적절한 사용자/그룹으로 시작해야 nginx 서버가 연결되어 다음 문제를 피할 수 있습니다.

2018/02/26 16:06:47 [crit] 11984#0: *1 connect() to unix:///home/rails/myproject/shared/sockets/puma.sock failed (13: Permission denied) while connecting to upstream, client: 50.244.40.27, server: server_ip, request: "GET / HTTP/1.1", upstream: "http://unix:///home/rails/myproject/shared/sockets/puma.sock:/", host: "server_ip"

지금 오류가 발생하고 있습니다. 이렇게 퓨마 서버를 시작하겠습니다

[rails@server myproject]$ puma -C config/puma.rb -e production -d

아래는 내 config/puma.rb 파일입니다.

[rails@server myproject]$ cat config/puma.rb
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count

# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port        ENV.fetch("PORT") { 3000 }

# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers ENV.fetch("WEB_CONCURRENCY") { 4 }

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

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!

# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot share connections between processes.
#
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])
end

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

관련 정보