Deploying Ghost Blogging Platform With OpenShift

First, let's see how we can get a fresh Ghost install running. Once I'm up and running there will be a follow up post with instructions for adding a custom domain and re-deploying theme customisations.

Create an account with OpenShift

Head over to OpenShift and create an account. I'm going to use the free plan for now, this should give us everything we need to get up and running.

Install OpenShift Client Tools (rhc)

I'm using a Mac/OS X machine, so be aware that the installation steps may vary slightly if you're running a Windows or Linux machine.

Make sure Ruby is installed and up-to-date, then open your terminal and run:

sudo gem install rhc  

You should see a bunch of gems have been installed. Now you can start the rhc setup wizard:

rhc setup  

The first step is the least obvious (albeit still pretty obvious). You will see this prompt:

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:  

Just hit enter, we will be using the default server. Then the wizard will ask for your credentials and walk you through creating and uploading your SSH key. These will allow you to connect to the server from your local machine.

Create Ghost application

You can create a new application from your OpenShift account but I decided to have a go at creating it from the command line as it actually seemed more staright forward.

The way OpenShift works is to deploy code from a github repository to the server. OpenShift provides 'quickstart' repo's that we can make use of for common applications such as Ghost.

rhc app create ghost nodejs-0.10 --env NODE_ENV=production --from-code https://github.com/openshift-quickstart/openshift-ghost-quickstart.git  

After executing the app create command, you will be prompted to authenticate then you should see some output informing you that your application is now available.

You'll be provided with the application url, the domain to use for SSH access and the path on your local machine where the Git repo has been cloned to:

URL:        http://.rhcloud.com/  
SSH to:     ####@ghost-hanked.rhcloud.com  
Git remote: ssh://####@ghost-hanked.rhcloud.com/~/git/ghost.git/  
Cloned to:  /Users/davekingsnorth/Desktop/playground/ghost  

Now if you navigate to the provided application URL, you will see a fresh install of Ghost running.

Now I need to create an alias so that my app can use my own domain. I also want to make some changes to the default 'Casper' theme and re-deploy my app.