Enabling `*.go` files in the syntax highlighter.
[gitweb-sgk] / README.md
... / ...
CommitLineData
1# Overview #
2
3This is a fork of `gitweb` containing customizations used on
4<https://git.subgeniuskitty.com>.
5
6Changes include defaulting to side-by-side diffs, automatically displaying
7README files when present, and a new tree+readme page for 'summary' mode.
8
9
10# Status #
11
12Working. Runs <https://git.subgeniuskitty.com> on Debian Linux.
13
14
15# Instructions #
16
17The following instructions work on Debian 10. All paths are examples from
18the SGK gitweb server located at <https://git.subgeniuskitty.com>. For more
19details, including accompanying scripts, see sysadmin notes on
20<https://subgeniuskitty.com/notes/mail_web_git_server>.
21
22-----
23
24Verify 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
29Create 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
88Create an Apache vhost definition among the Apache2 configuration files. For
89the Debian 10 server that runs <https://git.subgeniuskitty.com>, this means
90creating the file `/etc/apache2/sites-available/git.subgeniuskitty.com/conf`
91with 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
115Clone a copy of the gitweb repository into the vhost's webroot. Ensure it is
116owned by an SSH-enabled user for management, and that permissions are suitable
117for reading by the Apache2 user, usually `www-data` on Debian.
118
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
122
123In order to maintain a public/private split, gitweb only displays repos that
124have been cloned into `/srv/gitweb_cache`. Remember to set `.git/description`
125and `.git/category` for any repos cloned into this gitweb cache folder.
126
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
133
134Turn everything on.
135
136 a2enmod cgi
137 a2enmod rewrite
138 a2ensite git.subgeniuskitty.com
139 systemctl reload apache2
140