Commit 481e4758 authored by Kirill Smelkov's avatar Kirill Smelkov

gitlab: Set up unicorn service

Now that all gitlab Rails application configuration files are ready, we
can setup unicorn service to start it.

NOTE there is a promise to check unicorn by url which works, but there
    are also rake tasks to check gitlab itself, e.g. like

        gitlab:app:check
        gitlab:gitlab_shell:check
        gitlab:repo:check

    Unfortunately this tasks are slow to run (and gitlab:repo:check is
    very slow to run). That's why we do not put them into etc/promise/ -
    if we do - slapos reports promises time outs.

    What we do is we put them into etc/promise.slow/ so we have those
    scripts ready, but currently no one automatically checks them.

    Again, the promise to check unicorn just by accessing it by URL is
    there and is checked automatically out of the box.

NOTE2 GitLab is very slow to load. That's why it can take some time
    after unicorn starts that it's promise start to report ok. This can
    show itself as temporary instantiation errors which say promise such and
    such failed.

NOTE3 Unicorn start, but so far we did not cared to setup GitLab DB
    schema on instantiation. That's why unicorn remains not very usable
    and a lot of requests fail. We'll teach instance to setup DB and
    perform all other needed settings in the next patch.

/cc @kazuhiko, @jerome
parent 2772191c
......@@ -18,6 +18,8 @@ parts =
gitlab-work
gitlab-shell-work
service-unicorn
service-postgresql
service-redis
......@@ -77,6 +79,7 @@ srv = ${:home}/srv
startup = ${:etc}/run
service = ${:etc}/service
promise = ${:etc}/promise
promise.slow = ${:promise}.slow
# gitlab: etc/ log/ ...
[gitlab-dir]
......@@ -433,6 +436,63 @@ srv = ${unicorn-dir:srv}
log = ${unicorn-dir:log}
socket = ${:srv}/unicorn.socket
[service-unicorn]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:service}/unicorn
command-line = ${gitlab-unicorn:wrapper-path}
-E production
-c ${unicorn.rb:rendered}
${gitlab-work:location}/config.ru
depend =
${promise-unicorn:recipe}
${promise-gitlab-app:recipe}
${promise-gitlab-shell:recipe}
${logrotate-entry-unicorn:recipe}
# gitlab is a service "run" under unicorn
# gitlab-shell is called by gitlab
# -> associate their logs rotation to here
${logrotate-entry-gitlab:recipe}
[promise-unicorn]
<= promise-byurl
url = --unix-socket ${unicorn:socket} http:/
[promise-rakebase]
recipe = slapos.cookbook:wrapper
# FIXME gitlab-rake is too slow to load and promise timeouts
# that's why we instantiate to <promise>.slow/ (and this way promises are not run)
wrapper-path = !py!'${directory:promise.slow}/' + '${:_buildout_section_name_}'[8:]
rake = ${gitlab-rake:wrapper-path}
[promise-gitlab-app]
<= promise-rakebase
command-line = ${:rake} gitlab:app:check
[promise-gitlab-shell]
<= promise-rakebase
command-line = ${:rake} gitlab:gitlab_shell:check
# very slow
# rake gitlab:repo:check (fsck all repos)
[logrotate-entry-unicorn]
<= logrotate-entry
log = ${unicorn:log}/*.log
[logrotate-entry-gitlab]
<= logrotate-entry
log = ${gitlab:log}/*.log
[logrotate-entry-gitlab-shell]
<= logrotate-entry
log = ${gitlab-shell:log}/*.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