added unicorn support
This commit is contained in:
parent
3b8ce3bd6d
commit
8c29d9fb55
4 changed files with 70 additions and 25 deletions
50
.gitignore
vendored
50
.gitignore
vendored
|
@ -4,49 +4,51 @@
|
||||||
# or operating system, you probably want to add a global ignore instead:
|
# or operating system, you probably want to add a global ignore instead:
|
||||||
# git config --global core.excludesfile ~/.gitignore_global
|
# git config --global core.excludesfile ~/.gitignore_global
|
||||||
|
|
||||||
|
# Ignore .swp files
|
||||||
|
.*.swp
|
||||||
|
|
||||||
# Ignore bundler config
|
# Ignore bundler config
|
||||||
/.bundle
|
/.bundle
|
||||||
|
|
||||||
|
# Ignore mac stuff
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Ignore Rubymine config
|
||||||
|
/.idea
|
||||||
|
|
||||||
|
# Ignore .project files
|
||||||
|
/.project
|
||||||
|
|
||||||
|
# Ignore .rbenv-vars
|
||||||
|
/.rbenv-vars
|
||||||
|
|
||||||
# Ignore database config
|
# Ignore database config
|
||||||
/config/database.yml
|
/config/database.yml
|
||||||
|
|
||||||
|
# Ignore coverage stuff
|
||||||
|
/coverage
|
||||||
|
|
||||||
# Ignore the default SQLite database.
|
# Ignore the default SQLite database.
|
||||||
/db/*.sqlite3
|
/db/*.sqlite3
|
||||||
|
|
||||||
# Ignore local changes to schema.rb (e. g. through extentions)
|
# Ignore local changes to schema.rb (e. g. through extentions)
|
||||||
/db/schema.rb
|
/db/schema.rb
|
||||||
|
|
||||||
|
# Ignore custom gem file
|
||||||
|
/Gemfile.local
|
||||||
|
|
||||||
|
# Ignore node modules
|
||||||
|
/node_modules
|
||||||
|
|
||||||
# Ignore all logfiles and tempfiles.
|
# Ignore all logfiles and tempfiles.
|
||||||
/log
|
/log
|
||||||
/tmp/*
|
|
||||||
/tmp/pids/*
|
|
||||||
/public/assets/*.*
|
/public/assets/*.*
|
||||||
/public/assets/app
|
/public/assets/app
|
||||||
/public/assets/custom
|
/public/assets/custom
|
||||||
|
/tmp/*
|
||||||
|
/tmp/pids/*
|
||||||
|
|
||||||
# except /tmp/pids/ which is needed for certain Zammad processes
|
# except /tmp/pids/ which is needed for certain Zammad processes
|
||||||
!/tmp
|
!/tmp
|
||||||
!/tmp/pids
|
!/tmp/pids
|
||||||
!/tmp/pids/.keep
|
!/tmp/pids/.keep
|
||||||
|
|
||||||
# Ignore custom gem file
|
|
||||||
/Gemfile.local
|
|
||||||
|
|
||||||
# Ignore .project files
|
|
||||||
/.project
|
|
||||||
|
|
||||||
# Ignore local database settings
|
|
||||||
/config/database.yml
|
|
||||||
|
|
||||||
# Ignore mac stuff
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Ignore .swp files
|
|
||||||
.*.swp
|
|
||||||
|
|
||||||
# Ignore coverage stuff
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# Ignore Rubymine config
|
|
||||||
/.idea
|
|
||||||
node_modules
|
|
||||||
|
|
4
Gemfile
4
Gemfile
|
@ -113,7 +113,9 @@ group :development, :test do
|
||||||
gem 'github_changelog_generator'
|
gem 'github_changelog_generator'
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'puma'
|
gem 'puma', group: :puma
|
||||||
|
gem 'unicorn', group: :unicorn
|
||||||
|
|
||||||
|
|
||||||
# load onw gem's
|
# load onw gem's
|
||||||
local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
|
local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
|
||||||
|
|
|
@ -152,6 +152,7 @@ GEM
|
||||||
inflection (1.0.0)
|
inflection (1.0.0)
|
||||||
json (1.8.3)
|
json (1.8.3)
|
||||||
jwt (1.5.4)
|
jwt (1.5.4)
|
||||||
|
kgio (2.11.0)
|
||||||
koala (2.4.0)
|
koala (2.4.0)
|
||||||
addressable
|
addressable
|
||||||
faraday
|
faraday
|
||||||
|
@ -271,6 +272,7 @@ GEM
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (2.1.0)
|
rainbow (2.1.0)
|
||||||
|
raindrops (0.17.0)
|
||||||
rake (11.2.2)
|
rake (11.2.2)
|
||||||
rb-fsevent (0.9.7)
|
rb-fsevent (0.9.7)
|
||||||
rb-inotify (0.9.7)
|
rb-inotify (0.9.7)
|
||||||
|
@ -371,6 +373,9 @@ GEM
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.7.2)
|
unf_ext (0.0.7.2)
|
||||||
unicode-display_width (1.1.1)
|
unicode-display_width (1.1.1)
|
||||||
|
unicorn (5.2.0)
|
||||||
|
kgio (~> 2.6)
|
||||||
|
raindrops (~> 0.7)
|
||||||
websocket (1.2.3)
|
websocket (1.2.3)
|
||||||
writeexcel (1.0.5)
|
writeexcel (1.0.5)
|
||||||
zendesk_api (1.14.0)
|
zendesk_api (1.14.0)
|
||||||
|
@ -447,6 +452,7 @@ DEPENDENCIES
|
||||||
therubyracer
|
therubyracer
|
||||||
twitter
|
twitter
|
||||||
uglifier
|
uglifier
|
||||||
|
unicorn
|
||||||
writeexcel
|
writeexcel
|
||||||
zendesk_api
|
zendesk_api
|
||||||
|
|
||||||
|
|
35
config/unicorn.rb
Normal file
35
config/unicorn.rb
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
APP_DIR="."
|
||||||
|
UNICORN_DIR="#{APP_DIR}"
|
||||||
|
UNICORN_WORKER="4"
|
||||||
|
UNICORN_TIMEOUT="30"
|
||||||
|
RAILS_PID_DIR="#{APP_DIR}/tmp/pids"
|
||||||
|
RAILS_LOG_DIR="#{APP_DIR}/log"
|
||||||
|
|
||||||
|
worker_processes UNICORN_WORKER.to_i
|
||||||
|
working_directory UNICORN_DIR
|
||||||
|
timeout UNICORN_TIMEOUT.to_i
|
||||||
|
pid "#{RAILS_PID_DIR}/unicorn.pid"
|
||||||
|
stderr_path "#{RAILS_LOG_DIR}/unicorn_error.log"
|
||||||
|
stdout_path "#{RAILS_LOG_DIR}/unicorn_access.log"
|
||||||
|
|
||||||
|
before_fork do |server, worker|
|
||||||
|
##
|
||||||
|
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
|
||||||
|
# immediately start loading up a new version of itself (loaded with a new
|
||||||
|
# version of our app). When this new Unicorn is completely loaded
|
||||||
|
# it will begin spawning workers. The first worker spawned will check to
|
||||||
|
# see if an .oldbin pidfile exists. If so, this means we've just booted up
|
||||||
|
# a new Unicorn and need to tell the old one that it can now die. To do so
|
||||||
|
# we send it a QUIT.
|
||||||
|
#
|
||||||
|
# Using this method we get 0 downtime deploys.
|
||||||
|
|
||||||
|
old_pid = "#{RAILS_PID_DIR}/unicorn.pid.oldbin"
|
||||||
|
if File.exists?(old_pid) && server.pid != old_pid
|
||||||
|
begin
|
||||||
|
Process.kill("QUIT", File.read(old_pid).to_i)
|
||||||
|
rescue Errno::ENOENT, Errno::ESRCH
|
||||||
|
# someone else did our job for us
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue