GOT-PORTABLE(7)

NAME
got-portable - Notes relevant for the -portable version of Game of Trees

GOTWEBD WITH AN HTTP SERVER
In order to make use of gotwebd(8) an HTTP server needs to be configured to send traffic to gotwebd(8). For the purposes of illustrating this, nginx(1) will be used.

  Nginx Configuration
Setting up nginx involves a server configuration similar to the following:

    https {
    	server {
    		listen *:80;
    		root /var/www/htdocs;

    		location / {
    			index index.html;
    		}

    		location /gotweb {
    			include fastcgi_params;
    			fastcgi_pass unix:/tmp/gotwebd.sock;
    		}
    	}
    }

With this directive, port 80 is used. There is the location of “/” which is serving the page “index.html”.

The location “/gotweb” includes the fastcgi parameters (because gotwebd(8) is a FastCGI server, this must be included). Then, the rest of the requests are forwarded to gotwebd(8) over the defined unix domain socket. Note that the path to the socket must match what's defined in gotwebd.conf(5)

  Gotwebd Configuration
The following example config shows a bare-minimum example of how to ensure gotwebd(8) is listening on the appropriate port, and that the relevant parts from nginx(8) are also referenced correctly. This is not meant as a complete tutorial for configuring gotwebd(8). For that, see: gotwebd(8) and gotwebd.conf(5).

Note the in-line comments explaining how and why gotwebd(8) is being configured in this way.

    # The "www user" line should match the user that's running nginx.
    www user "www-data"

    # This is the user which gotwebd should run as.
    #
    # Note that this user must have permission to read the repositories
    # set via `repos_path`.
    #
    # This should be an unprivileged user.
    user n6tadam

    # This is the unix domain socket gotwebd will create and listen on.
    # This must also be set correctly in nginx's configuration.
    listen on socket "/tmp/gotwebd.sock"

    # Because we told nginx that we wanted to serve up gotwebd traffic via
    # `/gotweb`, we should let gotwebd know this is also where traffic is coming
    # from.
    gotweb_url_root "/gotweb"

    # Matches the home directory of the "www user".
    #
    # Note that it is assumed that under this directory
    chroot "/var/www"

    server "localhost" {
    	disable authentication
    	site_name "Public repos"
    	site_owner "Thomas Adam"
    	site_link "Thomas' Projects"

    	# This is where all the bare repos live.
    	repos_path "/home/n6tadam/p/got/root/repos"
    }

Note that with the configuration above, gotwebd(8) expects to serve up artefacts relative to the chroot path, which defaults to: “htdocs/gotwebd”. These files might be packaged already, and might live somewhere under “/usr/share/got-portable/”. However, they are packaged in the release tarball, and the “gotwebd/files/htdocs/gotwebd” directory should be copied to “htdocs/” relative to the chroot line in gotwebd's configuration file.

SEE ALSO
got(1), gotwebd.conf(5), gotwebctl(8), nginx(8)

AUTHORS
Thomas Adam <thomas@xteddy.org>