We, software developer mainly develop products/features to fulfill the dream of client requirement. And as we work on for them it turns out that testing plays a vital role in the entire process to ensure the development of a perfect solution that matches client requirement. So, testing in QA and UAT, A/B testing all becomes the integral parts of the process. Usually beta/uat/etc testing was carried out in separate environments. On the other hand the production site run on standalone server(s). Once the product pass all the testing phases the developed solution then moved to production server. From our experience we have seen that moving stuff between environments required a series of backups, deployment scripts, scheduled downtime etc.
So, the gist of entire process is that no matter which deploying strategy (WebDeploy, FTP, git, CI or any other way) you might be using today have the following two major weaknesses
- After the deployment completes the website might restart and this results in a cold start for the website, the first request will be slower (can be significant depending on the website) and this can ultimately drop some traffic of your website.
- Deploying a bad version of your website often create/opens new hole for hacker. They could take the advantage of your broken code and can mess with your business.
With the introduce of deployment slots azure makes deployment process much more secure and developer friendly. Now within the same website configuration, you can create multiple slots where you can deploy different versions of your code, i.e dev, staging, qa, uat, etc. and can all be accessed through the browser using the right url prefix.
Advantage of deployment slot :
- By deploying a site to a slot first and swapping it into production ensures that all instances of the slot are warmed up before being swapped into production. This eliminates downtime as the traffic redirection is seamless, and no requests are dropped as a result of swap operations.
- No backups required! you can seamlessly deploy a slot to production using the Swap operation.
- Since each slot comes with it’s own separate endpoint URL testing become easier
- Support of continuous deployment allows to constantly push the latest code to the slot
- Manually push the changes are also supported.
So, I have already discussed the advantages that you will get from deployment slots. But What are deployment slots actually?
Well, deployment slots are actually live web apps with their own host names. It carries the name of the Azure Web App + the name of the slot, for example: If your Azure Web App is called testsite and you have create a slot called staging then it will be named testsite(staging) and its url will be http://testsite-staging.azurewebsites.net.
It’s important to emphasize that the slot is in itself a regular Azure Web App, it will have its own app settings, connection string, any other configuration settings and even an scm site (https://testsite-staging.scm.azurewebsites.net).
Note to self :
By default each Azure Web App has a single deployment slot called production which is the Azure Web App itself.
How many slots I can have ?
Right now for standard website you could have 4+1 slots for deployment which gives you more deployment options, this is good because you can keep multiple versions of your site and alternate between them while continuing to develop.
Its pretty impressing, How can I create a slot?
Creating a slot is just that easy. Log in to the new portal and from there open the website for which you want to create a slot.
Clicking the Settings button will open the Settings blade. From there scroll down till you find Deployment Slots(As shown in the following image).
Eventually this will open up the deployment slot blade. Click the Add Slot
The first time you add a slot, you will only have two choices: clone configuration from the default slot in production or not at all. After you have created several slots, you will be able to clone configuration from a slot other than the one in production. your-web-app-name–deployment-slot-name will appear at the top of blade to remind you that you are viewing the deployment slot.
Did you Notice?
Newly created deployment slot contains NO CONTENT! This is to allow deployment from a different repository branch, or a different repository all together.
In this article we went for a high level overview of deployment slots, why we need this and what are the advantages we could gain from this. However , we have not gone in details how swapping works, how to configure auto swap etc. We will check those out in the upcoming article.