Configure gotwebd
(redirected from Gotweb.Install)
Game of Trees provides gotwebd(8), a CGI server which provides a web interface for got repos.
Installation
gotwebd(8) is written by OpenBSD developers, but it exists as a third-party package rather than as part of the base system. So first, install gotwebd:
# pkg_add gotwebd
Make sure you have openhttpd configured properly. You will need a block similar to this one in httpd.conf(5):
types { include "/usr/share/misc/mime.types" } server "example.com" { listen on * port 80 location "/.well-known/acme-challenge/*" { root "/acme" request strip 2 } root "/htdocs/gotwebd" location "/" { fastcgi socket "/run/gotweb.sock" } }
After you edit httpd.conf(5), reload httpd(8) with:
# pkill -HUP httpd
Enable and restart slowcgi(8):
# rcctl enable slowcgi # rcctl restart slowcgi
Configuration
httpd(8) runs inside a
chroot by default, so first create /var/www/etc/
:
# mkdir -p /var/www/etc
Next, configure
gotwebd.conf(5). Inside
/var/www/etc/gotwebd.conf
, customize the logo and URL:
server example.com { logo "logo.png" logo_url "https://got.example.com" max_commits_display 100 site_link "repos" site_name "Made on Example.com" site_owner "Example.com" }
Copy the site logo to /var/www/htdocs/gotwebd
:
# cp /path/to/logo.png /var/www/htdocs/gotwebd/ # chown root:bin /var/www/htdocs/gotwebd/logo.png
Sync repos
Create the directory for gotwebd(8)'s web files:
# mkdir -p /var/www/got/public # chown -R _gotd /var/www/got/public/
By default, gotwebd's files will be read by the user www
, so public repos
(by default stored in /var/www/got/public/
) must be readable by the user
www
. In our gotd setup, we made our git repos in
/var/git/
world-readable. Permissions will be preserved when copied into
/var/www/got/public/
:
# chmod o+rx /var/git/example.git
Now, use openrsync to sync the repos:
$ doas -u _gotd /usr/bin/openrsync -a --delete --rsync-path=openrsync /var/git/ /var/www/got/public/
Cronjobs
A cronjob for user _gotd can help periodically sync repos:
# crontab -e -u _gotd ~ * * * * openrsync -a --delete --rsync-path=openrsync /var/git/ /var/www/got/public/
This will sync the repos from /var/git/
to /var/www/got/public/
once an
hour.
Start gotwebd
Now, enable and start gotwebd(8):
# rcctl enable gotwebd # rcctl start gotwebd