Commit 6ddc1c30 authored by Kirill Smelkov's avatar Kirill Smelkov

gitlab: Setup gitlab-workhorse service

Gitlab-workhorse[1] is a service which offloads Ruby-on-Rails based
GitLab from long-running and slow requests. It is written in Go.

Now as we have unicorn service set up, we can setup gitlab-workhorse
service (which uses unicorn as authentication backend).

Gitlab-workhorse setup is easy - it is just one program and several
command line options to point to unicorn socket and to configure on
which unix socket gitlab-workhorse will listen itself.

NOTE we have to care that git and ruby to be on PATH when running
    gitlab-workhorse - because on e.g. git push'ing workhorse will run `git
    receive-pack` and a hook will be called which calls gitlab-shell,
    which is written in ruby.

NOTE2 promise to check whether gitlab-workhorse is alive is to ping it
    via URL to non-existent endpoint and check for proper 403 HTTP code
    returned.

[1] https://gitlab.com/gitlab-org/gitlab-workhorse

/cc @kazuhiko, @jerome
parent 5a744de7
......@@ -18,6 +18,7 @@ parts =
gitlab-work
gitlab-shell-work
service-gitlab-workhorse
service-unicorn
service-postgresql
......@@ -441,6 +442,49 @@ depend =
log = ${redis:log}/*.log
########################
# gitlab-workhorse #
########################
[gitlab-workhorse-dir]
recipe = slapos.cookbook:mkdirectory
srv = ${directory:srv}/gitlab-workhorse
[gitlab-workhorse]
srv = ${gitlab-workhorse-dir:srv}
socket = ${gitlab-workhorse:srv}/gitlab-workhorse.socket
[service-gitlab-workhorse]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:service}/gitlab-workhorse
command-line = {{ gitlab_workhorse }}
-listenNetwork unix
-listenAddr ${gitlab-workhorse:socket}
-authSocket ${unicorn:socket}
# NOTE for profiling
# -pprofListenAddr ...
# NOTE environment for:
# - git to be available on path
# - ruby to be available on path (gitlab-workhorse -> gitlab-shell -> hooks on push)
environment =
PATH={{ git_location }}/bin:{{ ruby_location }}/bin:%(PATH)s
depend =
${promise-gitlab-workhorse:recipe}
[promise-gitlab-workhorse]
<= promise-byurl
# gitlab-workhorse works on repositories. Here we only check it accepts an
# serves requests, so request is non-existent URL and expected code is 403
url = --unix-socket ${gitlab-workhorse:socket} http:/non-existent
http_code = 403
# gitlab-workhorse logs to stdout/stderr - logs are handled by slapos not us
# [logrotate-entry-gitlab-workhorse]
######################
# unicorn worker #
######################
......
......@@ -35,11 +35,14 @@ context =
raw curl_bin ${curl:location}/bin/curl
raw dcron_bin ${dcron-output:crond}
raw git ${git:location}/bin/git
raw git_location ${git:location}
raw gitlab_workhorse ${gitlab-workhorse:location}/gitlab-workhorse
raw gunzip_bin ${gzip:location}/bin/gunzip
raw gzip_bin ${gzip:location}/bin/gzip
raw logrotate_bin ${logrotate:location}/usr/sbin/logrotate
raw postgresql_location ${postgresql92:location}
raw redis_binprefix ${redis28:location}/bin
raw ruby_location ${bundler-4gitlab:ruby-location}
# config files
raw config_ru_in ${config.ru.in:target}
......
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