diff --git a/conf/example.gitolite.rc b/conf/example.gitolite.rc index ecaaaa5..4821596 100644 --- a/conf/example.gitolite.rc +++ b/conf/example.gitolite.rc @@ -1,5 +1,4 @@ # paths and configuration variables for gitolite -$GL_BIG_CONFIG = 1; # please read comments before editing @@ -83,7 +82,13 @@ $GIT_PATH=""; # -------------------------------------- +# ---------------------------------------------------------------------- +# BIG CONFIG SETTINGS +# Please read doc/big-config.mkd for details + +$GL_BIG_CONFIG = 0; +$GL_NO_DAEMON_NO_GITWEB = 0; # ---------------------------------------------------------------------- # SECURITY SENSITIVE SETTINGS diff --git a/doc/big-config.mkd b/doc/big-config.mkd index a1fe0ad..5ff551f 100644 --- a/doc/big-config.mkd +++ b/doc/big-config.mkd @@ -4,14 +4,15 @@ In this document: * when/why do we need it? * how do we use it? + * summary of settings in RC file * what are the downsides? * (extra coolness) usergroups and LDAP/similar tools ### when/why do we need it? -A "big config" is anything that has more than a few thousand users and a few -thousand repos, organised into groups that are much smaller in number (like -maybe a few hundreds of repogroups and a few dozens of usergroups). +A "big config" is anything that has a few thousand users and a few thousand +repos, organised into groups that are much smaller in number (like maybe a few +hundreds of repogroups and a few dozens of usergroups). So let's say you have @@ -137,6 +138,24 @@ configuration, the compiled file looks like this: That's a lot smaller, and allows orders of magintude more repos and groups to be supported. +### summary of settings in RC file + +The default RC file contains the following lines: + + $GL_BIG_CONFIG = 0; + $GL_NO_DAEMON_NO_GITWEB = 0; + +The first setting means that by default, big-config is off; you can change it +to 1 to enable it. + +The second is a very useful optimisation that you *must* enable if you *do* +have a large number of repositories, and do *not* use gitolite's support for +gitweb or git-daemon access (see "[easier to specify gitweb description and +gitweb/daemon access][gw]" for details). This will save a lot of time when +you push the gitolite-admin repo with changes. + +[gw]: http://github.com/sitaramc/gitolite/blob/pu/doc/3-faq-tips-etc.mkd#gitweb + ### what are the downsides? There are a few minor issues. diff --git a/src/gl-compile-conf b/src/gl-compile-conf index 5c02160..e6d1268 100755 --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@ -52,7 +52,7 @@ $Data::Dumper::Sortkeys = 1; open STDOUT, ">", "/dev/null" if (@ARGV and shift eq '-q'); # these are set by the "rc" file -our ($GL_ADMINDIR, $GL_CONF, $GL_KEYDIR, $GL_CONF_COMPILED, $REPO_BASE, $REPO_UMASK, $PROJECTS_LIST, $GIT_PATH, $GL_WILDREPOS, $GL_GITCONFIG_KEYS, $GL_PACKAGE_HOOKS, $GL_SETPERMS_OVERRIDES_CONFIG, $GL_BIG_CONFIG); +our ($GL_ADMINDIR, $GL_CONF, $GL_KEYDIR, $GL_CONF_COMPILED, $REPO_BASE, $REPO_UMASK, $PROJECTS_LIST, $GIT_PATH, $GL_WILDREPOS, $GL_GITCONFIG_KEYS, $GL_PACKAGE_HOOKS, $GL_SETPERMS_OVERRIDES_CONFIG, $GL_BIG_CONFIG, $GL_NO_DAEMON_NO_GITWEB); # and these are set by gitolite.pm our ($REPONAME_PATT, $REPOPATT_PATT, $USERNAME_PATT, $AUTH_COMMAND, $AUTH_OPTIONS, $ABRT, $WARN); @@ -470,58 +470,60 @@ for my $repo (keys %repo_config) { wrap_chdir("$repo_base_abs"); -# daemons first... -for my $repo (sort keys %repos) { - next unless $repo =~ $REPONAME_PATT; - next if $repo =~ m(^\@|EXTCMD/); # these are not real repos - my $export_ok = "$repo.git/git-daemon-export-ok"; - if ($repos{$repo}{'R'}{'daemon'}) { - system("touch $export_ok"); - } else { - unlink($export_ok); - } -} - -my %projlist = (); -# ...then gitwebs -for my $repo (sort keys %repos) { - next unless $repo =~ $REPONAME_PATT; - next if $repo =~ m(^\@|EXTCMD/); # these are not real repos - my $desc_file = "$repo.git/description"; - # note: having a description also counts as enabling gitweb - if ($repos{$repo}{'R'}{'gitweb'} or $desc{"$repo.git"}) { - $projlist{"$repo.git"} = 1; - # add the description file; no messages to user or error checking :) - $desc{"$repo.git"} and open(DESC, ">", $desc_file) and print DESC $desc{"$repo.git"} . "\n" and close DESC; - if ($owner{"$repo.git"}) { - # set the repository owner - system("git", "--git-dir=$repo.git", "config", "gitweb.owner", $owner{"$repo.git"}); +unless ($GL_NO_DAEMON_NO_GITWEB) { + # daemons first... + for my $repo (sort keys %repos) { + next unless $repo =~ $REPONAME_PATT; + next if $repo =~ m(^\@|EXTCMD/); # these are not real repos + my $export_ok = "$repo.git/git-daemon-export-ok"; + if ($repos{$repo}{'R'}{'daemon'}) { + system("touch $export_ok"); } else { + unlink($export_ok); + } + } + + my %projlist = (); + # ...then gitwebs + for my $repo (sort keys %repos) { + next unless $repo =~ $REPONAME_PATT; + next if $repo =~ m(^\@|EXTCMD/); # these are not real repos + my $desc_file = "$repo.git/description"; + # note: having a description also counts as enabling gitweb + if ($repos{$repo}{'R'}{'gitweb'} or $desc{"$repo.git"}) { + $projlist{"$repo.git"} = 1; + # add the description file; no messages to user or error checking :) + $desc{"$repo.git"} and open(DESC, ">", $desc_file) and print DESC $desc{"$repo.git"} . "\n" and close DESC; + if ($owner{"$repo.git"}) { + # set the repository owner + system("git", "--git-dir=$repo.git", "config", "gitweb.owner", $owner{"$repo.git"}); + } else { + # remove the repository owner setting + system("git --git-dir=$repo.git config --unset-all gitweb.owner 2>/dev/null"); + } + } else { + # delete the description file; no messages to user or error checking :) + unlink $desc_file; # remove the repository owner setting system("git --git-dir=$repo.git config --unset-all gitweb.owner 2>/dev/null"); } - } else { - # delete the description file; no messages to user or error checking :) - unlink $desc_file; - # remove the repository owner setting - system("git --git-dir=$repo.git config --unset-all gitweb.owner 2>/dev/null"); + + # unless there are other gitweb.* keys set, remove the section to keep the + # config file clean + my $keys = `git --git-dir=$repo.git config --get-regexp '^gitweb\\.' 2>/dev/null`; + if (length($keys) == 0) { + system("git --git-dir=$repo.git config --remove-section gitweb 2>/dev/null"); + } } - # unless there are other gitweb.* keys set, remove the section to keep the - # config file clean - my $keys = `git --git-dir=$repo.git config --get-regexp '^gitweb\\.' 2>/dev/null`; - if (length($keys) == 0) { - system("git --git-dir=$repo.git config --remove-section gitweb 2>/dev/null"); + # update the project list + my $projlist_fh = wrap_open( ">", $PROJECTS_LIST); + for my $proj (sort keys %projlist) { + print $projlist_fh "$proj\n"; } + close $projlist_fh; } -# update the project list -my $projlist_fh = wrap_open( ">", $PROJECTS_LIST); -for my $proj (sort keys %projlist) { - print $projlist_fh "$proj\n"; -} -close $projlist_fh; - # ---------------------------------------------------------------------------- # "compile" ssh authorized_keys # ----------------------------------------------------------------------------