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