summaryrefslogtreecommitdiff
path: root/doc/unicorn.rb
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-26 23:07:16 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-26 23:07:16 +0200
commit1bebea4f50f73a39140be862b10f2dbf4a4da1f5 (patch)
tree00178d147b479ab056f1485a79be1b8f7ae58537 /doc/unicorn.rb
parent27729df99a8f1ccfcdcb0bc7dc31d9e816d78555 (diff)
update unicorn and rc.d docs
Diffstat (limited to 'doc/unicorn.rb')
-rw-r--r--doc/unicorn.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/unicorn.rb b/doc/unicorn.rb
new file mode 100644
index 0000000..7f51822
--- /dev/null
+++ b/doc/unicorn.rb
@@ -0,0 +1,36 @@
1# This usually is deployed to /usr/local/etc/unicorn.rb
2# and then executed from the rc.d/cccms script
3#
4#
5# unicorn -c /usr/local/etc/unicorn.rb -E production -D
6
7stderr_path "/var/log/unicorn.stderr.log"
8
9rails_env = ENV['RAILS_ENV'] || 'production'
10
11worker_processes (rails_env == 'production' ? 32 : 4)
12
13preload_app true
14
15timeout 30
16
17listen "0.0.0.0:9090", tcp_nopush: false
18
19pid "/usr/local/www/cccms/tmp/pids/unicorn.pid"
20
21before_fork do |server, worker|
22 old_pid = Rails.root.to_s + '/tmp/pids/unicorn.pid.oldbin'
23 if File.exist?(old_pid) && server.pid != old_pid
24 begin
25 Process.kill("QUIT", File.read(old_pid).to_i)
26 rescue Errno::ENOENT, Errno::ESRCH
27 # someone else did our job for us
28 end
29 end
30end
31
32after_fork do |server, worker|
33 ActiveRecord::Base.establish_connection
34end
35
36user 'www', 'www'