Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > ba9fe7781d529b2e7b31d8489f5e0b8e > files > 24

gitolite-1.5.3-2.fc14.noarch.rpm

<h1>what is a "big-config"</h1>

<p>In this document:</p>

<ul>
<li><a href="#when_why_do_we_need_it_">when/why do we need it?</a></li>
<li><a href="#how_do_we_use_it_">how do we use it?</a></li>
<li><a href="#summary_of_settings_in_RC_file">summary of settings in RC file</a></li>
<li><a href="#what_are_the_downsides_">what are the downsides?</a></li>
<li><a href="#extra_coolness_usergroups_and_LDAP_similar_tools">(extra coolness) usergroups and LDAP/similar tools</a></li>
</ul>

<p><a name="when_why_do_we_need_it_"></a></p>

<h3>when/why do we need it?</h3>

<p>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).</p>

<p>So let's say you have</p>

<pre><code>@wbr    =   lynx firefox
@devs   =   alice bob

repo @wbr
    RW+     next    =   @devs
    RW    master    =   @devs
</code></pre>

<p>Gitolite internally translates this to</p>

<pre><code>repo lynx firefox
    RW+     next    =   alice bob
    RW    master    =   alice bob
</code></pre>

<p>Not just that -- it now generates the actual config rules once for each
user-repo-ref combination (there are 8 combinations above; the compiled config
file looks partly like this:</p>

<pre><code>%repos = (
  'firefox' =&gt; {
    'R' =&gt; {
      'alice' =&gt; 1,
      'bob' =&gt; 1
    },
    'W' =&gt; {
      'alice' =&gt; 1,
      'bob' =&gt; 1
    },
    'alice' =&gt; [
      {
        'refs/heads/next' =&gt; 'RW+'
      },
      {
        'refs/heads/master' =&gt; 'RW'
      }
    ],
    'bob' =&gt; [
      {
        'refs/heads/next' =&gt; 'RW+'
      },
      {
        'refs/heads/master' =&gt; 'RW'
      }
    ]
  },
  'lynx' =&gt; {
    'R' =&gt; {
      'alice' =&gt; 1,
      'bob' =&gt; 1
    },
    'W' =&gt; {
      'alice' =&gt; 1,
      'bob' =&gt; 1
    },
    'alice' =&gt; [
      {
        'refs/heads/next' =&gt; 'RW+'
      },
      {
        'refs/heads/master' =&gt; 'RW'
      }
    ],
    'bob' =&gt; [
      {
        'refs/heads/next' =&gt; 'RW+'
      },
      {
        'refs/heads/master' =&gt; 'RW'
      }
    ]
  }
);
</code></pre>

<p>Phew!</p>

<p>You can imagine what that does when you have 10,000 users and 10,000 repos.
Let's just say it's not pretty :)</p>

<p><a name="how_do_we_use_it_"></a></p>

<h3>how do we use it?</h3>

<p>Now, if you had all those 10,000 users and repos explicitly listed (no
groups), then there is no help.  But if, like the above example, you had
groups like we used above, there is hope.</p>

<p>Just set</p>

<pre><code>$GL_BIG_CONFIG = 1;
</code></pre>

<p>in the <code>~/.gitolite.rc</code> file on the server.  When you do that, and push this
configuration, the compiled file looks like this:</p>

<pre><code>%repos = (
  '@wbr' =&gt; {
    '@devs' =&gt; [
      {
        'refs/heads/next' =&gt; 'RW+'
      },
      {
        'refs/heads/master' =&gt; 'RW'
      }
    ],
    'R' =&gt; {
      '@devs' =&gt; 1
    },
    'W' =&gt; {
      '@devs' =&gt; 1
    }
  },
);
%groups = (
  '@devs' =&gt; {
    'alice' =&gt; 'master',
    'bob' =&gt; 'master'
  },
  '@wbr' =&gt; {
    'firefox' =&gt; 'master',
    'lynx' =&gt; 'master'
  }
);
</code></pre>

<p>That's a lot smaller, and allows orders of magintude more repos and groups to
be supported.</p>

<p><a name="summary_of_settings_in_RC_file"></a></p>

<h3>summary of settings in RC file</h3>

<p>The default RC file contains the following lines:</p>

<pre><code>$GL_BIG_CONFIG = 0;
$GL_NO_DAEMON_NO_GITWEB = 0;
</code></pre>

<p>The first setting means that by default, big-config is off; you can change it
to 1 to enable it.</p>

<p>The second is a very useful optimisation that you <em>must</em> enable if you <em>do</em>
have a large number of repositories, and do <em>not</em> use gitolite's support for
gitweb or git-daemon access (see "<a href="http://github.com/sitaramc/gitolite/blob/pu/doc/3-faq-tips-etc.mkd#gitweb">easier to specify gitweb description and
gitweb/daemon access</a>" for details).  This will save a lot of time when
you push the gitolite-admin repo with changes.</p>

<p><a name="what_are_the_downsides_"></a></p>

<h3>what are the downsides?</h3>

<p>There is one minor issue.</p>

<p>If you use the delegation feature, you can no longer define or extend
@groups in a fragment, for security reasons.  It will also not let you use any
group other than the @fragname itself (specifically, groups which contained a
subset of the allowed @fragname, which would work normally, do not work now).</p>

<p>(If you didn't understand all that, you're probably not using delegation, so
feel free to ignore it!)</p>

<p><a name="extra_coolness_usergroups_and_LDAP_similar_tools"></a></p>

<h3>(extra coolness) usergroups and LDAP/similar tools</h3>

<p>[Please NOTE: this is all about <em>user</em> groups, not <em>repo</em> groups]</p>

<p>Gitolite now allows usergroup information to be passed in from outside.  The
<code>gl-auth-commmand</code> can now take an optional list of usergroup names after the
first argument (which is the username).</p>

<p>To understand why this is useful, consider the following:</p>

<p>Some people have an LDAP-backed ssh daemon (or some other similar mechanism
that can speak "ssh" to the client), with pubkeys stored in LDAP, etc., and
some way (not using <code>~/.ssh/authorized_keys</code>) of invoking gitolite.</p>

<p>Such setups also have "usergroups", and a way to tell, for each user, what
groups he/she is a member of.  So let's say "alice" works on projects "foo"
and "bar", while "bob" is works on project "bar" and is a member of the
<code>L3_support</code> team.</p>

<p>You can use those group names in the gitolite config file for access control
as "@foo", "@bar", <code>@L3_support</code>, etc.; please note the "@" prefix because
gitolite requires it.</p>

<p>However, that still leaves a wee little inconvenience.  You still have to add
lines like this to the gitolite config file:</p>

<pre><code>@foo        = alice
@bar        = alice bob
@L3_support = bob
</code></pre>

<p>You don't need to do that anymore now.  Tell your authentication system that,
after authenticating alice, instead of running:</p>

<pre><code>/some/path/to/gl-auth-command alice
</code></pre>

<p>it should first find the groups that alice is a member of, and then run:</p>

<pre><code>/some/path/to/gl-auth-command alice foo bar
</code></pre>

<p>That's it.  Internally, gitolite will behave as if the config file had also
specified:</p>

<pre><code>@foo = alice
@bar = alice
</code></pre>