Carlsverre.com has just shifted from Hostingrails.com to a combination of Github and Google App Engine. The transfer was prompted because my Hosting Rails account expires in 4 days. At first I was just going to renew, but the more I thought about the joyous union of Git commits and appengine pulls, the more my mind was made up. So now that I got all the kinks worked out, here is a short tutorial for those of you who want to do it yourselves.

$ cd ~/dev

DryDrop

DryDrop is the key to the whole process. Developed by Antonin Hildebrand, DryDrop allows anyone to quickly deploy to Google App Engine from a Github repo. DryDrop is a Python application which grabs all the files in your repo, stores them in the Google cloud and serves them on your App Engine URL. Grab DryDrop from its Github repo like so:

$ git clone git://github.com/darwin/drydrop.git

You will also need the Google App Engine SDK which you can get here.

Getting the right info

To follow with this tutorial you will need a Github repo full of static files. Something similar to my Carlsverre.com repo would be perfect. Once you have your repo setup you will need to figure out what your raw pulling url is. A generic raw pulling url looks like this:

http://github.com/USERNAME/REPONAME/raw/BRANCHNAME

USERNAME and REPONAME should be obvious. Use master for BRANCHNAME unless you have another branch full of static files. My raw pulling url looks like this:

http://github.com/carlsverre/carlsverre.github.com/raw/master

To test it out, try navigating to the url followed by the name of a file in the repo. If you have the url right, the current version of the file in the specified branch should be returned.

Take a note of your raw pulling url now - we will need it later.

Setting up App Engine

The next step is to get your appengine project registered. Login using your Google account to the App Engine management console and click Create an Application. Once you have created an application, head back to the terminal to upload DryDrop.

Make sure you replace PROJECTNAME and other obvious variables with your own words.

$ cd ~/dev/drydrop
$ rake upload project=$PROJECTNAME

Initializing DryDrop

Now that you have uploaded DryDrop, it’s configuration time. Head to your shiny new project url (PROJECTNAME.appspot.com) and click admin section. The only setting we will change right now is the Content Source which you can find in the Settings tab on the left.

The DryDrop settings tab

Click on the pulling from url and change it to the raw pulling url you created earlier. Woo we are 99% there!

The last step

All you have left to do is setup a post-commit hook from your Github repo to your shiny new DryDrop app. Follow these steps and your set:

  1. Go to the Admin section of your Github repo
  2. Click the Service Hooks tab
  3. Click Post-Receive URLs on the left
  4. Add the following url (with keywords replaced) to your Post-Receive URLS:

http://YOURGOOGLEAPPNAME.appspot.com/hook/github

Can I use Jekyll with DryDrop?

A growing number of Github users are using Jekyll to create static sites for their Github projects. I use it to power this blog and am extremely happy with the result. As for using Jekyll with Drydrop I suggest one of two options:

  1. Create a _site.yaml file in the root of your Github repo which wrangles Drydrop into pointing requests in the right direction
  2. Commit Jekyll’s output directory into a different branch and point Drydrop to that branch rather than your master

I am eventually going to switch to option #2 as I see that as being a cleaner solution. For reference on how to set up your _site.yaml file you can check out mine here.

Comments? Suggestions?

This is the first tutorial posted on my shiny new Jekyll blog, so I would love any feedback that you’d care to share. I currently haven’t setup a main feedback system, but it is in the workings. For now you can get in touch with me via Twitter.