Commit b4f1ccb0 authored by Kirill Smelkov's avatar Kirill Smelkov

X Unicorn starts to start

parent 845fb66b
...@@ -67,7 +67,8 @@ configuration.unicorn_worker_processes = 2 ...@@ -67,7 +67,8 @@ configuration.unicorn_worker_processes = 2
# unicorn advanced # unicorn advanced
configuration.unicorn_tcp_nopush = true #configuration.unicorn_tcp_nopush = true not used
configuration.unicorn_backlog_socket = 1024
# nginx # nginx
configuration.nginx_client_max_body_size = 250m configuration.nginx_client_max_body_size = 250m
......
...@@ -128,7 +128,9 @@ import-list = ...@@ -128,7 +128,9 @@ import-list =
rawfile macrolib.cfg.in {{ macrolib_cfg_in }} rawfile macrolib.cfg.in {{ macrolib_cfg_in }}
context = context =
raw autogenerated # This file was autogenerated. (DO NOT EDIT - changes will be lost) raw autogenerated # This file was autogenerated. (DO NOT EDIT - changes will be lost)
section instance_parameter instance-parameter
${:context-extra} ${:context-extra}
context-extra =
# TODO move common context parameters here (= common) # TODO move common context parameters here (= common)
...@@ -151,7 +153,6 @@ template= {{ gitlab_yml_in }} ...@@ -151,7 +153,6 @@ template= {{ gitlab_yml_in }}
context-extra = context-extra =
section gitlab gitlab section gitlab gitlab
section gitlab_backend gitlab-backend section gitlab_backend gitlab-backend
section instance_parameter instance-parameter
[resque.yml] [resque.yml]
<= gitlab-etc-template <= gitlab-etc-template
...@@ -162,20 +163,18 @@ context-extra = ...@@ -162,20 +163,18 @@ context-extra =
[smtp_settings.rb] [smtp_settings.rb]
<= gitlab-etc-template <= gitlab-etc-template
template= {{ smtp_settings_rb_in }} template= {{ smtp_settings_rb_in }}
context-extra =
section instance_parameter instance-parameter
[rack_attack.rb] [rack_attack.rb]
<= gitlab-etc-template <= gitlab-etc-template
template = {{ rack_attack_rb_in }} template = {{ rack_attack_rb_in }}
context-extra =
section instance_parameter instance-parameter
[unicorn.rb] [unicorn.rb]
<= gitlab-etc-template <= gitlab-etc-template
template = {{ unicorn_rb_in }} template = {{ unicorn_rb_in }}
context-extra = context-extra =
section instance_parameter instance-parameter section unicorn unicorn
section directory directory
section gitlab_root_shadow gitlab-root-shadow
[nginx-etc-template] [nginx-etc-template]
<= etc-template <= etc-template
...@@ -185,7 +184,6 @@ rendered= ${nginx:etc}/${:_buildout_section_name_} ...@@ -185,7 +184,6 @@ rendered= ${nginx:etc}/${:_buildout_section_name_}
<= nginx-etc-template <= nginx-etc-template
template= {{ nginx_conf_in }} template= {{ nginx_conf_in }}
context-extra = context-extra =
section instance_parameter instance-parameter
section gitlab_backend gitlab-backend section gitlab_backend gitlab-backend
section directory directory section directory directory
raw mime_types {{ mime_types }} raw mime_types {{ mime_types }}
...@@ -195,7 +193,6 @@ context-extra = ...@@ -195,7 +193,6 @@ context-extra =
<= nginx-etc-template <= nginx-etc-template
template= {{ nginx_gitlab_http_conf_in }} template= {{ nginx_gitlab_http_conf_in }}
context-extra = context-extra =
section instance_parameter instance-parameter
section gitlab_backend gitlab-backend section gitlab_backend gitlab-backend
section nginx nginx section nginx nginx
section gitlab_root_shadow gitlab-root-shadow section gitlab_root_shadow gitlab-root-shadow
...@@ -381,6 +378,11 @@ command-line = {{ gitlab_workhorse }} ...@@ -381,6 +378,11 @@ command-line = {{ gitlab_workhorse }}
###################### ######################
# unicorn worker # # unicorn worker #
###################### ######################
[unicorn]
recipe = slapos.cookbook:mkdirectory
srv = ${directory:srv}/unicorn
log = ${directory:log}/unicorn
[service-unicorn] [service-unicorn]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:service}/unicorn wrapper-path = ${directory:service}/unicorn
......
...@@ -3,48 +3,70 @@ ...@@ -3,48 +3,70 @@
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example.development # https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/unicorn.rb.example.development
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/unicorn.rb.erb # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/unicorn.rb.erb
# (last updated for omnibus-gitlab 8.1.0+rc1.ce.0-24-g3021ed9 XXX check) # (last updated for omnibus-gitlab 8.1.0+rc1.ce.0-77-ge349060)
# XXX import cfg {% from 'macrolib.cfg.in' import cfg with context %}
# What ports/sockets to listen on, and what options for them. # What ports/sockets to listen on, and what options for them.
listen "{XXX:unicorn-host:port}", :tcp_nopush => ${instance-parameters:configuration.unicorn_tcp_nopush} # we listen only on unix socket
listen "{{ unicorn.srv }}/unicorn.socket", :backlog => {{ cfg('unicorn_backlog_socket') }}
# TODO working_directory '{{ gitlab_root_shadow.location }}'
<%- if @working_directory %>
working_directory '<%= @working_directory %>'
<%- end %>
# What the timeout for killing busy workers is, in seconds # What the timeout for killing busy workers is, in seconds
timeout ${instance-parameters:configuration.unicorn_worker_timeout} timeout {{ cfg('unicorn_worker_timeout') }}
# Whether the app should be pre-loaded # Whether the app should be pre-loaded
preload_app true preload_app true
# How many worker processes # How many worker processes
worker_processes ${instance-parameters:configuration.unicorn_worker_processes} worker_processes {{ cfg('unicorn_worker_processes') }}
# TODO (see definitions/unicorn_service.rb) # about before_fork / after_fork - see:
# <%- if @before_fork %> # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/definitions/unicorn_service.rb
# # What to do before we fork a worker # http://bogomips.org/unicorn.git/tree/examples/unicorn.conf.rb?id=3312aca8#n75
# before_fork do |server, worker|
# <%= @before_fork %> # What to do before we fork a worker
# end before_fork do |server, worker|
# # XXX why gitlab does not enable this?
# <%- end %> # # the following is highly recomended for Rails + "preload_app true"
# <%- if @after_fork %> # # as there's no need for the master process to hold a connection
# # What to do after we fork a worker # defined?(ActiveRecord::Base) and
# after_fork do |server, worker| # ActiveRecord::Base.connection.disconnect!
# <%= @after_fork %>
# end # This allows a new master process to incrementally
# # phase out the old master process with SIGTTOU to avoid a
# <%- end %> # 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
end
end
# What to do after we fork a worker
after_fork do |server, worker|
# 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)
# XXX why gitlab does not enable this?
# # the following is *required* for Rails + "preload_app true",
# defined?(ActiveRecord::Base) and
# ActiveRecord::Base.establish_connection
end
# Where to drop a pidfile # Where to drop a pidfile
pid ${XXXunicorn:var}/unicorn.pid pid '{{ directory.run }}/unicorn.pid'
# Where stderr gets logged # Where stderr gets logged
stderr_path ${XXXunicorn:log}/unicorn_stderr.log stderr_path '{{ unicorn.log }}/unicorn_stderr.log'
# Where stdout gets logged # Where stdout gets logged
stdout_path ${XXXunicorn:log}/unicorn_stdout.log stdout_path '{{ unicorn.log }}/unicorn_stdout.log'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment