« Back to home

Deploying Ghost blog to Azure manually

Installing Ghost on Azure is simple and can be done by creating a new website > gallery. As of the current writing, Azure installs the 0.3.3 version and the latest Ghost that's out is 0.4. You can go down that route or take the manual route which I will cover in this post. I also tried setting it up from the Azure gallery but it was too easy for my taste, and besides, I like having my files backed up in Dropbox.

The goal of this post is to keep the instruction as minimal and simple as possible so it can be referenced over and over again.

Installation

Install Azure on NodeJS via NPM. I found this easier than doing a Windows installation through the web platform installer.

npm install azure-cli -g

The next step is to download the publish settings file:

azure account download

Once the publishsettings file has been download to your local directory, import the settings by doing the following. Ddon't forget the quotes around the file name. After the successful import, delete the settings file.

azure account import "<file>.publishsettings"  

Creating a new Azure website via command line is by doing the following. It will ask for the name of the site, location, username and password.

azure site create --git

It will make you go to Azure and login to your account. If you go to your newly created website, click on the 'Deployments' where the Git deployment has been created. The instruction for adding to Git will be there.

A change that you will have to make on the config.js (production configuration) is to set the port to use process.env.PORT.

server: {
    host: '127.0.0.1',
    port: process.env.PORT
}

Add the URL where your Git repository resides (instructions can be found here:

git remote add azure your_azure_git_end_point.git

Finally, since Azure looks for server.js file, you need to copy the index.js.

copy index.js server.js

After all the local file changes, commit your changes locally:

git add .
git commit -m "First commit"

And push to azure. This will ask for your Git repository password that you setup either on the command line or on the Azure website.

git push azure master

Browse the URL that you have created on the Azure server and make sure that it's running properly. You will need to create a new login by visiting the admin login page, /ghost.

Update: March 17, 2015

Going through this motion once again when I updated Ghost to the newest version, I encountered an issue when pushing my git repository to azure. Git, fatal: The remote end hung up unexpectedly.

The reason for this is the huge amount of files that are being pushed up to the cloud. After doing some research, setting the git buffer should take care of this issue.

git config http.postBuffer 524288000

Comments

comments powered by Disqus