From 0fbbe34dfc0868d1d3b2314c4585538d911889ed Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 1 Jul 2012 13:41:26 -0400 Subject: [PATCH] Use apache to serve out http git repos. Assumes that every project in gerrit has a corresponding repo in /var/lib/git that can be replicated to. That's probably a one-time offline creation, followed by an additional step in the adding a project docs. Change-Id: If9b987717550d5b251366c1408d949c55e64828a --- modules/gerrit/files/replication.config | 6 ++++++ modules/gerrit/templates/gerrit.vhost.erb | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/modules/gerrit/files/replication.config b/modules/gerrit/files/replication.config index ebb5978f2f..33786eaddc 100644 --- a/modules/gerrit/files/replication.config +++ b/modules/gerrit/files/replication.config @@ -3,3 +3,9 @@ [remote "github"] url = git@github.com:${name}.git + +[remote "local"] +url = file:///var/lib/git/${name}.git +replicationDelay = 0 +threads = 4 +mirror = true diff --git a/modules/gerrit/templates/gerrit.vhost.erb b/modules/gerrit/templates/gerrit.vhost.erb index 363898437b..4b647802b7 100644 --- a/modules/gerrit/templates/gerrit.vhost.erb +++ b/modules/gerrit/templates/gerrit.vhost.erb @@ -43,13 +43,22 @@ RewriteEngine on RewriteCond %{HTTP_HOST} !<%= virtual_hostname %> RewriteRule ^.*$ <%= canonicalweburl %> + RewriteCond %{REQUEST_URI} !^/p/ + RewriteRule ^/(.*)$ http://localhost:8081/$1 [P] - ProxyPassReverse / http://localhost:8081/ - - Order allow,deny - Allow from all - ProxyPass http://localhost:8081/ retry=0 - + ProxyPassReverse / http://localhost:8081/ + + SetEnv GIT_PROJECT_ROOT /var/lib/git/ + SetEnv GIT_HTTP_EXPORT_ALL + + AliasMatch ^/p/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1 + AliasMatch ^/p/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1 + ScriptAlias /p/ /usr/lib/git-core/git-http-backend/ + + + Order allow,deny + Allow from all +