This repository has been archived by the owner on Mar 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Configuration Puma
ZeroC0D3 Team edited this page Jan 19, 2018
·
5 revisions
# config/puma/staging.rb
require "active_record"
root = "/home/deploy/zeroc0d3lab.dev/current"
# Default to staging
rails_env = ENV['RAILS_ENV'] || "staging"
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 4)
environment rails_env
pidfile "#{ root }/tmp/pids/puma.pid"
stdout_redirect "#{ root }/log/puma.log"
bind "unix://#{ root }/tmp/sockets/puma-staging.socket"
state_path "#{ root }/tmp/pids/puma.state"
rackup DefaultRackup
port ENV['PORT'] || 3000
daemonize true
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads threads_count, threads_count
worker_timeout 90
# bind 'tcp://0.0.0.0:9292'
# bind 'unix:///var/run/puma.sock'
# bind 'unix:///var/run/puma.sock?umask=0111'
# bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
# ssl_bind '127.0.0.1', '9292', {
# key: path_to_key,
# cert: path_to_cert
# }
preload_app!
on_worker_boot do
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
ActiveRecord::Base.establish_connection(YAML.load_file("#{ root }/config/database.yml")[rails_env])
end
# config/puma/production.rb
require "active_record"
root = "/home/deploy/zeroc0d3lab/current"
# Default to production
rails_env = ENV['RAILS_ENV'] || "production"
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 4)
environment rails_env
pidfile "#{ root }/tmp/pids/puma.pid"
stdout_redirect "#{ root }/log/puma.log"
bind "unix://#{ root }/tmp/sockets/puma-production.socket"
state_path "#{ root }/tmp/pids/puma.state"
rackup DefaultRackup
port ENV['PORT'] || 3000
daemonize true
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads threads_count, threads_count
worker_timeout 90
# bind 'tcp://0.0.0.0:9292'
# bind 'unix:///var/run/puma.sock'
# bind 'unix:///var/run/puma.sock?umask=0111'
# bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
# ssl_bind '127.0.0.1', '9292', {
# key: path_to_key,
# cert: path_to_cert
# }
preload_app!
on_worker_boot do
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
ActiveRecord::Base.establish_connection(YAML.load_file("#{ root }/config/database.yml")[rails_env])
end
- Linux
grep -c processor /proc/cpuinfo
- OS-X
sysctl -n machdep.cpu.brand_string sysctl -a | grep machdep.cpu | grep core_count sysctl -a | grep machdep.cpu | grep thread_count
objc[1594]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.
objc[1595]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.
objc[1594]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. # We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
- Run or add into
~/.bashrc
or~/.zshrc
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
- Install gem
pry-remote
gem install pry-remote
- You can add also into
Gemfile
group :development, :test do gem 'byebug' gem 'binding_of_caller' gem 'pry-rails' gem 'pry-remote' gem 'annotate' end
- Install your bundle
bundle install
- Remove or comment on line:
#stdout_redirect "#{ root }/log/puma.log"
- Restart your puma server
bundle exec rails s puma # or bundle exec rails s puma RAILS_ENV=development
Research & Development (RnD) - ZeroC0D3 Team
- Email: zeroc0d3.team@gmail.com
- Repository: https://github.com/zeroc0d3lab
- Install-Packages
- Setup-Server
- Setup-Account
- Configuration-Bash
- Configuration-Zsh
- Install-Bash-Theme
- Install-Zsh-Theme
- Install-Docker
- Install-Memcached
- Install-MongoDB
- Install-MySQL
- Install-NodeJS
- Install-PostgreSQL
- Install-Redis
- Install-Ruby
- Install-SQLite3
- Configuration-App
- Configuration-GCM
- Configuration-Hosts
- Configuration-Fstab
- Configuration-Memcached
- Configuration-MongoDB
- Configuration-PostgreSQL
- Configuration-Puma
- Configuration-Swap
- Configuration-Unicorn
- Nginx-Puma
- Nginx-Unicorn
- Logrotate
- Deployment-Dashboard
- Deployment-Configuration
- Deployment-Process
- Deployment-Folder-Structure
- Deploy-Preinstall