Skip to content

Gitolite integration for Debian

Ondřej Caletka edited this page Feb 18, 2020 · 9 revisions
  • install gitolite3 as well as python3-pip and bind9utils packages.

  • edit /etc/gitolite3/gitolite.rc:

    • set UMASK to 0007 or 0002 to allow group members modifying the checked out directory
    • set GIT_CONFIG_KEYS to dzonegit\..* to allow per repository config
    • uncomment LOCAL_CODE => "$ENV{HOME}/local" to allow hook instalation
    • uncomment repo-specific-hooks feature
  • Add user bind to the git group (to be able to write journal files into the checked out repository) as well se git user to the bind group (to be able to use rndc command)

    # gpasswd -a bind git
    # gpasswd -a git bind
    
  • install dzonegit system-wide using pip3

    # pip3 install dzonegit
    
  • symlink hooks to the gitolite directory:

    # cd /var/lib/gitolite3/
    # mkdir -p local/hooks/repo-specific/
    # for h in dzonegit-pre-receive dzonegit-post-receive; do ln -s $(which $h) local/hooks/repo-specific/$h; done
    
  • to be able to use $UNIXTIME directive, setup a global Git smudge filter:

    $ cat >/var/lib/gitolite3/.gitconfig <<EOF
    [filter "dzonegit"]
            smudge = /usr/local/bin/dzonegit-smudge-serial
    EOF
    
  • clone the admin repository, setup users, keys and repositories as usual. Add per repo config variables like this:

    repo dns-masters
        RW+     =   @masters
        option hook.pre-receive = dzonegit-pre-receive
        option hook.post-receive = dzonegit-post-receive
        config dzonegit.checkoutpath = /var/lib/dzonegit/dns-masters/
        config dzonegit.conffiletemplate = /etc/dzonegit/conftemplate-bind.json
        config dzonegit.conffilepath = /var/lib/dzonegit/dns-masters-bind.conf
        config dzonegit.reconfigcmd = "/usr/sbin/rndc reconfig"
        config dzonegit.zonereloadcmd = "/usr/sbin/rndc reload"
    
  • create empty checkout directory /var/lib/dzonegit/dns-masters/, set proper owner(git) and permissions(077x)

  • create JSON template file /etc/dzonegit/conftemplate-bind.json:

    {
      "header": "# Autogenerated by dzonegit on $datetime. Do not edit.\n",
      "item": "zone \"$zonename\" { type master; file \"$zonefile\"; };"
    }
    
  • edit named.conf to include the config file /var/lib/dzonegit/dns-masters-bind.conf

  • commit and push the gitolite-admin repository

  • push zone files to the newly created repository

  • in case you need to regenerate the config snippet:

    # su - git
    $ umask 0007
    $ cd repositories/dns-masters.git
    $ dzonegit-post-receive
    
Clone this wiki locally