ActiveBlog

Static Site Stackato: Using Heroku Buildpacks for Jekyll
by Troy Topnik

Troy Topnik, June 19, 2012
Jekyll on Stackato

Portability is a core principle in Stackato. We developed it on a codebase which is not tied to any particular hypervisor. We distribute it in a variety of formats for all the popular hypervisors. Applications pushed to Stackato can be pushed to any Stackato PaaS and, depending on the language or framework, other Cloud Foundry-based platforms as well.

We've now also provided a migration path for Heroku users. With the Heroku buildpack support in Stackato 1.2 you can move applications between Heroku and Stackato using the same buildpacks. This is what I did when I experimented with moving my Github Pages site to Stackato.

Github Pages

I've been interested in Github Pages for a while. The appeal to me is that it's a free blogging platform that you can take with you if you ever want to put it somewhere else. You can work on your site "offline" and check things out by running jekyll --server locally.

I started mine (and abandoned it for months) before they had the lovely Automatic Page Generator feature, but I've managed to cobble together a site after pinching themes and bits of code from other people's Github pages.

After seeing couple of comments in those repositories along the lines of "make sure you remove all of my content!" I wondered if exposing the guts of my blog in a public repo was really for me.

I'm not quite paranoid enough to be scared away from free hosting, but if I were, this is how I'd move it to Stackato.

Heroku Buildpacks

We didn't make much noise about Heroku buildpack support when we released Stackato 1.2 because we wanted more time to test various buildpacks for the different frameworks and make sure they work just as well on Stackato. The Heroku buildpack I found for Jekyll worked with a couple of trivial changes.

We should talk about why we added buildpack support first though.

Both Stackato and Cloud Foundry are extensible at the internal code level. If you are setting up a system and have some familiarity with the Ruby codebase, you can add services, runtimes, and frameworks to your PaaS by writing some plugin code. We don't see that many people actually doing this yet, but it's a possibility for those willing to take the plunge.

Stackato is also highly customizable at the application container level. Developers pushing code to Stackato can configure the app environment using hooks in the stackato.yml file, installing packages, creating symlinks, moving files around, even downloading dependencies from source. We can do this safely because each application runs inside its own secure Linux container.

To make Stackato truly extensible for end users, we had to provide a mechanism that allowed developers to share these customizations. Not wanting to re-invent the wheel, we reused Heroku buildpacks.

Jekyll on Stackato

Jekyll is a static site generator written in Ruby. It reads in a collection of local config files, templates, styles, and text files and builds a static HTML site. This is basically what Github Pages does behind the scenes, but you can run it yourself on your local system by installing Jekyll ('gem install jekyll') and starting the server in the top-level directory of your site ('jekyll --server')

Getting this running on Stackato is equally simple. Create a stackato.yml file in the top directory of your site's repository that looks something like this:

name: mysite 
mem: 128M
framework: buildpack
env:
  BUILDPACK_URL: git://github.com/troytop/stackato-buildpack-jekyll.git 

Then push the site from the same directory:

stackato push -n

That's it. I now have a Jekyll site up and running on Stackato which is identical to the one I created with Github pages.

The buildpack used above is nearly identical to the Heroku buildpack created by Mark Pundsack. Feel free to use it to port your Jekyll site to any Stackato system - the Sandbox, your own micro cloud, your private cloud, wherever. Fork the repo and make it better (perhaps serving the site with something other than WEBrick?). It's all about sharing the recipes for making app deployment easier for all of us.

Subscribe to ActiveState Blogs by Email

Share this post:

Category: stackato
About the Author: RSS

Troy Topnik is ActiveState's technical writer. After joining ActiveState in 2001 as a "Customer Relationship Representative" (AKA Tech Support), Troy went on to lead the PureMessage Enterprise Support team before moving on to a technical writing role in 2004. His talent for describing software for new users stems from his difficulty understanding things that developers find obvious. He has a Bachelor of Music from the University of Victoria.

Comments

1 comments for Static Site Stackato: Using Heroku Buildpacks for Jekyll