简体   繁体   English

如何在生产 ruby on rails 上生成 puma.sock 文件

[英]How to generate a puma.sock file on production ruby on rails

Deployin my Ruby on Rails app on AWS EC2 with puma.在带有 puma 的 AWS EC2 上部署我的 Ruby on Rails 应用程序。 When I hit url nginx gives an error that puma.sock not exists.当我点击 url nginx 给出 puma.sock 不存在的错误。

*connect() to unix:/home/ubuntu/peatio/shared/sockets/puma.sock failed (2: No such file or directory) while connecting to upstream, client: 44.225.84.206, server: localhos

How can I generate puma.sock?如何生成 puma.sock?

config/puma.rb配置/puma.rb

threads_count = ENV.fetch("RAILS_MAX_THREADS") { 2 }
threads threads_count, threads_count
port ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { "production" }
plugin :tmp_restart
# Change to match your CPU core count
workers 1
# Min and Max threads per worker
threads 1, 6
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}/shared/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])
end

How to generate a puma.sock file?如何生成 puma.sock 文件?

Try this: cap production puma:start试试这个: cap production puma:start

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

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