Ghost 0.5.x from Source to Azure Web Sites

This is part 1 of 3 of a blog series where David Wesst takes you through getting Ghost 0.5.x working from source control on Azure Websites.


Plus, I'm because I'm better with JavaScript than PHP, I get to learn from the source code.

The Problem

I upgraded to 0.5.x which was a big release.

My original code, which is a copy of the downloaded Ghost source code that continually upgraded was no longer working. Rather than fix it again so I decided I would take the plunge and install and deploy straight from the original source code provided by Ghost.

With a little bit of thought and reading I put this solution together.

Let me explain.

The Solution

Here's what I did.

Fork, Clone, and Run the Repo Locally

Have a Github account and fork the Ghost repository.

The branch you want for production is the stable branch.

Clone it onto your machine:

   `git clone<username>/Ghost.git`

Get the dependencies and source setup:

  `npm install` then `grunt init` and finally `grunt prod`

And now run it locally.

    `npm start`

Tada! Now you have a Ghost blog working on local machine at localhost:2368.


Now we setup the Azure Website.

Side Note
I had to download and install Python 2.7.x to get the setup to work on my Windows machine. Not sure if it's required, but it made things work for me.

Your Azure Website

Setup your Azure website however you want. Here's some links on doing that. Attach it to source control and ensure it uses the appropriate branch (stable or otherwise).

Quick Note

Although you have a number of options, I used a git deployment exclusively. More specifically, I attached a site to a Github repository. There are tricks to that too, but I'll save that for another post.

A Couple of Changes

You'll need to make a couple of changes to get your source ready for Azure. Fill out your ‘config.js’ file as per Scott Hansleman's post. Check out the Getting Ghost from Source and Configuring Ghost before you Deploy sections.

Commit your changes to source and push them to your Github fork.

Be sure NOT to commit your config.js to source control if you're using an open source Github repository.

Deploy and Fail

Congrats! You finished and it’s broken. Not to worry, that is expected.

It will try and deploy, but the site won't work because the default deployment script for Azure doesn't execute `grunt init` or `grunt prod`.

So, we need to customize the deployment script.

We'll do that next time.


Comments (0)

Skip to main content