Commit | Line | Data |
---|---|---|
04d6166a AT |
1 | # Overview # |
2 | ||
3 | This is a fork of `gitweb` containing customizations used on | |
4 | <http://git.subgeniuskitty.com>. | |
5 | ||
c14efc3f AT |
6 | Changes include defaulting to side-by-side diffs, automatically displaying |
7 | README files when present, and a new summary page. | |
04d6166a AT |
8 | |
9 | # Status # | |
10 | ||
11 | Working. Tested on <http://git.subgeniuskitty.com>. | |
12 | ||
13 | # Instructions # | |
14 | ||
15 | The following instructions work on Debian 10. All paths are examples from | |
16 | the SGK gitweb server located at <http://git.subgeniuskitty.com>. For more | |
17 | details, including accompanying scripts, see sysadmin notes on | |
18 | <http://subgeniuskitty.com>. | |
19 | ||
20 | ----- | |
21 | ||
22 | Verify prequisites are installed. Syntax highlighting is provided by | |
23 | `highlight` and markdown-to-HTML processing is provided by `discount`. | |
24 | ||
25 | apt-get install gitweb highlight discount | |
26 | ||
27 | Create a Gitweb configuration file at `/etc/gitweb.conf`. For example, | |
28 | <http://git.subgeniuskitty.com> uses the following configuration file. | |
29 | ||
30 | $site_name = "git.subgeniuskitty.com"; | |
31 | @git_base_url_list = ("git://git.subgeniuskitty.com"); | |
32 | $projectroot = "/srv/gitweb_cache"; | |
33 | $git_temp = "/tmp"; | |
34 | ||
35 | @stylesheets = ("static/gitweb.css"); | |
36 | $javascript = "static/gitweb.js"; | |
37 | $logo = "static/sgk-logo.png"; | |
38 | $favicon = "static/git-favicon.png"; | |
39 | ||
40 | # git-diff-tree(1) options to use for generated patches | |
41 | @diff_opts = (); | |
42 | ||
43 | # Enable PATH_INFO so the server can produce URLs of the | |
44 | # form: http://git.hokietux.net/project.git/xxx/xxx | |
45 | # This allows for pretty URLs *within* the Git repository, | |
46 | # also needs the Apache rewrite rules for full effect. | |
47 | $feature{'pathinfo'}{'default'} = [1]; | |
48 | ||
49 | # HTML text to include as home page header. | |
50 | $home_text = "indextext.html"; | |
51 | ||
52 | # Add a toolbar option with the 'git clone url'. | |
53 | $feature{'actions'}{'default'} = [('clone url', 'git://git.subgeniuskitty.com/%n', 'summary')]; | |
54 | ||
55 | # Category name is read from .git/category, in the same manner as .git/description. | |
56 | $projects_list_group_categories = 1; | |
57 | $project_list_default_category = "misc"; | |
58 | ||
59 | # Needed for displaying README files. | |
60 | $prevent_xss = 0; | |
61 | ||
62 | ################################################################################ | |
63 | ||
64 | # Enable blame, pickaxe search, snapshop, search, and grep | |
65 | # support, but still allow individual projects to turn them off. | |
66 | # These are features that users can use to interact with your Git trees. They | |
67 | # consume some CPU whenever a user uses them, so you can turn them off if you | |
68 | # need to. Note that the 'override' option means that you can override the | |
69 | # setting on a per-repository basis. | |
70 | $feature{'blame'}{'default'} = [1]; | |
71 | $feature{'blame'}{'override'} = [1]; | |
72 | ||
73 | $feature{'pickaxe'}{'default'} = [1]; | |
74 | $feature{'pickaxe'}{'override'} = [1]; | |
75 | ||
76 | $feature{'snapshot'}{'default'} = [1]; | |
77 | $feature{'snapshot'}{'override'} = [1]; | |
78 | ||
79 | $feature{'search'}{'default'} = [1]; | |
80 | ||
81 | $feature{'grep'}{'default'} = [1]; | |
82 | $feature{'grep'}{'override'} = [1]; | |
83 | ||
84 | $feature{'highlight'}{'default'} = [1]; | |
85 | ||
86 | Create an Apache vhost definition among the Apache2 configuration files. For | |
87 | the Debian 10 server that runs <http://git.subgeniuskitty.com>, this means | |
88 | creating the file `/etc/apache2/sites-available/git.subgeniuskitty.com/conf` | |
89 | with the following contents. | |
90 | ||
91 | <VirtualHost *:80> | |
92 | ServerName git.subgeniuskitty.com | |
93 | ServerAdmin webmaster@subgeniuskitty.com | |
94 | ||
95 | DocumentRoot "/srv/apache_vhosts/git.subgeniuskitty.com" | |
96 | ||
97 | ErrorLog /var/log/apache2/error_log.git.subgeniuskitty.com | |
98 | CustomLog /var/log/apache2/access_log.git.subgeniuskitty.com combined | |
99 | ||
100 | <Directory "/srv/apache_vhosts/git.subgeniuskitty.com"> | |
101 | Options +FollowSymLinks +ExecCGI | |
102 | AllowOverride None | |
103 | Require all granted | |
104 | AddHandler cgi-script .cgi | |
105 | DirectoryIndex gitweb.cgi | |
106 | RewriteEngine On | |
107 | RewriteCond %{REQUEST_FILENAME} !-f | |
108 | RewriteCond %{REQUEST_FILENAME} !-d | |
109 | RewriteRule ^.* /gitweb.cgi/$0 [L,PT] | |
110 | </Directory> | |
111 | </VirtualHost> | |
112 | ||
113 | Clone a copy of the gitweb repository into the vhost's webroot. Ensure it is | |
114 | owned by an SSH-enabled user for management, and that permissions are suitable | |
115 | for reading by the Apache2 user, usually `www-data` on Debian. | |
116 | ||
117 | mkdir -p /srv/apache2_vhosts | |
118 | git clone /srv/git/gitweb-sgk /srv/apache2_vhosts/git.subgeniuskitty.com | |
119 | chown -R ataylor:ataylor /srv/apache2_vhosts/git.subgeniuskitty.com | |
120 | ||
121 | In order to maintain a public/private split, gitweb only displays repos that | |
122 | have been cloned into `/srv/gitweb_cache`. Remember to set `.git/description` | |
123 | and `.git/category` for any repos cloned into this gitweb cache folder. | |
124 | ||
125 | mkdir -p /srv/gitweb_cache | |
126 | git clone /srv/git/repo_name /srv/gitweb_cache/repo_name | |
127 | echo "A description goes here." > /srv/gitweb_cache/repo_name/.git/description | |
128 | echo "Category" > /srv/gitweb_cache/repo_name/.git/category | |
129 | printf '#!/usr/bin/bash\ncd /srv/gitweb_cache/repo_name/.git\ngit pull\n' > /srv/git/repo_name/hooks/post-update | |
130 | chmod +x /srv/git/repo_name/hooks/post-update | |
131 | ||
132 | Turn everything on. | |
133 | ||
134 | a2enmod cgi | |
135 | a2enmod rewrite | |
136 | a2ensite git.subgeniuskitty.com | |
137 | systemctl reload apache2 | |
d865f95d | 138 |