Octopress is a framework for blogging based on the static site generator jekyll. In short jekyll takes markdown and turns it into blog style html ready to be served straight away with Apache whilst Octopress dresses it up nicely with HTML5, responsive layout goodness and gives you a bunch of options for code formatting and the like. A perfect little blogging setup for hackers for those of us who typically won’t need all the bells and whistles on our blog I’m sure you’ll agree.
Using Octopress, you’d typically write your posts in markdown and process them locally. You’d then have a number of HTML pages to upload to your web server, which would appear no different than any other blog in terms of functionality.
The most interesting thing that coincincides with the creation of jekyll is that it is now possible to serve static websites straight from Amazon S3, meaning that it isn’t neccessary to have a web server to serve a Octopress blog. I’ve been playing a little and have been able to serve my own octopress blog which you can see over at www.ianwootten.com. Here’s how to do it:
Configure an S3 Bucket to Act as a Website
NB: If you want to use your own domain, then you’re going to need to create an S3 bucket from the AWS Console named the same as your domain (so for me I created a bucket called “www.ianwootten.com”.
To configure your bucket as a website, from the AWS Console, select the new bucket and click “Properties”. Choose the “Website” tab from the box that appears and check “enabled” and set the Index document as “index.html”. Click “Save”. Now move to the “permissions” tab and click “Add bucket policy”. Enter a policy as below, with “www.ianwootten.com” replaced with the name of the bucket you’re using.
If you’ve opted not to use your own domain, then that’s it for S3. Your new bucket website will be available at a combination of the bucket name and the S3 storage location. In my case, this is http://www.ianwootten.com.s3-website-us-east-1.amazonaws.com/. There’s a list of endpoints on the “website endpoints” page in Amazons S3 website docs.
If you’re wanting to use your own domain, then you’ll need to visit your domain registraar and edit some DNS entries. In my case, I added a CNAME entry “www” pointing to www.ianwootten.com.s3-website-us-east-1.amazonaws.com. You’ll need to use a tool like wwwizer in order to forward from the root of your domain to the www subdomain. e.g. “ianwootten.com” to “www.ianwootten.com”. To get that working, you’ll also need to modify the @ A record and point it to 126.96.36.199. Read this serverfault post if you’re interested to know why.
For more info on CNAME configuration and S3 see Amazons S3 website docs (Specifically the notes on virtual hosting).
Download Octopress and write some Markdown
Having successfully configured Amazon S3 to host your blog, you need to tackle the age old problem of writing some content for it. This was particularly hard for me, given my lack of knowledge about markdown! You may like to take a look at John Grubers explanation of markdown if you’re suffering like me. The Octopress blogging basics gives a good overview of how your new local blogging workflow will work. Essentially new posts are written in the ./_source/posts folder and when
rake generate is executed, your entire websites content is output to the ./public folder. You can also run
rake preview in order to preview on a local server.
TO publish your blog, it’s merely a matter of transferring your /public content to the S3 bucket you’ve generated.
Having done all that you’ve now no need to run your own server. You’re still dependent on those that operate at S3, wwwizer and your domain registraar, but you’ve removed your own from the equation. You may be interested in checking out Jerome Bernard’s tip on easily deploying Octopress blogs with s3cmd.