I wanted a simple web presence, mostly as an exercise but partly as a space to post thoughts and notes that I will find useful in the future, and perhaps others may find useful. In this vein this post will cover what I did to build this site, the rationalization behind my choices, and any other bits about the process that I think are interesting.

building the server

For the sake of rapidity, I prototyped the website on an Openstack instance in a cloud using a ‘tiny’ Ubuntu 14.04 (Trusty Tahr) image. I installed the following packages, required for getting the site up:

  • ruby
  • ruby-dev
  • nodejs

building the site

This was wickedly simple. On my local system (OS X) I built the local site repository using jekyll, which will also allow us to generate the content locally for review before committing.

$ jekyll new wrldswrst.ninja && cd wrldswrst.ninja
$ git init
$ git add .
$ git commit -m "Initial commit"

On the web-server I will made a change to the nginx configuration, because I prefer to have my web content in /var/www/ and since I will be serving only html, my only site will be in /var/www/html. The config file is at /etc/nginx/sites-available/default. Configure as appropriate. Set the ownership of /var/www/ to your user (not root!). We will also need to install jekyll:

$ sudo gem install jekyll

Next, build the repo and initialize. This will be kept under my working account on the server (not root!).

$ cd ~/
$ mkdir repos && cd repos
$ mkdir wrldswrst.ninja.git && cd wrldswrst.ninja.git
$ git init --bare

Build ~/repos/wrldswrst.ninja.git/hooks/post-receive. This will clone the wrldswrst.ninja repository to a temp directory in ~/ then use jekyll to build the source to /var/www/html

#!/bin/bash -l
GIT_REPO=$HOME/repos/wrldswrst.ninja.git
TMP_GIT_CLONE=$HOME/tmp/git/wrldswrst.ninja
PUBLIC_WWW=/var/www/html

git clone $GIT_REPO $TMP_GIT_CLONE
jekyll build --source $TMP_GIT_CLONE --destination $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit

Then set the script to executable.

Back on your local machine, add a remote repo called ‘web’:

$ git remote add web <user>@wrldswrst.ninja:~/repos/wrldswrst.ninja.git

making it all pretty

I really like Solarized, so I looked and found mattvh’s theme. Perfect, just cloned from git over my local jekyll directory, and made my modifications.

final thoughts

Really, that was all it was. I think it took more time to document this process than it did to actually do it. However, there is much more I want to do, not the least of which is a secure (https) certificate. Otherwise, I now have a very simple work-flow for publishing content using the tools I like, with a very simple code-base to maintain, with the help of my own git repo. Next I will work on automating the build, so it will be easy to migrate later.