Merge branch 'workhorse_env' into 'master'

Add an option to set env variables for gitlab-workhorse.

Fixes #968

See merge request !613
This commit is contained in:
Marin Jankovski 2016-01-21 11:56:39 +00:00
commit 79b807649d
4 changed files with 30 additions and 14 deletions

View File

@ -313,6 +313,9 @@ external_url 'GENERATED_EXTERNAL_URL'
# gitlab_workhorse['dir'] = "/var/opt/gitlab/gitlab-workhorse"
# gitlab_workhorse['log_dir'] = "/var/log/gitlab/gitlab-workhorse"
# gitlab_workhorse['proxy_headers_timeout'] = "1m0s"
# gitlab_workhorse['env'] = {
# 'PATH' => "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/bin:/usr/bin"
# }
###############
# GitLab user #

View File

@ -381,6 +381,9 @@ default['gitlab']['gitlab-workhorse']['pprof_listen_addr'] = "''" # put an empty
default['gitlab']['gitlab-workhorse']['dir'] = "/var/opt/gitlab/gitlab-workhorse"
default['gitlab']['gitlab-workhorse']['log_dir'] = "/var/log/gitlab/gitlab-workhorse"
default['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] = nil
default['gitlab']['gitlab-workhorse']['env'] = {
'PATH' => "#{node['package']['install-dir']}/bin:#{node['package']['install-dir']}/embedded/bin:/bin:/usr/bin"
}
####
# mailroom

View File

@ -18,6 +18,7 @@ account_helper = AccountHelper.new(node)
working_dir = node['gitlab']['gitlab-workhorse']['dir']
log_dir = node['gitlab']['gitlab-workhorse']['log_dir']
gitlab_workhorse_static_etc_dir = "/opt/gitlab/etc/gitlab-workhorse"
directory working_dir do
owner account_helper.gitlab_user
@ -32,6 +33,17 @@ directory log_dir do
recursive true
end
directory gitlab_workhorse_static_etc_dir do
owner account_helper.gitlab_user
mode '0700'
recursive true
end
env_dir File.join(gitlab_workhorse_static_etc_dir, 'env') do
variables node['gitlab']['gitlab-workhorse']['env']
restarts ["service[gitlab-workhorse]"]
end
runit_service 'gitlab-workhorse' do
down node['gitlab']['gitlab-workhorse']['ha']
options({

View File

@ -8,19 +8,17 @@ exec 2>&1
cd <%= node['gitlab']['gitlab-workhorse']['dir'] %>
exec chpst -P \
exec chpst -e /opt/gitlab/etc/gitlab-workhorse/env -P \
-U <%= node['gitlab']['user']['username'] %> \
-u <%= node['gitlab']['user']['username'] %> \
/usr/bin/env \
PATH=/opt/gitlab/bin:/opt/gitlab/embedded/bin:/usr/local/bin:/usr/bin:/bin \
/opt/gitlab/embedded/bin/gitlab-workhorse \
-listenNetwork <%= node['gitlab']['gitlab-workhorse']['listen_network'] %> \
-listenUmask <%= node['gitlab']['gitlab-workhorse']['listen_umask'] %> \
-listenAddr <%= node['gitlab']['gitlab-workhorse']['listen_addr'] %> \
-authBackend <%= node['gitlab']['gitlab-workhorse']['auth_backend'] %> \
-authSocket <%= node['gitlab']['gitlab-workhorse']['auth_socket'] %> \
-documentRoot /opt/gitlab/embedded/service/gitlab-rails/public \
-pprofListenAddr <%= node['gitlab']['gitlab-workhorse']['pprof_listen_addr'] %>\
<% if node['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] %>
-proxyHeadersTimeout <%= node['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] %>
<% end %>
/opt/gitlab/embedded/bin/gitlab-workhorse \
-listenNetwork <%= node['gitlab']['gitlab-workhorse']['listen_network'] %> \
-listenUmask <%= node['gitlab']['gitlab-workhorse']['listen_umask'] %> \
-listenAddr <%= node['gitlab']['gitlab-workhorse']['listen_addr'] %> \
-authBackend <%= node['gitlab']['gitlab-workhorse']['auth_backend'] %> \
-authSocket <%= node['gitlab']['gitlab-workhorse']['auth_socket'] %> \
-documentRoot /opt/gitlab/embedded/service/gitlab-rails/public \
-pprofListenAddr <%= node['gitlab']['gitlab-workhorse']['pprof_listen_addr'] %>\
<% if node['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] %>
-proxyHeadersTimeout <%= node['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] %>
<% end %>