diff --git a/doc/source/git.rst b/doc/source/git.rst new file mode 100644 index 0000000000..ea1fd67e09 --- /dev/null +++ b/doc/source/git.rst @@ -0,0 +1,28 @@ +:title: Git + +.. _git: + +Git +######## + +The web frontend cgit is running on git.openstack.org. + +At a Glance +=========== + +:Hosts: + * http://git.openstack.org +:Puppet: + * :file:`modules/cgit` + * :file:`modules/openstack_project/manifests/git.pp` +:Projects: + * http://git.zx2c4.com/cgit/ +:Bugs: + * http://bugs.launchpad.net/openstack-ci + * http://lists.zx2c4.com/mailman/listinfo/cgit + +Overview +======== + +Apache is running on a CentOS 6 system with the EPEL repository that includes +the cgit packages. diff --git a/manifests/site.pp b/manifests/site.pp index cf50e6cee1..ec65f3d283 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -268,6 +268,14 @@ node /^elasticsearch\d*\.openstack\.org$/ { } } +# A CentOS machine to run cgit and git daemon. +node 'git.openstack.org' { + class { 'openstack_project::git': + sysadmins => hiera('sysadmins'), + git_gerrit_ssh_key => hiera('gerrit_ssh_rsa_pubkey_contents'), + } +} + # A machine to run ODSREG in preparation for summits. node 'summit.openstack.org' { class { 'openstack_project::summit': diff --git a/modules/cgit/files/cgit.conf b/modules/cgit/files/cgit.conf new file mode 100644 index 0000000000..791d01bda2 --- /dev/null +++ b/modules/cgit/files/cgit.conf @@ -0,0 +1,2 @@ +Alias /cgit-data /usr/share/cgit +ScriptAlias /cgit /var/www/cgi-bin/cgit diff --git a/modules/cgit/manifests/init.pp b/modules/cgit/manifests/init.pp new file mode 100644 index 0000000000..c5543cc6eb --- /dev/null +++ b/modules/cgit/manifests/init.pp @@ -0,0 +1,76 @@ +# Copyright 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Class: cgit +# +class cgit { + + include apache + + package { [ + 'cgit', + 'git-daemon', + ]: + ensure => present, + } + + service { 'httpd': + ensure => running, + require => Package['httpd'], + } + + user { 'cgit': + ensure => present, + home => '/home/cgit', + shell => '/bin/bash', + gid => 'cgit', + managehome => true, + require => Group['cgit'], + } + + group { 'cgit': + ensure => present, + } + + file {'/home/cgit': + ensure => directory, + owner => 'cgit', + group => 'cgit', + mode => '0755', + require => User['cgit'], + } + + file { '/var/lib/git': + ensure => directory, + owner => 'cgit', + group => 'cgit', + mode => '0644', + } + + exec { 'restorecon -R -v /var/lib/git': + path => '/sbin', + subscribe => Folder['/var/lib/git'] + } + + selboolean { 'httpd_enable_cgi': + persistent => true, + value => on + } + + file { '/etc/httpd/conf.d/cgit.conf': + ensure => present, + source => 'puppet:///modules/cgit/cgit.conf', + mode => '0644' + } +} diff --git a/modules/openstack_project/files/git/cgitrc b/modules/openstack_project/files/git/cgitrc new file mode 100644 index 0000000000..db14123036 --- /dev/null +++ b/modules/openstack_project/files/git/cgitrc @@ -0,0 +1,71 @@ +# +# See cgitrc(5) or /usr/share/doc/cgit-*/cgitrc.5.html for details +# + +# Enable caching of up to 1000 output entries +cache-size=0 + +# Specify some default clone prefixes +clone-prefix=git://git.openstack.org http://git.openstack.org/cgit + +# Specify the css url +css=/cgit-data/cgit.css + +# Show extra links for each repository on the index page +enable-index-links=1 + +# Enable ASCII art commit history graph on the log pages +enable-commit-graph=1 + +# Show number of affected files per commit on the log pages +enable-log-filecount=1 + +# Show number of added/removed lines per commit on the log pages +enable-log-linecount=1 + +# Add a cgit favicon +#favicon=/favicon.ico + +# Use a custom logo +logo=/cgit-data/cgit.png + +# Enable statistics per week, month and quarter +max-stats=quarter + +# Set the title and heading of the repository index page +root-title=OpenStack git repository browser + +# Set a subheading for the repository index page +#root-desc=tracking the foobar development + +# Include some more info about this site on the index page +#root-readme=/var/www/html/about.html + +# Allow download of tar.gz, tar.bz2 and zip-files +#snapshots=tar.gz tar.bz2 zip + +## +## List of common mimetypes +## + +mimetype.gif=image/gif +mimetype.html=text/html +mimetype.jpg=image/jpeg +mimetype.jpeg=image/jpeg +mimetype.pdf=application/pdf +mimetype.png=image/png +mimetype.svg=image/svg+xml + +# Enable syntax highlighting (requires the highlight package) +#source-filter=/usr/libexec/cgit/filters/syntax-highlighting.sh + +## +## List of repositories. +## PS: Any repositories listed when section is unset will not be +## displayed under a section heading +## PPS: This list could be kept in a different file (e.g. '/etc/cgitrepos') +## and included like this: +## include=/etc/cgitrepos +## + +include=/etc/cgitrepos diff --git a/modules/openstack_project/manifests/git.pp b/modules/openstack_project/manifests/git.pp new file mode 100644 index 0000000000..55616012d4 --- /dev/null +++ b/modules/openstack_project/manifests/git.pp @@ -0,0 +1,58 @@ +# Copyright 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Class to configure cgit on a CentOS node. +# +# == Class: openstack_project::git +class openstack_project::git ( + $sysadmins = [], + $git_gerrit_ssh_key = $git_gerrit_ssh_key, + $gerrit_url = 'review.openstack.org' +) { + class { 'openstack_project::server': + iptables_public_tcp_ports => [80, 9418], + sysadmins => $sysadmins, + } + + include cgit + + file { '/etc/cgitrc': + ensure => present, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/openstack_project/git/cgitrc' + } + + file { '/home/cgit/.ssh/': + ensure => directory, + owner => 'cgit', + group => 'cgit', + mode => '0700', + require => User['cgit'], + } + + file { '/home/cgit/.ssh/known_hosts': + owner => 'cgit', + group => 'cgit', + mode => '0600', + content => "${gerrit_url} ${git_gerrit_ssh_key}", + replace => true, + require => File['/home/cgit/.ssh/'] + } + + class { 'selinux': + mode => 'enforcing' + } +}