Merge branch 'gitlab-workhorse' into 'master'

Replace gitlab-git-http-server with gitlab-workhorse

This MR keeps backwards compatibility in gitlab.rb.

See merge request !528
This commit is contained in:
Marin Jankovski 2015-11-13 10:16:09 +00:00
commit 47afb19142
13 changed files with 79 additions and 60 deletions

View File

@ -69,7 +69,7 @@ dependency "nodejs"
dependency "gitlab-ci"
dependency "gitlab-rails"
dependency "gitlab-shell"
dependency "gitlab-git-http-server"
dependency "gitlab-workhorse"
dependency "gitlab-ctl"
dependency "gitlab-cookbooks"
dependency "gitlab-selinux"

View File

@ -15,10 +15,10 @@
# limitations under the License.
#
name "gitlab-git-http-server"
default_version "bf2a3cedd9b631939330d2e54241f95a7b478763" # 0.3.0
name "gitlab-workhorse"
default_version "5e28545e0441d02ae2734553bce17353ebf43b26" # 0.4.0
source :git => "https://gitlab.com/gitlab-org/gitlab-git-http-server.git"
source :git => "https://gitlab.com/gitlab-org/gitlab-workhorse.git"
build do
make "install PREFIX=#{install_dir}/embedded"

View File

@ -351,18 +351,18 @@ default['gitlab']['web-server']['home'] = '/var/opt/gitlab/nginx'
default['gitlab']['web-server']['external_users'] = []
####
# gitlab-git-http-server
# gitlab-workhorse
####
default['gitlab']['gitlab-git-http-server']['enable'] = true
default['gitlab']['gitlab-git-http-server']['ha'] = false
default['gitlab']['gitlab-git-http-server']['listen_network'] = "unix"
default['gitlab']['gitlab-git-http-server']['listen_umask'] = 000
default['gitlab']['gitlab-git-http-server']['listen_addr'] = "/var/opt/gitlab/gitlab-git-http-server/socket"
default['gitlab']['gitlab-git-http-server']['auth_backend'] = "http://localhost:8080"
default['gitlab']['gitlab-git-http-server']['pprof_listen_addr'] = "''" # put an empty string on the command line
default['gitlab']['gitlab-git-http-server']['dir'] = "/var/opt/gitlab/gitlab-git-http-server"
default['gitlab']['gitlab-git-http-server']['log_dir'] = "/var/log/gitlab/gitlab-git-http-server"
default['gitlab']['gitlab-workhorse']['enable'] = true
default['gitlab']['gitlab-workhorse']['ha'] = false
default['gitlab']['gitlab-workhorse']['listen_network'] = "unix"
default['gitlab']['gitlab-workhorse']['listen_umask'] = 000
default['gitlab']['gitlab-workhorse']['listen_addr'] = "/var/opt/gitlab/gitlab-workhorse/socket"
default['gitlab']['gitlab-workhorse']['auth_backend'] = "http://localhost:8080"
default['gitlab']['gitlab-workhorse']['pprof_listen_addr'] = "''" # put an empty string on the command line
default['gitlab']['gitlab-workhorse']['dir'] = "/var/opt/gitlab/gitlab-workhorse"
default['gitlab']['gitlab-workhorse']['log_dir'] = "/var/log/gitlab/gitlab-workhorse"
####
# Nginx

View File

@ -48,7 +48,8 @@ module Gitlab
ci_unicorn Mash.new
sidekiq Mash.new
ci_sidekiq Mash.new
gitlab_git_http_server Mash.new
gitlab_workhorse Mash.new
gitlab_git_http_server Mash.new # legacy from GitLab 7.14, 8.0, 8.1
nginx Mash.new
ci_nginx Mash.new
mattermost_nginx Mash.new
@ -95,6 +96,18 @@ module Gitlab
SecretsHelper.write_to_gitlab_secrets
end
def parse_gitlab_git_http_server
Gitlab['gitlab_git_http_server'].each do |k, v|
Chef::Log.warn "gitlab_git_http_server is deprecated. Please use gitlab_workhorse in gitlab.rb"
if Gitlab['gitlab_workhorse'][k].nil?
Chef::Log.warn "applying legacy setting gitlab_git_http_server[#{k.inspect}]"
Gitlab['gitlab_workhorse'][k] = v
else
Chef::Log.warn "ignoring legacy setting gitlab_git_http_server[#{k.inspect}]"
end
end
end
def parse_external_url
return unless external_url
@ -160,7 +173,7 @@ module Gitlab
ci-unicorn
postgresql
remote-syslog
gitlab-git-http-server
gitlab-workhorse
mailroom
mattermost
}.each do |runit_sv|
@ -237,10 +250,10 @@ module Gitlab
end
def parse_unicorn_listen_address
# Make sure gitlab-git-http-server can talk to unicorn
# Make sure gitlab-workhorse can talk to unicorn
listen_address = unicorn['listen'] || node['gitlab']['unicorn']['listen']
listen_port = unicorn['port'] || node['gitlab']['unicorn']['port']
gitlab_git_http_server['auth_backend'] ||= "http://#{listen_address}:#{listen_port}"
gitlab_workhorse['auth_backend'] ||= "http://#{listen_address}:#{listen_port}"
end
def parse_nginx_listen_address
@ -352,7 +365,7 @@ module Gitlab
redis["enable"] = false
unicorn["enable"] = false
sidekiq["enable"] = false
gitlab_git_http_server["enable"] = false
gitlab_workhorse["enable"] = false
end
end
@ -372,7 +385,7 @@ module Gitlab
"ci_unicorn",
"sidekiq",
"ci_sidekiq",
"gitlab_git_http_server",
"gitlab_workhorse",
"nginx",
"ci_nginx",
"mattermost_nginx",
@ -396,6 +409,7 @@ module Gitlab
def generate_config(node_name)
generate_secrets(node_name)
parse_gitlab_git_http_server
parse_external_url
parse_git_data_dir
parse_udp_log_shipping

View File

@ -365,7 +365,7 @@ class GGHSHelper
extend ShellOutHelper
def self.version
result = do_shell_out("/opt/gitlab/embedded/bin/gitlab-git-http-server --version")
result = do_shell_out("/opt/gitlab/embedded/bin/gitlab-workhorse --version")
if result.exitstatus == 0
result.stdout
else

View File

@ -97,7 +97,7 @@ include_recipe "runit"
"postgresql", # Postgresql depends on Redis because of `rake db:seed_fu`
"unicorn",
"sidekiq",
"gitlab-git-http-server",
"gitlab-workhorse",
"nginx",
"remote-syslog",
"logrotate",
@ -111,4 +111,9 @@ include_recipe "runit"
end
end
# Deprecated in favor of gitlab-workhorse since 8.2
runit_service "gitlab-git-http-server" do
action :disable
end
include_recipe "gitlab::database_migrations"

View File

@ -16,8 +16,8 @@
#
account_helper = AccountHelper.new(node)
working_dir = node['gitlab']['gitlab-git-http-server']['dir']
log_dir = node['gitlab']['gitlab-git-http-server']['log_dir']
working_dir = node['gitlab']['gitlab-workhorse']['dir']
log_dir = node['gitlab']['gitlab-workhorse']['log_dir']
directory working_dir do
owner account_helper.gitlab_user
@ -32,15 +32,15 @@ directory log_dir do
recursive true
end
runit_service 'gitlab-git-http-server' do
down node['gitlab']['gitlab-git-http-server']['ha']
runit_service 'gitlab-workhorse' do
down node['gitlab']['gitlab-workhorse']['ha']
options({
:log_directory => log_dir
}.merge(params))
log_options node['gitlab']['logging'].to_hash.merge(node['gitlab']['gitlab-git-http-server'].to_hash)
log_options node['gitlab']['logging'].to_hash.merge(node['gitlab']['gitlab-workhorse'].to_hash)
end
file File.join(working_dir, "VERSION") do
content GGHSHelper.version
notifies :restart, "service[gitlab-git-http-server]"
notifies :restart, "service[gitlab-workhorse]"
end

View File

@ -15,6 +15,6 @@
# limitations under the License.
#
runit_service "gitlab-git-http-server" do
runit_service "gitlab-workhorse" do
action :disable
end

View File

@ -34,8 +34,8 @@ upstream gitlab {
server unix:<%= @socket %> fail_timeout=0;
}
upstream gitlab-git-http-server {
server unix:<%= node['gitlab']['gitlab-git-http-server']['listen_addr'] %>;
upstream gitlab-workhorse {
server unix:<%= node['gitlab']['gitlab-workhorse']['listen_addr'] %>;
}
<% if @https && @redirect_http_to_https %>
@ -150,24 +150,24 @@ server {
}
location ~ ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
# 'Error' 418 is a hack to re-use the @gitlab-git-http-server block
error_page 418 = @gitlab-git-http-server;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^/[\w\.-]+/[\w\.-]+/repository/archive {
# 'Error' 418 is a hack to re-use the @gitlab-git-http-server block
error_page 418 = @gitlab-git-http-server;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^/api/v3/projects/.*/repository/archive {
# 'Error' 418 is a hack to re-use the @gitlab-git-http-server block
error_page 418 = @gitlab-git-http-server;
# 'Error' 418 is a hack to re-use the @gitlab-workhorse block
error_page 418 = @gitlab-workhorse;
return 418;
}
location @gitlab-git-http-server {
location @gitlab-workhorse {
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
<%= 'gzip off;' if @https %>
@ -186,7 +186,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto <%= @https ? "https" : "http" %>;
proxy_pass http://gitlab-git-http-server;
proxy_pass http://gitlab-workhorse;
}
## Enable gzip compression as per rails guide:

View File

@ -1,21 +0,0 @@
#!/bin/sh
set -e # fail on errors
# Redirect stderr -> stdout
exec 2>&1
<%= render("mount_point_check.erb") %>
cd <%= node['gitlab']['gitlab-git-http-server']['dir'] %>
exec chpst -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-git-http-server \
-listenNetwork <%= node['gitlab']['gitlab-git-http-server']['listen_network'] %> \
-listenUmask <%= node['gitlab']['gitlab-git-http-server']['listen_umask'] %> \
-listenAddr <%= node['gitlab']['gitlab-git-http-server']['listen_addr'] %> \
-authBackend <%= node['gitlab']['gitlab-git-http-server']['auth_backend'] %> \
-pprofListenAddr <%= node['gitlab']['gitlab-git-http-server']['pprof_listen_addr'] %>

View File

@ -0,0 +1,21 @@
#!/bin/sh
set -e # fail on errors
# Redirect stderr -> stdout
exec 2>&1
<%= render("mount_point_check.erb") %>
cd <%= node['gitlab']['gitlab-workhorse']['dir'] %>
exec chpst -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'] %> \
-pprofListenAddr <%= node['gitlab']['gitlab-workhorse']['pprof_listen_addr'] %>