diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-27 22:52:50 +0200 |
| commit | 9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch) | |
| tree | 8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /doc/unicorn.rb | |
| parent | 85a01e35274b8d4d4165a7b26bd7986e211246bb (diff) | |
| parent | 1853082fcd8c067390c246f9daa01a9b47387497 (diff) | |
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'doc/unicorn.rb')
| -rw-r--r-- | doc/unicorn.rb | 36 |
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 | |||
| 7 | stderr_path "/var/log/unicorn.stderr.log" | ||
| 8 | |||
| 9 | rails_env = ENV['RAILS_ENV'] || 'production' | ||
| 10 | |||
| 11 | worker_processes (rails_env == 'production' ? 32 : 4) | ||
| 12 | |||
| 13 | preload_app true | ||
| 14 | |||
| 15 | timeout 30 | ||
| 16 | |||
| 17 | listen "0.0.0.0:9090", tcp_nopush: false | ||
| 18 | |||
| 19 | pid "/usr/local/www/cccms/tmp/pids/unicorn.pid" | ||
| 20 | |||
| 21 | before_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 | ||
| 30 | end | ||
| 31 | |||
| 32 | after_fork do |server, worker| | ||
| 33 | ActiveRecord::Base.establish_connection | ||
| 34 | end | ||
| 35 | |||
| 36 | user 'www', 'www' | ||
