We recently added support for Jekyll:
Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server.
git from the command line for a few months.
Combining these together gives us a means of easily deploying blog-centric static sites reliably (thanks to git's atomic transfers) and with ease, thanks to all the general benefits of git and the simplicity of Jekyll.
I use Hosting Reborn to host a number of personal sites. Today I've been deploying some of these via git and Jekyll.
Here's an overview of how to do this with Hosting Reborn within a cPanel environment.
Bear in mind that this is a highly technical subject and not something we can offer support for. If you don't know what git is or if you're not familar with command line utilities this probably isn't for you. If you're comfortable, read on.
Step 1: Build your Jekyll-powered site
The details of this are entirely up to you - make your site however you like.
The important part is that you store the code in a publicly-accessible git repository. I'd recommend using github - you'll be making a public site and so using a free, public repository from github is fine.
Step 2: Create a new hosting account for your new site
You've created a new site. Creating a new hosting account to run this site from is a nice way of keeping it cleanly separate from your other sites. It doesn't cost anything to just add a hosting account, so log in and do that.
I'm assuming you've got a fresh hosting account for your new site. This doesn't need to be the case but the rest of this guide assumes so.
Step 3: Open an SSH connection
Everything else from here onwards is carried out via the command line. You really should know how to establish an SSH connection. What follows is a refresher.
If you're running Windows you'll probably be using PuTTY. If you're using a Mac or Linux, just open up a new terminal and type in:
substituting your hosting account's cpanel username and your hosting account's domain name as required.
Step 4: Command line deploy and build
There's just a handful of commands you need to issue to retrieve your code with git and build your static content with Jekyll.
First, let's clone the git repository holding your code.
We want to the code to be in your hosting account's home directory. Given that you cannot create a git repository in a non-empty directory and given that your hosting account's home directory will start off containing a number of files and directories, we can't clone straight into your hosting account's home directory. We'll move things though a temporary directory to get by this
From your hosting account's home directory, we're going to create a temporary installation directory, clone your repository into that and then move the contents back into your hosting account's home directory:
mkdir install cd install git clone https://github.com/example/example.com . mv * .. mv .git .. mv .gitignore .. cd .. rm install
We're now back in your hosting account's home directory and we've copied your cloned git repository to the same location.
Let's now build the static site from the source using Jekyll:
That's it. You'll see output similar to:
Configuration from /home/username/_config.yml Building site: /home/username -> /home/username/_site Successfully generated site: /home/username -> /home/username/_site
Spot the problem? The default configuration generates the static site content into a directory named
_site. You could have changed the default configuration to generate the site in
public_html. But you haven't, and you don't strictly need to.
If your static content is in
_site, the next step is for you.
public_html point to
We've got a brand new hosting account, haven't we? As such, the pre-supplied
public_html directory is empty and isn't needed. We can just remove (or, more safely, rename) this and make a link with the same name point to the
mv public_html public_html.bak ln -s public_html _site
There we go, we've made a backup of the pre-existing
public_html directory (just in case you find you want it back) and we've created a symlink named
public_html that points to the
_site directory into which your static site has just been generated.
Updating your site
We're now in a position where we have Jekyll on hand to generate your static site content from your source and you have your source in an easily-accessible git repository.
Assuming you've made changes to your site, updating is really simple:
# Pull changes from your repository git pull # Regenerate your static content jekyll
That's mostly it. You've got an atomically-updateable static site that you can easily update and, through using git, you can version and branch and tag as needed.
Taking further steps
Given that Jekyll requires ruby, this means you've got ruby access at the command line, offering the option of further automating your deployment with a rakefile.
This means that I can update a site and it's external dependencies by just issuing a single
rake command. And once you've got an automated build and deployment process in place that's just the start.