summaryrefslogtreecommitdiff
path: root/README
blob: 09b1bbfffd95bd1cdc4e4967547cabc9bd6a20b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Dedicated syntax highlighting server for cgit.

Use a simple HTTP server to highlight source for cgit. Improves performance
compared to invoking python on every request.

Usage:

1. Run `make install`.
2. Configure your system to run /usr/lib/cgit/syntax-highlighting-server.py at
   boot. This can be done by `systemctl enable syntax-highlighting` on systemd
   machines. Note that syntax-highlighting-server is very insecure. Therefore,
   do not configure it to listen on a public network.
3. Set your cgit source filter to syntax-highlighting-client.sh.

Tuning:

By default, syntax-highlighting-server does all work in a single thread. If you
have a high query load and multiple CPUs, consider setting --listen-mode to
forking or reuseport.

reuseport mode uses one worker per CPU and is the highest performance mode, but
requires Linux and additional idle memory (roughly 1-3 MB per worker).

forking mode uses less idle memory and is compatible with non-Linux systems,
but is significantly less efficient, since it forks for every request.

Security:

syntax-highlighting-server is not hardened against malicious clients which send
malformed data or are simply excessively slow. Once again, do not configure
syntax-highlighting-server to listen on a public network. It is also
recommended to set max-blob-size in cgitrc, as the entire file must be buffered
in memory during syntax highlighting.