master TOC | chapter TOC | support

semi-autonomous mirroring setup example

This document describes one way to do this. Gitolite is powerful so you can probably find other ways to suit you.

overview of problem

The example is from real life, with the following characteristics:

The admin requirements are:

The following can only be done by the master admins:

overview of setup

We will use p1 as the product, with sam as the master and frodo as a slave. Assume equivalent text/code for other product/master/slave combos.

This setup imposes the condition that all repos should be under some directory name; either a product name or, for local repos, a hostname. In our example, these directory names would be p1 or sam on the host sam, and frodo on the host frodo.

gitolite feature recap

We use delegation, to ensure that admins for sam can only write files whose names start with master/sam/. The actual files they will write are master/sam/p1.conf etc., one for each product that is mastered on their server.

We use subconf. When you say subconf "path/to/foo.conf, then within that file (and anything included from it), access can only be defined for repos that regex-match one of the elements of @foo.

pre-requisites

First, install mirroring on all servers according to the main mirroring document. Set it up so that the gitolite-admin repo is mastered at one server and everyone else slaves it.

Also, after (or during) the normal mirroring install, edit ~/.gitolite.rc on all servers and set $GL_WILDREPOS to 1 (from its default of 0).

quick setup

A typical sequence with that script is:

# cd to your gitolite-admin clone

# create a new host
~/mirror-conf-helper newhost sam sam-admin

# create the actual repository and access rules.  This is done by the host
# admin for the host on which it is mastered (or you can do it yourself).
# See step 3 below for details.
mkdir -p conf/master/sam
vim      conf/master/sam/p1.conf
    # now add in some "repo p1/..." and "RW ..." lines for the repos in
    # product p1 and save

# add product p1 to the list of repos sam is allowed to control
~/mirror-conf-helper newprod sam p1

# add a slave
~/mirror-conf-helper newslave sam p1 frodo

You can then treat the detailed steps described below as extra information or "background reading" ;-)

step by step: Link

next steps

Once you've done the initial setup, here's what ongoing additions will require.

appendix A: delegation helper files: Link