From dfe67bab68bdab77dd8acbf3c4b1dcb7b7de515f Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sat, 9 Apr 2016 20:32:05 -0400 Subject: git: first-pass cgit/gitolite configuration --- .../templates/etc_apache2_sites-available_cgit.j2 | 27 ---- roles/git/templates/etc_cgitrc.j2 | 14 +- .../templates/etc_nginx_sites-available_cgit.j2 | 21 +++ roles/git/templates/home_git_gitolite_rc.j2 | 176 +++++++++++++++++++++ 4 files changed, 204 insertions(+), 34 deletions(-) delete mode 100644 roles/git/templates/etc_apache2_sites-available_cgit.j2 create mode 100644 roles/git/templates/etc_nginx_sites-available_cgit.j2 create mode 100644 roles/git/templates/home_git_gitolite_rc.j2 (limited to 'roles/git/templates') diff --git a/roles/git/templates/etc_apache2_sites-available_cgit.j2 b/roles/git/templates/etc_apache2_sites-available_cgit.j2 deleted file mode 100644 index af59a34..0000000 --- a/roles/git/templates/etc_apache2_sites-available_cgit.j2 +++ /dev/null @@ -1,27 +0,0 @@ - - ServerName {{ cgit_domain }} - - Redirect permanent / https://{{ cgit_domain }}/ - - - - ServerName {{ cgit_domain }} - SSLEngine On - - DocumentRoot /var/www/htdocs/cgit/ - - AllowOverride None - Options +ExecCGI - Order allow,deny - Allow from all - - - Alias /cgit.png /var/www/htdocs/cgit/cgit.png - Alias /cgit.css /var/www/htdocs/cgit/cgit.css - Alias /favicon.ico /var/www/htdocs/cgit/favicon.ico - Alias /robots.txt /var/www/htdocs/cgit/robots.txt - ScriptAlias / /var/www/htdocs/cgit/cgit.cgi/ - - CustomLog /var/log/apache2/cgit_access.log combined - ErrorLog /var/log/apache2/cgit_error.log - diff --git a/roles/git/templates/etc_cgitrc.j2 b/roles/git/templates/etc_cgitrc.j2 index abba971..ea52194 100644 --- a/roles/git/templates/etc_cgitrc.j2 +++ b/roles/git/templates/etc_cgitrc.j2 @@ -3,7 +3,7 @@ cache-size=1000 # Specify some default clone urls using macro expansion -clone-url=git@{{ domain }}:$CGIT_REPO_URL +clone-url=git@{{ cgit_hostname }}:$CGIT_REPO_URL # Specify the css url @@ -15,7 +15,7 @@ enable-index-owner=1 # Allow http transport git clone -enable-http-clone=0 +enable-http-clone=1 # Show extra links for each repository on the index page @@ -51,7 +51,7 @@ max-stats=quarter # Set the title and heading of the repository index page -root-title={{ domain }} git repository +root-title={{ cgit_hostname }} git repository # Set a subheading for the repository index page @@ -62,8 +62,8 @@ root-title={{ domain }} git repository # root-readme=/var/www/htdocs/about.html -# Allow download of tar.gz, tar.bz2 and zip-files -snapshots=tar.gz tar.bz2 zip +# Allow download of tar.gz and zip-files +snapshots=tar.gz zip ## @@ -130,8 +130,8 @@ remove-suffix=1 # A list of subdirectories inside of scan-path # that should loaded as git repositories -project-list=/home/git/projects.list +project-list={{ gitolite_homedir }}/projects.list # A path which will be scanned for repositories -scan-path=/home/git/repositories \ No newline at end of file +scan-path={{ gitolite_homedir }}/repositories diff --git a/roles/git/templates/etc_nginx_sites-available_cgit.j2 b/roles/git/templates/etc_nginx_sites-available_cgit.j2 new file mode 100644 index 0000000..2ad43e3 --- /dev/null +++ b/roles/git/templates/etc_nginx_sites-available_cgit.j2 @@ -0,0 +1,21 @@ + +server { + server_name {{ cgit_hostname }}; + root /srv/http/cgit; + + location / { + try_files $uri @cgit; + } + + location @cgit { + index cgit.cgi; + fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + fastcgi_param HTTP_HOST $server_name; + fastcgi_param PATH_INFO $uri; + fastcgi_param QUERY_INFO $uri; + include "fastcgi_params"; + + } +} + diff --git a/roles/git/templates/home_git_gitolite_rc.j2 b/roles/git/templates/home_git_gitolite_rc.j2 new file mode 100644 index 0000000..18dbd7b --- /dev/null +++ b/roles/git/templates/home_git_gitolite_rc.j2 @@ -0,0 +1,176 @@ +# configuration variables for gitolite + +# This file is in perl syntax. But you do NOT need to know perl to edit it -- +# just mind the commas, use single quotes unless you know what you're doing, +# and make sure the brackets and braces stay matched up! + +# (Tip: perl allows a comma after the last item in a list also!) + +# HELP for commands can be had by running the command with "-h". + +# HELP for all the other FEATURES can be found in the documentation (look for +# "list of non-core programs shipped with gitolite" in the master index) or +# directly in the corresponding source file. + +%RC = ( + + # ------------------------------------------------------------------ + + # default umask gives you perms of '0700'; see the rc file docs for + # how/why you might change this + UMASK => 0027, + + # look for "git-config" in the documentation + GIT_CONFIG_KEYS => 'gitweb\.(owner|description|category)', + + # comment out if you don't need all the extra detail in the logfile + LOG_EXTRA => 1, + + # roles. add more roles (like MANAGER, TESTER, ...) here. + # WARNING: if you make changes to this hash, you MUST run 'gitolite + # compile' afterward, and possibly also 'gitolite trigger POST_COMPILE' + ROLES => { + READERS => 1, + WRITERS => 1, + }, + + # ------------------------------------------------------------------ + + # rc variables used by various features + + # the 'info' command prints this as additional info, if it is set + # SITE_INFO => 'Please search for "gitolite" or email site admin for more help', + + # the 'desc' command uses this + # WRITER_CAN_UPDATE_DESC => 1, + + # the CpuTime feature uses these + # display user, system, and elapsed times to user after each git operation + # DISPLAY_CPU_TIME => 1, + # display a warning if total CPU times (u, s, cu, cs) crosses this limit + # CPU_TIME_WARN_LIMIT => 0.1, + + # the Mirroring feature needs this + HOSTNAME => "{{ gitolite_hostname }}", + + # if you enabled 'Shell', you need this + # SHELL_USERS_LIST => "$ENV{HOME}/.gitolite.shell-users", + + # ------------------------------------------------------------------ + + # suggested locations for site-local gitolite code (see cust.html) + + # this one is managed directly on the server + # LOCAL_CODE => "$ENV{HOME}/local", + + # or you can use this, which lets you put everything in a subdirectory + # called "local" in your gitolite-admin repo. For a SECURITY WARNING + # on this, see http://gitolite.com/gitolite/cust.html#pushcode + # LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local", + + # ------------------------------------------------------------------ + + # List of commands and features to enable + + ENABLE => [ + + # COMMANDS + + # These are the commands enabled by default + 'help', + 'desc', + 'info', + 'perms', + 'writable', + + # Uncomment or add new commands here. + # 'create', + # 'fork', + # 'mirror', + # 'sskm', + # 'D', + + # These FEATURES are enabled by default. + + # essential (unless you're using smart-http mode) + 'ssh-authkeys', + + # creates git-config enties from gitolite.conf file entries like 'config foo.bar = baz' + 'git-config', + + # creates git-daemon-export-ok files; if you don't use git-daemon, comment this out + 'daemon', + + # creates projects.list file; if you don't use gitweb, comment this out + 'gitweb', + + # These FEATURES are disabled by default; uncomment to enable. If you + # need to add new ones, ask on the mailing list :-) + + # user-visible behaviour + + # prevent wild repos auto-create on fetch/clone + # 'no-create-on-read', + # no auto-create at all (don't forget to enable the 'create' command!) + 'no-auto-create', + + # access a repo by another (possibly legacy) name + # 'Alias', + + # give some users direct shell access + # 'Shell', + + # set default roles from lines like 'option default.roles-1 = ...', etc. + # 'set-default-roles', + + # system admin stuff + + # enable mirroring (don't forget to set the HOSTNAME too!) + # 'Mirroring', + + # allow people to submit pub files with more than one key in them + 'ssh-authkeys-split', + + # selective read control hack + # 'partial-copy', + + # manage local, gitolite-controlled, copies of read-only upstream repos + # 'upstream', + + # updates 'description' file instead of 'gitweb.description' config item + # 'cgit', + + # allow repo-specific hooks to be added + # 'repo-specific-hooks', + + # performance, logging, monitoring... + + # be nice + # 'renice 10', + + # log CPU times (user, system, cumulative user, cumulative system) + # 'CpuTime', + + # syntactic_sugar for gitolite.conf and included files + + # allow backslash-escaped continuation lines in gitolite.conf + # 'continuation-lines', + + # create implicit user groups from directory names in keydir/ + 'keysubdirs-as-groups', + + # allow simple line-oriented macros + # 'macros', + + ], + +); + +# ------------------------------------------------------------------------------ +# per perl rules, this should be the last line in such a file: +1; + +# Local variables: +# mode: perl +# End: +# vim: set syn=perl: -- cgit v1.2.3