CGit module that supports virtual hosting

Konstantin Ryabitsev



5,568 latest version

4.3 quality score

Version information

  • 0.1.3 (latest)
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Mar 13th 2017
This version is compatible with:
  • Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >=4.0.0 <5.0.0
  • RedHat

Start using this module


mricon/cgit — version 0.1.3 Mar 13th 2017


Table of Contents

  1. Overview
  2. Usage - Configuration options and additional functionality
  3. Reference - An under-the-hood peek at what the module is doing and how
  4. Limitations - OS compatibility, etc.


Build Status

This module configures cgit. At this time, it leaves out nginx/apache/whathaveyou configuration up to some other module, and will add this step as optional in the future. There are just too many ways to serve cgit (basic apache cgit, fastcgi, spawn-fcgi with nginx, lighttpd, etc), so this module concentrates on setting up just the basic config to the point where you can then configure the serving part on your own.


To use this module you can either directly include it in your module tree, or add the following to your Puppetfile:

  mod 'mricon-cgit'

A node should then be assigned the relevant cgit classes.

There are two basic ways to use the module -- with or without virtual hosting. When used in a default configuration without virtual hosting, the module tracks and configures /etc/cgitrc. The most basic configuration with sane defaults is:

   class { 'cgit':
     reposdir => '/path/to/your/repos'

This will configure the cache location to be owned by user apache, so if you are running with some other webserver, make sure you tweak cachedir_owner, e.g. for nginx:

   class { 'cgit':
     reposdir       => '/path/to/your/repos',
     cachedir_owner => 'nginx',

If you're using Hiera, the same configuration might look like:

   cgit::reposdir: '/path/to/your/repos'
   cgit::cachedir_owner: 'nginx'

Virtual sites

If you are hosting multiple repo collections on the same server, this module supports basic virtual hosting. For example, if you have /var/lib/git/ and /var/lib/git/ directories full of project-specific repos, you will want to configure things as follows:

   class { 'cgit':
     reposdir           => '/var/lib/git',
     use_virtual_sites  => true,
     config             => {
       virtual_root      => '/',
       enable_git_config => true,
     sites              => {
       '' => {
         ensure            => 'present',
         skindir_src       => 'puppet:///modules/cgit/',
         section_from_path => 1,
       ''  => {
         ensure         => 'present',
         skindir_src    => 'puppet:///modules/cgit/',

This will create /etc/cgitrc with the following content:


Then each defined site will have an entry in /etc/cgitrc.d:

  • /etc/cgitrc.d/
  • /etc/cgitrc.d/

The same configuration in hiera would look like this:

   cgit::reposdir: '/var/lib/git'
   cgit::use_virtual_sites: true
   cgit::config::virtual_root: '/'
   cgit::config::enable_git_config: true
       ensure: 'present'
       skindir_src: 'puppet:///modules/cgit/'
       section_from_path: 1
       ensure: 'present'
       skindir_src: 'puppet:///modules/cgit/'

Anything you define as part of global cgit=>config will be inherited by each defined site, but you can override any part of it by defining a separate site-specific config value.




Whether to manage the package installation or not.

Default: true


The name of the package to install.

Default: cgit


Whether to install or remove the package (e.g. if you're installing cgit via some other way).

Default: present


Global cgit config file.

Default: /etc/cgitrc


Where your repositories live.

Default: /var/lib/git


Where to put cgit cache.

Default: /var/cache/cgit

cachedir_owner, cachedir_group, cachedir_mode

Who should own the cache directory, and what its mode should be

Defaults: apache, root, 0755


Whether to use a global configuration or set up virtual sites.

Default: false


Where to put site-specific configuration files.

Default: /etc/cgitrc.d


Where to put site-specific skin files (css, logo, favicon, etc). You would usually then specify a site-specific skindir_src that would point at a location in puppet from where to recursively copy these objects. You will need to configure your httpd virtual host so that $skindir_src/ is aliased to /cgit-data for that site.

When skindir_src is not specified, the module will copy the default /usr/share/cgit skin in place.

Default: /var/www/html/cgit


Values here are one-to-one mapping to cgit configuration parameters, with all dashes changed to underscores. E.g. a cgit configuration parameter section-from-path will become section_from_path.

There are too many configuration parameters here to bother listing them all, so your best bet is looking at the config.pp file.

All configuration in the config class is inherited by each defined virtual site, if you're using them. You can override each global configuration entry by setting a separate site-specific config value.


Tested on RHEL 6/7 and CentOS 6/7. Not tested anywhere else. :)