I've been using Ghost for nearly a year now and I'm loving it. The whole blogging experience is amazing and so simple. I wrote a post when I started this blog on how to set it up. Okay, but time passes and technology evolves, new versions come up, and now it's time to upgrade it. I started on version 0.9 which was a pre-release, now they're on 1.10 where they've implemented a lot of nice features that I was looking forward to having, for example, schedule a publish and nice filters in the admin area.
Upgrading sounds like an easy task, but I had a lot of pain over several days to make it work in Azure. Downloading the engine from ghost.org/developers and running locally was actually quite simple and a very nice experience, but as soon as I crossed the line to deploy it to Azure then the pain started.
Just so you don't need to go over the pain I went through, I published my tweaked version of Ghost to my GitHub repository. The changes are not major, just a few configurations regarding port and URL, and also a script to deploy to Azure.
Follow the steps below to deploy your instance of Ghost to your Azure subscription.
Go to my repository at github.com/thiagospassos/tryghost
Find this button and click on it
Follow the azure deploy wizard and be happy.
Loading deployment script from repository
Set up where you want your blog to be deployed
Check what resources will be created and click on Deploy.
The deployment now started and should take several minutes to finish. Just go and grab a coffee.
Your blog is now available and ready to go. You can also click on manage to check it in the Azure Portal
And you're done!!! Happy blogging.
If you don't care about the technicalities, just don't bother reading this part. I tried achieving this in several different ways, like using kudu custom scripts, creating the web app in Azure and pointing to the official Ghost repository, tweaking the source files in Azure. It was painful.
The new version of Ghost uses a new database structure which requires you to run a migrator script, which requires you to install a global package which doesn't quite work in the Azure context, I ended up updating the
package.json to include
"postinstall":"npm bin && knex-migrator init" and for this to work, I've added an extra package to the
The major issue I had was regarding port configuration, and because Azure doesn't simply use a port number, that made my life harder. When running Ghost locally, it simply uses the default port
2368 and it all works, in Azure you can't simply set the production port to be
80, it uses something like this
\\.\pipe\e317fe18-7017-4a09-84fb-773a54cf0738. So in the
ghost-server.js file under
core/server, I had to replace
process.env.PORT || config.get('server').port so it would use the port coming from Azure.
These were the 2 majors challenges I found and I'm glad I found a solution for them so I can sleep well.