This repository has been archived by the owner on May 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration Unicorn
ZeroC0D3 Team edited this page Jan 19, 2018
·
1 revision
# config/unicorn/production.rb
root = "/home/deploy/KandagaCMS.dev/current"
working_directory root
Unicorn::HttpServer::START_CTX[0] = "#{ root }/bin/unicorn"
pid "#{ root }/tmp/pids/unicorn.pid"
stderr_path "#{ root }/log/unicorn.log"
stdout_path "#{ root }/log/unicorn.log"
listen "#{ root }/tmp/sockets/unicorn-staging.socket"
worker_processes 4
timeout 90
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
# If you are using Redis but not Resque, change this
if defined?(Resque)
Resque.redis.quit
Rails.logger.info('Disconnected from Redis')
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
# config/unicorn/production.rb
root = "/home/deploy/KandagaCMS/current"
working_directory root
Unicorn::HttpServer::START_CTX[0] = "#{ root }/bin/unicorn"
pid "#{ root }/tmp/pids/unicorn.pid"
stderr_path "#{ root }/log/unicorn.log"
stdout_path "#{ root }/log/unicorn.log"
listen "#{ root }/tmp/sockets/unicorn-production.socket"
worker_processes 4
timeout 90
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
# If you are using Redis but not Resque, change this
if defined?(Resque)
Resque.redis.quit
Rails.logger.info('Disconnected from Redis')
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
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
Kandaga Community Platform Applications
- Repositories: https://github.com/k4ndaga
- KandagaCMS: https://github.com/k4ndaga/KandagaCMS
- License: MIT License
- 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
- Configuration-App
- Configuration-Crontab
- Configuration-Fstab
- Configuration-GCM
- Configuration-Hosts
- Configuration-Memcached
- Configuration-VueJS
- Configuration-Puma
- Configuration-Unicorn
- Nginx-Puma
- Nginx-Unicorn
- Logrotate