The art of building and launching a successful website has many facets to it. The build side itself is fraught with difficulty. Clients change their minds. Things turn out to be more complex than you first thought. Or (perish the thought), someone's been a tad too optimistic and things have overrun. Still, you soldier on, all pull together and make it over the line. Your website is ready to demo! Trouble is, it’s all on your local machine. You can see it fine, but what about other people? The world should be able to see your magnificent creation!
If you've never deployed anything to the cloud before, don't worry. It's a straightforward thing to set up. In this article, we’ll look at the simplest deployment pipeline. If you’ve not come across the term deployment pipeline before, it’s not as scary as it sounds. It’s just the steps you take to get your website onto a server where people can see it. These range from a simple file copy to a complex, automated flow with many steps. Right now, we need to work up to the automated flow. Baby steps and all that. Today, we’re focusing on copying a website to a server using Visual Studio. The server in question is Microsoft Azure. The website in question is our supercharged DataTables example site. If you haven’t checked it out, get familiar: Using DataTables with Web API.
Set Yourself Up An account in Microsoft Azure
We’ll start by getting things set up within Azure. The websites component in Azure has a free tier, which suits us fine. Head on over to Microsoft Azure sign-up.
If you’ve never used Azure before, you’ll need to set up an account. Head over to the sign-up page and click that bright green button. Once you’ve set your account up, you’ll need a portal subscription. Set that up too and we’ll be ready to go. If you’re not sure about any of this, I’ve created a handy PDF guide for all this. It talks you through each step, with screenshots. Grab it from the link below.
View original article
Create a New Web App Using Your New Azure Account
Once you’ve got access to the portal, you’ll need to create a new web app. This will house your virtual masterpiece. I’m calling mine levelnis-datatables, but you’ll need to come up with your own name. They have to be unique. The URL for mine will be http://levelnis-datatables.azurewebsites.net. Once it’s finished provisioning, I’ll be able to visit it in a browser and see a holding page. That’s no use though! Let’s get our website up there instead.
Get That Website Published!
We’ll use the Web Deploy feature in Visual Studio for this. That will publish the contents of our website to the Azure website we just created.
If you want to find out how Web Deploy works, there’s some useful technobabble here: Introduction to Web Deploy. If you just want to run with it, I quite understand! Right-click on the project in Solution Explorer and select Publish:
- Choose Microsoft Azure App Service.
- Select the app service we created within the Azure Portal. In my case, it’s levelnis-datatables (beneath levelnis-datatables-resources)
- On the Connection tab, validate the connection to be sure we’re all good.
- On the Settings tab, we’ll deploy the Release configuration. This avoids us publishing debug data, which we want to avoid doing on our live website.
- Click the Publish button.
Wait for a few seconds and a browser should pop up with your sparkly new website. I’m off to http://levelnis-datatables.azurewebsites.net. There it is, looking good. We’ll build on this knowledge in the next article and throw some source control into the mix.
How does this sound? You make a change to the website code or design. You commit that change to source control. You then push that change to a source control server in the cloud (in our case, it's BitBucket). Wait a couple of minutes and the website updates by itself. That’s next...
View original article