2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
# This file is used by the GDK to generate a default config/unicorn.rb file
|
|
|
|
# Note that `/home/git` will be substituted for the actual GDK root
|
|
|
|
# directory when this file is generated
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
worker_processes 2
|
2015-04-26 12:48:37 +05:30
|
|
|
timeout 60
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
listen '/home/git/gitlab.socket'
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
preload_app true
|
|
|
|
check_client_connection false
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
require_relative "/home/git/gitlab/lib/gitlab/cluster/lifecycle_events"
|
|
|
|
|
|
|
|
before_exec do |server|
|
|
|
|
# Signal application hooks that we're about to restart
|
|
|
|
Gitlab::Cluster::LifecycleEvents.do_master_restart
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
before_fork do |server, worker|
|
2018-12-13 13:39:08 +05:30
|
|
|
# Signal application hooks that we're about to fork
|
|
|
|
Gitlab::Cluster::LifecycleEvents.do_before_fork
|
|
|
|
|
|
|
|
# The following is only recommended for memory/DB-constrained
|
|
|
|
# installations. It is not needed if your system can house
|
|
|
|
# twice as many worker_processes as you have configured.
|
|
|
|
#
|
|
|
|
# This allows a new master process to incrementally
|
|
|
|
# phase out the old master process with SIGTTOU to avoid a
|
|
|
|
# thundering herd (especially in the "preload_app false" case)
|
|
|
|
# when doing a transparent upgrade. The last worker spawned
|
|
|
|
# will then kill off the old master process with a SIGQUIT.
|
|
|
|
old_pid = "#{server.config[:pid]}.oldbin"
|
|
|
|
if old_pid != server.pid
|
|
|
|
begin
|
|
|
|
sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
|
|
|
|
Process.kill(sig, File.read(old_pid).to_i)
|
|
|
|
rescue Errno::ENOENT, Errno::ESRCH
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2018-12-13 13:39:08 +05:30
|
|
|
#
|
|
|
|
# Throttle the master from forking too quickly by sleeping. Due
|
|
|
|
# to the implementation of standard Unix signal handlers, this
|
|
|
|
# helps (but does not completely) prevent identical, repeated signals
|
|
|
|
# from being lost when the receiving process is busy.
|
|
|
|
# sleep 1
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
after_fork do |server, worker|
|
2018-12-13 13:39:08 +05:30
|
|
|
# Signal application hooks of worker start
|
|
|
|
Gitlab::Cluster::LifecycleEvents.do_worker_start
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
# per-process listener ports for debugging/admin/migrations
|
|
|
|
# addr = "127.0.0.1:#{9293 + worker.nr}"
|
|
|
|
# server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|