Deploying Octopress to Engine Yard’s Orchestra Platform

Note: This blog post comes to us from Peter Meth of True North PHP. Check out the original post here.

When I decided to start blogging I was faced with some choices. The first choice to be made was which blogging software to use. I have had some experience using Wordpress and have never been too happy with it. I have also used Joomla, which I don’t think is too well suited to blogging. I figured I would give Drupal a try. It was ok, but ultimately left me with the same feeling as Wordpress.

Then I discovered something that made me say “Yes, this is it”. That something was Octopress. As a developer, I am comfortable doing things on the command line, performing builds and deploys. This is exactly the type of user Octopress targets. In fact, here is a quote from the Octopress documentation:

First, I want to stress that Octopress is a blogging framework for hackers. You should be comfortable running shell commands and familiar with the basics of Git. If that sounds daunting, Octopress probably isn’t for you.

Now that I had decided on using Octopress, I next needed to figure out where to host it. One of the services I have been hearing a lot about that I have been wanting to play with is Engine Yard, so I thought it would be a good opportunity to try them out as a potential home for my blog. In checking the Octopress documentation, they list several deployment options but none of them are Engine Yard. So, here’s how I managed to deploy my Octopress blog to Engine Yard’s Orchestra PHP Cloud. ###Step 1: Setup a Github account if you don’t already have one The documentation is your friend here. https://help.github.com/articles/signing-up-for-a-new-github-account ###Step 2: Setup a new Github repository https://help.github.com/articles/create-a-repo ###Step 3: Setup Octopress Simply follow the steps at the Octopress website to get setup. You can ignore the “Next Steps” section at the bottom as that is basically what I am going to go through. ###Step 4: Add Github as a remote repository

git remote add github ssh://[email protected]/{your Github username}/{repo name from step 6}.git example: git remote add github ssh://[email protected]/pmeth/methlog.git

###Step 5: Create a new blog post

rake new_post["Post Title"]

###Step 6: Generate the static pages

(rake generate)

###Step 7: Remove the public directory from the .gitignore file

grep -v ^public$ .gitignore > .gitignore2 & mv .gitignore2 .gitignore

###Step 8: Commit your generated blog

git add -A & git commit -m 'writing first blog post'

###Step 9: Push your blog up to Github

(git push github master)

###Step 10: Sign up for Engine Yard’s Orchestra PHP Cloud https://login.engineyard.com/signup/orchestra?locale=en ###Step 11: Deploy an App Click the button to Deploy an Orchestra PHP Application. The free one is sufficient for now, but if you decide you like the service or need to use some of the advanced features, you should consider signing up for their paid service.

When setting up the App, you will be asked for your app name (this will become the subdomain if using the Free account), your Github public repo url, the branch name and the index file. Make sure the index file is public/index.html then click Launch App.

Deploying your app

After a minute or two of waiting, Engine Yard should have pulled down your blog from Github and launched it on their servers for you to enjoy. The Orchestra control panel will give you a link to the website, which is labelled “Public Hostname”. You can click on it to view your newly created blog.

To make any changes to your blog you simply make changes to the appropriate page under source/_posts, run rake generate, commit your changes then git push github master. After a few minutes, Engine Yard will sense the updates, and automatically apply the changes. ###That’s it. The nice thing about hosting your blog on Engine Yard is that if you write a popular blog post that gets “Slashdotted” or makes it to the front page of Hacker News, Engine Yard will automatically scale up to meet the demand (note this feature is not available on free apps) and your blog won’t take down your server. When the traffic dies down, it will automatically scale back down again.