Scott Hanselman

UPDATED for 2015: How to install the nodejs Ghost blog software on Azure Web Apps (and the Deploy to Azure Button)

April 20, '15 Comments [9] Posted in Blogging | nodejs | Open Source
Sponsored By

What? Didn't I blog about this before? Yes, in fact, in 2013 I did an article showing how to get Ghost - a lovely nodejs-based blogging app - running on Azure.  The instructions involved making some changes to Ghost itself to make it friendlier to Azure and doing a git deploy. Since this post both Ghost AND Azure have become friendlier. ;)

Fast forward two years and the instructions have changed! In fact, they've gotten WAY easier. You can still theoretically follow most of my old instructions, but these new ones are WAY better, so just do it this way.

STEP 1

There's a "Deploy to Azure" button up at http://deploy.azure.com that you can get an put in YOUR GitHub project's Readme.md so folks can easily and quickly deploy your app as well!

Here's what you do. Head over to the GitHub repository for Ghost Azure. Click Deploy to Azure. That will automatically install Ghost for you in Azure.

The Deploy to Azure Button

The Deploy.Azure.com website will look at the repository from the HTTP Referer header. You'll end up with a nice form like this.

DO make sure to double check your settings, the Site Location is alphabetical right now, and you may not want your blog in Brazil. ;)

image

Hit Next, then check the summary that will warn you what's getting created, then hit Deploy. Boom. Azure will actually run through the template and setup Ghost (or whatever app you wanted) automatically.

  • Note it's setting it up from Source Control as well, although you can certainly change this. For example, you might want to Fork it yourself, and then Deploy.
  • However, as this is set up today, you won't get updates until you go to Deployments within the Azure Portal and click Sync. You decide if you want the app to update when new code is committed.

After it's created, you can manage your site in the Azure Portal. I made a little free one for this example, as can you if you like.

Ghost in the Azure Portal

And it works just great!

Ghost running on Azure

It's not super obvious what to do next. You'll need click the little chevron there, or visit something like /admin, and you'll get redirected to the Ghost setup process online.

image

Now you can start your first post!

My first post in Ghost

What's going on here?

Felix Rieseberg added a few files to Ghost and has the fork up here on GitHub. The most interesting one is the AzureDeploy.json. This is an Azure Resource Manager template. Here's another simple example from Elliot Hamai for an ASP.NET MVP app. This file tells Azure (and the Deploy to Azure button) what kinds of things it needs to create and actually gives the system enough information to build a whole form for you!

Maybe this is the perfect time for you to start your own blog! Perhaps you've been putting it off. Go check out my FREE two-hour documentary movie with Rob Conery called Get Involved in Tech! We will get you ready to jump into the world of Social Software Development.

Here's a video of Elliot and I talking about the Deploy to Azure button on Azure Friday. Here's Elliot's blog announcing Deploy to Azure and explaining more.

Remember that Ghost is open source and you can learn more at https://ghost.org!

DON'T WANT TO SIGN UP FOR AZURE? You can try Azure out for an hour without signing up for anything. Check out http://try.azurewebsites.net. You can make a PHP, Java, nodejs, Python, ASP.NET web app, or even setup Ghost itself. You can also try out Visual Studio online, which is basically a complete IDE in your browser written entirely in JavaScript.


Sponsor: Big thanks to our friends at Raygun for sponsoring the feed this week. I use Raygun myself and I encourage you to explore their stuff, it's really something special. Get full stack error reporting with Raygun! Detect and diagnose problems across your entire application. Raygun supports every major programming language and platform - Try Raygun FREE!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Monday, 20 April 2015 13:44:25 UTC
Scott: Thanks for posting this. I spent all day yesterday trying to get this to work, using your 2013 post among others. However, I am still having trouble with this. I have tried it multiple times this morning and only once did it appear to work. I do not know why it decided to work that time. When I turn on logging I get the following from the 500 error: "IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly."

I am not sure how to go about setting those permissions. Again, I believe it did nothing different between the one that worked and the others that did not.

Thanks
David
David Martin
Monday, 20 April 2015 17:59:37 UTC
Hey David,

I'm behind this thing, so let's figure this one out. Did you use the 'Deploy' button? And if so, did the deployment succeed?

If you log into the management portal and select 'Deployments', you can see the last deployment. Click the tiny arrow in the upper right and you should see the list of actions Azure took during deployment (http://imgur.com/Mhp7RFp). One of them is 'Running Deployment Command'. I'd love to see the log, especially if there are any errors in there! If you want to compare yourself, I posted the output of a successful deployment here: https://gist.github.com/felixrieseberg/111d57119634af1c8bc6.

All the best,
Felix
Monday, 20 April 2015 18:28:31 UTC
Awesome Scott gave it a run through and worked like a charm!
Monday, 20 April 2015 18:52:39 UTC
Felix: Thanks for jumping in here. I did use the Deploy button. Not sure if it would make a difference, but I forked your repro and used the Deploy button from there. I'm sure Scott wouldn't want his comments full of logs, so I have saved them off to my OneDrive here: http://1drv.ms/1cRAIii

Some other notes, again not sure if they make a difference:
1. I have tried both Free (Shared) and Basic setups on Azure
2. I have two Azure subscriptions
3. I tried 3 times and once it did work perfectly.

Thanks
David Martin
Monday, 20 April 2015 19:43:50 UTC
Why not Brazil? A bit Xenophobic. ;)
Regis Bittencourt
Monday, 20 April 2015 19:46:41 UTC
Regis - Você sabe que eu amo os meus amigos no Brasil!
Scott Hanselman
Tuesday, 21 April 2015 13:39:24 UTC
The biggest challenge I have had with Ghost on Azure is not the initial deployment, but updating.

It's been a while since I've had to, but I recall needing to go into the Azure console to do any NPM commands and restart the application and get the new version running again. Seemed a lot more difficult than it needed to be.

Still, Ghost is a great platform for me and what I'm using today.
Tuesday, 28 April 2015 21:28:27 UTC
This is really cool, I was trying it out and I was not able to make it work. It picks which subscription to add the site too automatically, and I don't have all the permissions on all the subscriptions I have under my account and therefor it fails because it picks the wrong subscription, and unfortunately I don't have a way to change the target. Or do I?
Mateus
Wednesday, 06 May 2015 20:13:37 UTC
Hi,
Wow that was easy!
I use Ghost and I tried many different deployment method. This one is very painless.

I found a strange bug that I have only with the version 6.0.2 of Ghost deployed with the magic button. If the slug (part of the url that match your title by default) contains the word "ghost", I got and error. In fact the slug got truncate. I may not be related to that, but it was only in that context that I was able to reproduce it.

Did someone else got that?

Regards,

Frank B.
Frank Boucher
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.