Index

resty-gitweb / master

A git web interface for Lua/OpenResty (you're on it right now!)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1713 Oct 2021 20:5472a1883Update S3 image source endpointsJosh Stockin111G

Blob @ resty-gitweb / README.md

text/plain4090 bytesdownload raw
1# resty-gitweb
2
3A git web interface for Lua/OpenResty.
4
5![Sample image](https://joshstock.in/static/images/resty-gitweb.png)
6
7## Requirements
8
9Lua modules (Lua 5.1/LuaJIT 2.1.0/OpenResty LuaJIT compatible, accessible from
10Lua path/cpath):
11
12| Module | Description |
13| ------ | ----------- |
14| [lyaml](https://github.com/gvvaughan/lyaml) | Reads and parses YAML config files |
15| [puremagic](https://github.com/wbond/puremagic) | MIME type by content, used in blob rendering |
16| [etlua](https://github.com/leafo/etlua) | Embedded Lua templating (for HTML rendering) |
17
18Other command line tools (installed on system path, accessible from shell):
19
20| Program | Description |
21| ------- | ----------- |
22| [md4c](https://github.com/mity/md4c) (md2html) | Renders GitHub flavored Markdown |
23| [highlight](http://www.andre-simon.de/doku/highlight/en/highlight.php) | Syntax highlighting in HTML format |
24
25Linkable Libraries (installed on system path, accessible with LuaJIT's C FFI):
26
27| Library | Description |
28| ------- | ----------- |
29| [libgit2](https://github.com/libgit2/libgit2) | Dynamically linkable C API for Git |
30
31## Using
32
331. Copy this directory with its scripts to a place OpenResty/nginx workers have
34 access, such as `/srv/[SITE]/resty-gitweb`. (In reality it doesn't matter
35 where, as long as it's accessible.)
36
372. Copy your config file (`resty-gitweb.yaml`) to
38 `/etc/[SITE]/resty-gitweb.yaml` (or somewhere else)
39
403. Add the following near the top (`main` context, outside of any blocks) of
41 your OpenResty/nginx configuration file:
42
43```
44# resty-gitweb won't run without this
45env RESTY_GITWEB_ENABLED=;
46
47# PROD for Production, DEV for Development. DEV by default.
48env RESTY_GITWEB_ENV=PROD;
49
50# Wherever you put your configuration file
51env RESTY_GITWEB_CONFIG=/etc/[SITE]/resty-gitweb.yaml;
52```
53
544. Add the following to the `http` block in your OpenResty/nginx configuration
55 file:
56
57```
58# Add resty-gitweb to your Lua package path
59lua_package_cpath "/usr/local/lib/lua/5.1;;"
60lua_package_path "/usr/local/share/lua/5.1;/srv/[SITE]/resty-gitweb/?.lua;;";
61
62# Initialize modules for nginx workers
63init_by_lua_file /srv/[SITE]/resty-gitweb/init.lua;
64```
65
665. And in whichever `location` block you wish to serve content:
67
68```
69# Delegate request to OpenResty through resty-gitweb app script
70content_by_lua_file /srv/[SITE]/resty-gitweb/app.lua;
71```
72
736. Reload OpenResty/nginx to update config
74
75## OpenResty or nginx?
76
77Note that I use "OpenResty/nginx" instead of just OpenResty; while you can just
78install and use the pre-built
79[OpenResty](https://openresty.org/en/download.html) package, you could actually
80use nginx with only a few added OpenResty components. These are the only
81OpenResty components you actually need to
82[compile](https://www.nginx.com/resources/wiki/extending/compiling/) to use
83this package:
84
85#### nginx modules
86
87* [lua-nginx-module](https://github.com/openresty/lua-nginx-module)
88
89#### Lua libraries
90
91(run `sudo make all install LUA_VERSION=5.1` for each)
92
93* [lua-resty-core](https://github.com/openresty/lua-resty-core)
94* [lua-resty-shell](https://github.com/openresty/lua-resty-shell)
95* [lua-resty-lrucache](https://github.com/openresty/lua-resty-lrucache)
96* [lua-resty-signal](https://github.com/openresty/lua-resty-signal)
97* [lua-tablepool](https://github.com/openresty/lua-tablepool)
98
99Note that lua-nginx-module is the only nginx module that needs to be installed
100with nginx compatibility. The other dependencies just need to be installed on
101your Lua path/cpath. **If you're compiling OpenResty components yourself, you
102may need to build them with OpenResty's
103[branch](https://github.com/openresty/luajit2) of LuaJIT 2.1.0 instead of the
104original.**
105
106(The full OpenResty package has far more precompiled OpenResty components, so
107you may just want to use that if resty-gitweb isn't the only thing you want to
108use OpenResty for.)
109
110## Copyright and Licensing
111
112This package is copyrighted by [Joshua 'joshuas3'
113Stockin](https://joshstock.in/) and licensed under the [MIT License](LICENSE).
114
115&lt;<https://joshstock.in>&gt; | josh@joshstock.in | joshuas3#9641
116