Static Hosting

From Dark Peak
Jump to: navigation, search

Static web-hosting is made available to git repositories through the use of hooks. This allows you to push html/js/css to a Gitolite hosted repository and see the changes automatically appear on the web.

Enabling web hosting for a repository

First, clone your gitolite-admin and find the entry for the target repository inside the conf/gitolite.conf file. Then, update the repo with the following 'pages' hook.

repo mywebsite
  option hook.post-update = pages
  RW+ = username

Commit and push this change to the server and your 'pages' hook will be installed on the 'mywebsite' repository. On your next update to the 'mywebsite' repository, you'll be able to view the website at http://username.pages.darkpeak.org/mywebsite.

Custom web root

You can host sub-directories as the root of your site by adding a config option to your conf/gitolite.conf. Eg, to serve your website from ./www, use the following:

repo mywebsite
  config pages.directory = "www"
  option hook.post-update = pages
  RW+ = username

This will take effect the next time you push an update to the mywebsite repository. NOTE: deleting config options will NOT reset them, if you want to reset your pages root directory change the value from "www" to "." or "" (empty string).

Custom domains

To use your own domain name for the site, add a CNAME file containing the domain name to the root directory of the target repository. Only one custom domain can be setup per repository.

Example CNAME file:

example.com

You'll have to update your domain with your DNS provider to point to the Dark Peak servers. If you want to use a subdomain, eg foo.example.com, you can add a CNAME record for that subdomain to point to the Dark Peak servers (46.43.14.116). If you'd like to use an apex domain, eg example.com, then setup an A record for your domain which points to the Dark Peak servers (46.43.14.116).