A git web interface for Lua/OpenResty (you're on it right now!)
{#} | Time | Hash | Subject | Author | # | (+) | (-) | GPG? |
---|---|---|---|---|---|---|---|---|
6 | 28 Dec 2020 15:43 | 9944977 | Update git_commands.lua with libgit2 bindings | Josh Stockin | 3 | 393 | 58 | G |
Object | Latest Commit Subject | Time | Hash |
---|---|---|---|
git | Update git_commands.lua with libgit2 bindings | 28 Dec 2020 15:43 | 9944977 |
pages | Expand tabs to spaces in blob rendering | 15 Dec 2020 20:21 | 1f62b32 |
utils | Fix gsub | 15 Dec 2020 20:21 | 8df3cdd |
LICENSE | Initial commit (imported, read description) | 13 Dec 2020 16:16 | e49d46e |
README.md | Update README | 15 Dec 2020 18:48 | adbeb10 |
app.lua | Update copyright notices | 15 Dec 2020 18:52 | 7890389 |
init.lua | Update git_commands.lua with libgit2 bindings | 28 Dec 2020 15:43 | 9944977 |
libgit.lua | Update git_commands.lua with libgit2 bindings | 28 Dec 2020 15:43 | 9944977 |
repos.yaml | Initial commit (imported, read description) | 13 Dec 2020 16:16 | e49d46e |
A git web interface for Lua/OpenResty.
Lua modules (Lua 5.1/LuaJIT 2.1.0/OpenResty LuaJIT compatible, accessible from Lua path/cpath):
Module | Description |
---|---|
lfs | Filesystem API |
lyaml | Reads and parses YAML config files |
puremagic | MIME type by content, used in blob rendering |
etlua | Embedded Lua templating (for HTML rendering) |
Other command line tools (installed on system path, accessible from shell):
Program | Description |
---|---|
md4c (md2html) | Renders GitHub flavored Markdown |
highlight | Syntax highlighting in HTML format |
Linkable Libraries (installed on system path, accessible with LuaJIT's C FFI):
Library | Description |
---|---|
libgit2 | Linkable C API for Git |
Copy this directory with its scripts to a place OpenResty/nginx workers have
access, such as /srv/[SITE]/resty-gitweb
. (In reality it doesn't matter
where, as long as it's accessible.)
Copy your config file (resty-gitweb.yaml
) to
/etc/[SITE]/resty-gitweb.yaml
(or somewhere else)
Add the following near the top (main
context, outside of any blocks) of
your OpenResty/nginx configuration file:
# resty-gitweb configuration
env RESTY_GITWEB; # Script won't run without this
env RESTY_GITWEB_ENV=PROD; # PROD for Production, DEV for Development. DEV by default.
env RESTY_GITWEB_CONFIG=/etc/[SITE]/resty-gitweb.yaml; # Wherever you put your configuration file
http
block in your OpenResty/nginx configuration
file:lua_package_path "/usr/local/lib/lua/5.1;/srv/[SITE]/resty-gitweb/?.lua;;"; # Add resty-gitweb to your Lua package path
init_by_lua_file /srv/[SITE]/resty-gitweb/init.lua; # Initialize modules for nginx workers
location
block you wish to serve content:content_by_lua_file /srv/[SITE]/resty-gitweb/app.lua;
Note that I use "OpenResty/nginx" instead of just OpenResty; while you can just install and use the pre-built OpenResty package, you could actually use nginx with only a few added OpenResty components. These are the only OpenResty components you actually need to compile to use this package:
(run sudo make all install LUA_VERSION=5.1
for each)
Note that lua-nginx-module is the only nginx module that needs to be installed with nginx compatibility. The other dependencies just need to be installed on your Lua path/cpath. If you're compiling OpenResty components yourself, you may need to build them with OpenResty's branch of LuaJIT 2.1.0 instead of the original.
(The full OpenResty package has far more precompiled OpenResty components, so you may just want to use that if resty-gitweb isn't the only thing you want to use OpenResty for.)
This package is copyrighted by Joshua 'joshuas3' Stockin and licensed under the MIT License.
<https://joshstock.in> | josh@joshstock.in | joshuas3#9641