MEAN Stack – Deploy to Azure

In this video we’ll deploy a production app to Azure.

We look at:
– Nodejitsu is shutting down!
– Creating an Azure Web App
– Deploying to Azure using continuous source control
– How to fix .NET errors following deployment

If you have issues with your deployment, try changing the following in your package.json file:
“scripts”: {
“start”: “node server.js”,

If you have issues with mongoose and connect-mongo (native packages), you may have to include them in Git.

Video Transcript

Hi I’m Shristi, so one of my favourite web hosts Nodejistu, are shutting down and I have a heap of web apps that I need to find new homes for. So, over the last few weeks I’ve been looking into all of the different cloud hosts on the market trying to find the right fit for some of the apps that I have.

I’m looking for something that’s really light touch, something that I don’t need to worry about too much.
I stumbled across Azure – well I’ve heard about it before but I hadn’t really used it myself up until a few weeks ago. What I found, what was pretty cool, is Azure have or Microsoft has, a Biz Spark program.

So if you’re like me, if you run a startup you can actually get on this program, it takes about a week or so to get approved for it and once you’re approved you’ve got two or three years of access to a heap of Microsoft products, plus you get credit – monthly credit to use for Azure, so that’s really cool because it means that you can actually try out proper production based servers for your app and actually use that as you’re growing a startup or even a side project idea.

So I do have one of these accounts and a few weeks ago I actually hosted an app up on Azure and it actually has been fine in the time that it’s been up which has been pretty cool. So today I just wanted to go through a really quick introduction to what Azure is all about and how you can host your MEAN Stack, or any Node, or any kind of web app up on Azure.

This one is actually a really good host for someone who may not be all that comfortable or all that confident using the command line, because you can pretty much get everything up and running without using any command line – which is a little bit different to some of the other web hosts we’ve looked at in the videos that I’ve covered so far.

Without any further ado let’s jump in. So this is the one app that I’ve actually previously created so there’s not too much exciting going on here I just need to jump down and click on the NEW button at the bottom.

It selects ‘Compute’ and ‘Web App’ for me which is great, that’s what I want, there’s a couple of options you can use. You can do a Quick Create which means there are a couple of other options that you have, but you can set them up later. Or we can to go down the Custom Create which is actually something that I’m going to do now because it actually lets me set up my continuous deployment from source control.

What that means is that – say you are working on your project and you want to back it up and you’re using Git and you want to push that through your source control. You might be using GitHub to save that or you might using be using Bitbucket or any of those kind of tools.
What you can do here is hook straight into that, you don’t have to push code directly to Azure, you can just push it to GitHub or Bitbucket or any of those kinda things, and it will just suck it all up and make that available for you.

We’re going to start off with a url that’s available, I’m just going to see if that’s available there. It’s already defaulted my service plan, my subscription. I don’t want a database. If you’re using an SQL database you can select that. For a Mean Stack based product I don’t need one of those.

I’m going to choose this little checkbox down the bottom which is ‘publish from source control’, once I’ve done that just click Next. What that did do by the way, it just added a second page here, so it means that when I click the arrow it’s going to go across to the next page. You can then identify or tell this wizard process where your source code is actually sitting. Say it’s on Dropbox you can even grab it straight from there.

Mine is in Bitbucket, so I’m going to tell it that that’s where it is, and just click on the Next button. This is going to authorise with Bitbucket. Because I have an app already it has already got my details and it’s gone ahead and used those to authenticate.

If you’re doing this for the first time you will have to obviously put in your username and password to make sure that your authentication works.

I’m just going to select a repo name for the repo that I want and that’s pretty much it. So, fingers crossed and let’s see how this goes. The deployment process is actually fairly straightforward. There’s only pretty much what we’ve just done, but so far I’ve had a couple of issues with not everything quite working straight away.

I’m just going to see how we go, it always makes me a little bit anxious when things happen so fast because it feels like something may have failed somewhere along the line which is why it’s so quick, so let’s have a look.

I’m going to just have a quick look at the deployment, ‘information about the deployment’ I should say. Okay, so looks like it’s still deploying, so it’s probably set up the web app or the base place to put the app first and now it’s going through and actually grabbing everything it needs from Bitbucket and hopefully deploying all of that code.

Awesome, so once your deployment is complete it should show up as Active Deployment, it should show some details of your last commit, whatever you did last.

It seems to have an issue with the .NET Framework which is really weird because it’s a Microsoft Server! It’s installed all the bower packages. So it seems like the issue is that .NET bit. Let’s see if I can do something about that. It should have the most recent version.

What I’m going to do is just restart it see if there’s just a problem with how it has been set up. Try that. Excellent, there we go so that’s my app and it’s up and running now.

It was a very quick and easy process, if you had an issue in the same way that I did, just try and restart and see if that fixes it for you I hope that helped, please subscribe to the YouTube channel or check out www.bossable.com for more details.

Let me know the kind of things that you’re working on at the moment, what kind of issues you’re having or difficulties or things that are slowing you down and let’s see if we can work through them together.

I’ll keep sharing my stories for the different things I’m working on now, and hopefully that helps you out as you’re going through your app building situations too. Alright cool, I’ll see you again soon!

Category: Mean Stack

6 Comments

Let me know what you think

  • thatweezal
    Reply

    Can I deploy to AWS? Advantages in your opinion to Azure vs. AWS? I’d love to use bower/grunt/yo/meanjs like you did in the first video – can I do that from linux on AWS AMI?

    Thanks!

    • bossable

      Ah really? Bummer, you’ll need to have a look through your console errors, and then have a look at your deployment logs in Azure. If you can narrow down the errors then it’ll be easier to debug.