Chris Ciborowski bio photo

Chris Ciborowski

I'm a technologist & entrepreneur helping companies see the endless possibilities provided by DevOps and cloud application delivery. I'm a Docker Captain and CEO & CO-founder at Nebulaworks.

Twitter Google+ LinkedIn Github

When deciding what platform I was going ot use for my blog, I considered all of the “normal” choices, like Wordpress, Blogger, etc. For some blog sites, they work brilliantly…like our company pages. Easy to setup for multiple authors, WYSIWYG (for less technical folks) and social media is well integrated. But for me, I really wanted to use something that would be easy for me to write and very easy highlighting of terminal commands (for posts like this one. Since I spend a lot of time on the command line, working there would be great as well. After finding Jekyll, I was sold. Call it the hackers website/blogging tool if you will - but it looked to fit my requirements perfectly.


While you certainly can run a Jekyll site on GitHub, I really didn’t want to go through the process to host there. So, I was thinking of hosting the pages on my personal web host. But the more I looked into it, a better solution became apparent. Run it in OpenShift Online, for free. Once I found the OpenShift Jekyll cartridge, it was super easy to get the site up and running. In addition, since OpenShift is well integrated with the git tools, updating the site with new posts is dead easy. So, if you are thinking of using Jekyll for a simple website or blog, here is a quick how-to.

Before we start, you’ll need to have access to an OpenShift environment. In this case I am using OpenShift Online (openshift.redhat.com). I’ll leave creating an account up to you.

First, you’ll need the Red Hat Cloud (RHC) tools. They require Ruby, so that is the first thing that you’ll need to verify:

$ ruby -e 'puts "Welcome to Ruby"'

If you get the welcome message, great. If not, go get Ruby installed on your system :)

Next, install the RHC tools:

$ gem install rhc

Now that they are installed, let’s setup the tools so we can access our OpenShift environment and deploy applications:

$ rhc setup
OpenShift Client Tools (RHC) Setup Wizard

This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git
are properly installed.

If you have your own OpenShift server, you can specify it now. Just hit enter to use the server for OpenShift Online:
openshift.redhat.com.
Enter the server hostname: |openshift.redhat.com|

You can add more servers later using 'rhc server'.

Login to openshift.redhat.com: <openshift_username>
Password: <openshift_password>

OpenShift can create and store a token on disk which allows to you to access the server without using your password.
The key is stored in your home directory and should be kept secret.  You can delete the key at any time by running
'rhc logout'.
Generate a token now? (yes|no) yes
Generating an authorization token for this client ... lasts about 1 month

Saving configuration to /Users/xxxxxxxxxxx/.openshift/express.conf ... done

Your public SSH key must be uploaded to the OpenShift server to access code.  Upload now? (yes|no) yes

Since you do not have any keys associated with your OpenShift account, your new key will be uploaded as the 'default'
key.

Uploading key 'default' ... done

Checking for git ... found git version 1.8.4

Checking common problems .. done

Checking for a domain ... none

Applications are grouped into domains - each domain has a unique name (called a namespace) that becomes part of your
public application URL. You may create your first domain here or leave it blank and use 'rhc create-domain' later. You
will not be able to create an application without completing this step.

Please enter a namespace (letters and numbers only) |<none>|: <your_namespace>
Your domain '<your_namespace>' has been successfully created

Checking for applications ... none

Run 'rhc create-app' to create your first application.

  Do-It-Yourself 0.1                      rhc create-app <app name> diy-0.1
  JBoss Application Server 7              rhc create-app <app name> jbossas-7
  JBoss Data Virtualization 6             rhc create-app <app name> jboss-dv-6.0.0
  JBoss Enterprise Application Platform 6 rhc create-app <app name> jbosseap-6
  JBoss Unified Push Server 1.0.0.Beta1   rhc create-app <app name> jboss-unified-push-1
  Jenkins Server                          rhc create-app <app name> jenkins-1
  Node.js 0.10                            rhc create-app <app name> nodejs-0.10
  PHP 5.3                                 rhc create-app <app name> php-5.3
  PHP 5.4                                 rhc create-app <app name> php-5.4
  PHP 5.4 with Zend Server 6.1            rhc create-app <app name> zend-6.1
  Perl 5.10                               rhc create-app <app name> perl-5.10
  Python 2.6                              rhc create-app <app name> python-2.6
  Python 2.7                              rhc create-app <app name> python-2.7
  Python 3.3                              rhc create-app <app name> python-3.3
  Ruby 1.8                                rhc create-app <app name> ruby-1.8
  Ruby 1.9                                rhc create-app <app name> ruby-1.9
  Ruby 2.0                                rhc create-app <app name> ruby-2.0
  Tomcat 6 (JBoss EWS 1.0)                rhc create-app <app name> jbossews-1.0
  Tomcat 7 (JBoss EWS 2.0)                rhc create-app <app name> jbossews-2.0
  Vert.x 2.1                              rhc create-app <app name> jboss-vertx-2.1
  WildFly Application Server 8.2.0.Final  rhc create-app <app name> jboss-wildfly-8

  You are using 0 of 3 total gears
  The following gear sizes are available to you: small

Your client tools are now configured.

Boom. Our RHC tools are configured, and we are ready to create our Jekyll site. Let’s do so, and instantiate the Jekyll cartridge:

$ rhc app create jekyll
https://raw.github.com/openshift-cartridges/openshift-jekyll-cartridge/master/metadata/manifest.yml
The cartridge 'https://raw.github.com/openshift-cartridges/openshift-jekyll-cartridge/master/metadata/manifest.yml'
will be downloaded and installed

Application Options
-------------------
Domain:     <your_namespace>
Cartridges: https://raw.github.com/openshift-cartridges/openshift-jekyll-cartridge/master/metadata/manifest.yml
Gear Size:  default
Scaling:    no

Creating application 'jekyll' ...
done


Waiting for your DNS name to be available ... done

Cloning into 'jekyll'...
The authenticity of host 'jekyll-<your_namespace>.rhcloud.com (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is cf:xx:77:cb:dd:fc:02:xx:72:7e:ae:xx:c0:90:xx:a7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'jekyll-<your_namespace>.rhcloud.com,xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
Checking connectivity... done

Your application 'jekyll' is now available.

  URL:        http://jekyll-<your_namespace>.rhcloud.com/
  SSH to:     xxxxxxxxxxxxxxxxx0000e0@jekyll-<your_namespace>.rhcloud.com
  Git remote: ssh://xxxxxxxxxxxxxxxxx0000e0@jekyll-<your_namespace>.rhcloud.com/~/git/jekyll.git/
  Cloned to:  /Users/xxxxxxxxxxx/Development/jekyll

Run 'rhc show-app jekyll' for more details about your app.

Alright! If you’ve got this far, OpenShift is now setup to host your site. Cool, eh? And if you head to the URL above, you’ll see that it is serving the basic page located in your local clone.

Next, if you haven’t installed Jekyll locally, let’s do so:

$ gem install jekyll

Depending on what your final result is (i.e., needing additional gems) you’ll need to add those too, but for simple sites you’re all set.

We’re almost done now…couple more steps and your site will be up and running. Let’s go ahead and fire up jekyll locally, make some changes, and push to OpenShift:

$ cd /Users/xxxxxxxxxxx/Development/jekyll
$ jekyll build -wq &
$ git commit -a -m 'First Commit'
$ git push

Now head over to your unique URL on OpenShift Online, and checkout your new blog! If you want to add a CNAME for a personalized domain, you can find the instructions under your application settings at the OpenShift Online website.