Make gerrit git replica and jeepyb paths configurable

* Gerrit: make the path to the local replica configurable
  (default to /var/lib/git)
* Set the local replica path on review-dev to /opt/lib/git
* Gerrit: make the jeepyb cache dir configurable
  (default to /opt/lib/jeepyb)

Change-Id: I9b94fa540bb400abcc746c5c962bb3b5e2b372e3
This commit is contained in:
James E. Blair 2014-04-24 08:51:56 -07:00
parent d88a34a7dc
commit 3c2948637a
6 changed files with 14 additions and 5 deletions

View File

@ -66,6 +66,8 @@
# A URL for the remote contact store application # A URL for the remote contact store application
# replicate_local: # replicate_local:
# A boolean enabling local replication for apache acceleration # A boolean enabling local replication for apache acceleration
# replicate_path:
# The path to the local git replica if replicate_local is enabled
# gitweb: # gitweb:
# A boolean enabling gitweb # A boolean enabling gitweb
# cgit: # cgit:
@ -134,6 +136,7 @@ class gerrit(
$enable_melody = false, $enable_melody = false,
$melody_session = false, $melody_session = false,
$replicate_local = false, $replicate_local = false,
$replicate_path = '/var/lib/git',
$replication = [], $replication = [],
$gitweb = true, $gitweb = true,
$cgit = false, $cgit = false,
@ -322,6 +325,7 @@ class gerrit(
# - $ssl_chain_file # - $ssl_chain_file
# - $canonicalweburl # - $canonicalweburl
# - $replicate_local # - $replicate_local
# - $replicate_path
# - $contactstore # - $contactstore
# - $robots_txt_source # - $robots_txt_source
apache::vhost { $vhost_name: apache::vhost { $vhost_name:

View File

@ -64,11 +64,11 @@
<% end -%> <% end -%>
<% if scope.lookupvar("gerrit::replicate_local") -%> <% if scope.lookupvar("gerrit::replicate_local") -%>
SetEnv GIT_PROJECT_ROOT /var/lib/git/ SetEnv GIT_PROJECT_ROOT <%= scope.lookupvar("gerrit::replicate_path") %>
SetEnv GIT_HTTP_EXPORT_ALL SetEnv GIT_HTTP_EXPORT_ALL
AliasMatch ^/p/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /var/lib/git/$1 AliasMatch ^/p/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ <%= scope.lookupvar("gerrit::replicate_path") %>/$1
AliasMatch ^/p/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /var/lib/git/$1 AliasMatch ^/p/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ <%= scope.lookupvar("gerrit::replicate_path") %>/$1
ScriptAlias /p/ /usr/lib/git-core/git-http-backend/ ScriptAlias /p/ /usr/lib/git-core/git-http-backend/
<% end -%> <% end -%>

View File

@ -57,6 +57,7 @@ class openstack_project::gerrit (
$replicate_local = true, $replicate_local = true,
$replication = [], $replication = [],
$local_git_dir = '/var/lib/git', $local_git_dir = '/var/lib/git',
$jeepyb_cache_dir = '/opt/lib/jeepyb',
$cla_description = 'OpenStack Individual Contributor License Agreement', $cla_description = 'OpenStack Individual Contributor License Agreement',
$cla_file = 'static/cla.html', $cla_file = 'static/cla.html',
$cla_id = '2', $cla_id = '2',
@ -178,6 +179,7 @@ class openstack_project::gerrit (
mysql_password => $mysql_password, mysql_password => $mysql_password,
email_private_key => $email_private_key, email_private_key => $email_private_key,
replicate_local => $replicate_local, replicate_local => $replicate_local,
replicate_path => $local_git_dir,
replication => $replication, replication => $replication,
gitweb => $gitweb, gitweb => $gitweb,
cgit => $cgit, cgit => $cgit,
@ -338,7 +340,7 @@ class openstack_project::gerrit (
weekday => '0', weekday => '0',
hour => '4', hour => '4',
minute => '7', minute => '7',
command => 'find /var/lib/git/ -type d -name "*.git" -print -exec git --git-dir="{}" repack -afd \;', command => "find ${::local_git_dir} -type d -name \"*.git\" -print -exec git --git-dir=\"{}\" repack -afd \;",
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin', environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin',
} }
} }

View File

@ -68,6 +68,7 @@ class openstack_project::review_dev (
web_repo_url => 'https://git.openstack.org/cgit/', web_repo_url => 'https://git.openstack.org/cgit/',
swift_username => $swift_username, swift_username => $swift_username,
swift_password => $swift_password, swift_password => $swift_password,
local_git_dir => '/opt/lib/git',
replication => [ replication => [
{ {
name => 'github', name => 'github',
@ -78,7 +79,7 @@ class openstack_project::review_dev (
}, },
{ {
name => 'local', name => 'local',
url => 'file:///var/lib/git/', url => 'file:///opt/lib/git/',
replicationDelay => '0', replicationDelay => '0',
threads => '4', threads => '4',
mirror => true, mirror => true,

View File

@ -2,6 +2,7 @@
homepage=http://openstack.org homepage=http://openstack.org
acl-dir=/home/gerrit2/acls acl-dir=/home/gerrit2/acls
local-git-dir=<%= local_git_dir %> local-git-dir=<%= local_git_dir %>
jeepyb-cache-dir=<%= jeepyb_cache_dir %>
gerrit-host=<%= fqdn %> gerrit-host=<%= fqdn %>
gerrit-user=openstack-dev-project-creator gerrit-user=openstack-dev-project-creator
gerrit-key=<%= ssh_project_key %> gerrit-key=<%= ssh_project_key %>

View File

@ -2,6 +2,7 @@
homepage=http://openstack.org homepage=http://openstack.org
acl-dir=/home/gerrit2/acls acl-dir=/home/gerrit2/acls
local-git-dir=<%= local_git_dir %> local-git-dir=<%= local_git_dir %>
jeepyb-cache-dir=<%= jeepyb_cache_dir %>
gerrit-host=<%= fqdn %> gerrit-host=<%= fqdn %>
gerrit-user=openstack-project-creator gerrit-user=openstack-project-creator
gerrit-committer=OpenStack Project Creator <openstack-infra@lists.openstack.org> gerrit-committer=OpenStack Project Creator <openstack-infra@lists.openstack.org>