How to install Jekyll on Webfaction
If you want to host Jekyll on Webfaction, you have do it in various ways. The easiest one, might be to generate your site locally and then rsync to a static-only site created on Webfaction.
However, this tutorial considers this assumptions.
- You are version controlling your site with git
- You will use git push to deploy your site
- The site will be generated in Webfaction servers
- You are using gem 2.0, you can change that.
Install needed software
Prepare your system
You need to install it on your home folder, as you do not have root privileges, add this to your bashrc file
Then reload it.
gem2.0 install jekyll gem2.0 install RedCloth
Add this line at the bottom of .bashrc file.
Reload .bashrc file.
This is everything you need to run Jekyll with markdown documents or textile
The idea is to have webfaction's server deploying the site automatically as soon as the committed changes are pushed to it.
Create a bare git repository
mkdir ~/git-repos/my-jekyll-blog.git cd ~/git-repos/my-jekyll-blog.git git init –bare
Prepare the post-update hook
It should have these lines
#!/bin/bash echo “Deploying Jekyll Site” # Here are the variables REPOSITORY_DIR=”/home/user/git-repos/my-jekyll-blog.git” DEPLOY_DIR=”/home/user/tmp/jekyll-temp/” # dont edit below here DEPLOY_TMP_DIR=$(mktemp /home/user/tmp/jekyll.deploy.XXXXX) rm -f $DEPLOY_TMP_DIR git clone $REPOSITORY_DIR $DEPLOY_TMP_DIR cd $DEPLOY_TMP_DIR jekyll build -d $DEPLOY_DIR rm -rf $DEPLOY_TMP_DIR cd / # Modify this line to fit your folders rsync -vrz –checksum -e ssh –delete $DEPLOY_DIR /home/user/webapps/your-site/
The reason to deploy to a temp folder and the rsync to the webapp folder, is to have the creating dates old, that improves caching.
In your local computer:
git remote add webfaction email@example.com:/home/user/git-repos/my-jekyll-blog.git
Push to it, to publish your site:
git push webfaction master