From 3b2f164fa609537677f0ab7e8b37a4237a81135d Mon Sep 17 00:00:00 2001 From: parzi Date: Sat, 25 Feb 2023 12:06:08 -0600 Subject: [PATCH] fixed puma.rb file --- config/puma.rb | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/config/puma.rb b/config/puma.rb index 3316d16..93b9f3c 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -5,13 +5,31 @@ # or # RAILS_ENV=development bundle exec puma -C ./config/puma.rb +#!/usr/bin/env puma + +# Define variables for the application path and environment. application_path = Rails.root -railsenv = ENV['RAILS_ENV'] || 'production' +rails_env = ENV['RAILS_ENV'] || 'production' + +# Configure the application path, environment, and daemonization. directory application_path -environment railsenv +environment rails_env daemonize true -pidfile "#{application_path}/tmp/pids/puma-#{railsenv}.pid" -state_path "#{application_path}/tmp/pids/puma-#{railsenv}.state" +# Set the location of the PID and state files. +pidfile "#{application_path}/tmp/pids/puma-#{rails_env}.pid" +state_path "#{application_path}/tmp/pids/puma-#{rails_env}.state" + +# Set the locations for standard output and error logs. +stdout_redirect "#{application_path}/log/puma-#{rails_env}.stdout.log", + "#{application_path}/log/puma-#{rails_env}.stderr.log", true + +# Set the number of threads to use. threads 0, 16 -bind "unix://#{application_path}/tmp/sockets/#{railsenv}.socket" + +# Bind to a Unix domain socket and use nginx as a reverse proxy. +bind "unix://#{application_path}/tmp/sockets/#{rails_env}.socket" +bind "tcp://127.0.0.1:8080" + +# Allow puma to be restarted by touch command. +restart_command 'touch tmp/restart.txt' \ No newline at end of file