Tag: deployment

ArchitectureInfrastructure

Manage Azure App Service Deployments with Deployment Slots

Every App Service resource in Azure has the ability to have multiple deployment slots configure. These deployments slots are a feature than can greatly help with the implementation of streamlined testing, staging, and deployment process. Along with the ability to configure multiple hosting environments, the use of Deployment Slots enables zero downtime when deploying application changes, or even rolling back a failed deployment.

Creating Deployment Slots

Deployment slots are a feature of Azure App Service Plans. As a result, every App Service resource (Web App, Web API, Mobile App) in Microsoft Azure has the ability to create up to 4 additional deployment slots with the Standard tiers, and up to 20 deployment slots with the Premium tiers.

Each App Service (in Standard tiers) can have up to 4 additional Deployment Slots in addition to the Production slot.

Each Deployment Slot allows for a separate instance of the application to be hosted in isolation from the other deployment slots and production slot of the App Service. The VM behind each Deployment Slot is the same VM Instance that hosts the production deployment slot. This means that the App Service and 4 additional Deployment Slots will all be hosted in and share the same VM Instance and resources.

To create App Service Deployment Slots in the Azure Portal, just navigate to the App Service, select the Deployment slots section and click the Add Slot button to create a new Deployment Slot.

azureappservice_portal_deploymentslots

Additionally, in order to use the Deployment Slots feature of Azure App Service, the pricing tier must be either Standard or Premium. The Free, Shared, and Basic pricing tiers do not support deployment slots.

It’s important to keep in mind that all Deployment Slots share the same VM Instance and server resources.

Deployment Slot URL / Endpoint

Azure App Service applications get a unique URL that is made up of the App Service Name as the subdomain of the azurewebsites.net domain. In the above screen shot, the App Service Name is “testapp2063” which means the URL / endpoint for the Production slot of the App Service is located at testapp2063.azurewebsites.net.

When creating Deployment Slots each slot gets it’s own URL / Endpoint. The endpoint for each deployment slot derives from the endpoint for the Production slot by appending the name of the deployment slot with a hyphen.

With an App Service named “testapp2063” the URL / Endpoint for the following deployment slots will have the following values:

  • dev => testapp2063-dev.azurewebsites.net
  • test => testapp2063-test.azurewebsites.net
  • stage => testapp2063-stage.azurewebsites.net

azureappservice_portal_deploymentsloturl

Deployment Slot Swapping

Swapping Deployment Slots is the method of copying the currently deployed application code and settings of one deployment slot and swapping it with another. Swapping allows for the deployment of application code to be done from one environment to another very quickly. It also allows for a couple new deployment techniques that didn’t exist in traditional server hosting.

To swap Deployment Slots from the Azure Portal, just navigate to the list of Deployment Slots for an App Service or navigate to the specific Deployment Slot that needs to be swapped. Then, click the Swap button and specify which Deployment Slot to swap with. See the above screenshots for reference of where the Swap button is located within the Azure Portal.

When an application is deployed using Deployment Slot swapping, there is zero downtime

When an application is deployed using Deployment Slot swapping, there is zero downtime of the application. The way this is implemented is by just rerouting the Deployment Slot Endpoint between the Deployment Slots being swapped. Both deployment slots remain running and actively responding to client requests throughout the swap.

Staged Deployment

The technique of performing a Staged Deployment allows for application code to be deployed to a non-production deployment slot (such as one named stage) to test or verify functionality is working as expected. Then once everything has been verified, the Stage deployment slot can be swapped with Production making the staged application deployment the new Production instance of the application.

Incremental Deployment

There are times when deploying application changes might require additional changes other than just deploying the latest code. These requirements could be running SQL scripts or some other post deployment step necessary to fully deploy the latest code. Deploying to a Stage deployment slot can allow for these Incremental steps to be performed after the code is deployed in a way that can be tested and verified before deploying to production.

Rollback Deployment

Every once in awhile a deployment fails for some reason. Maybe files end up corrupt, a major bug is found, or some other reason for failure. In these cases, it’s necessary to rollback a deployment. Using Deployment Slots, a deployment can be rolled back easily buy just swapping the Deployment Slots back.

Basically, swap Stage with Production to deploy new changes. When a major bug is found that requires a rollback, then the Production and Stage Deployment Slots can be swapped back. This allows for the old application code to be rolled back into Production in a matter of minutes. This leads to greatly decreased downtime in the event of a deployment failure.

InfrastructureOpen Source

Tutorial: Create Minecraft Server in Azure on an Ubuntu VM

Setting up a Minecraft server generally takes a bit of work from installing the Operating System, installing Java, to setting up the Minecraft Server to run itself. This is all in addition to putting some kind of hardware together to run it, and if you do it at home it’s only available to players on your local Wifi / network. When you create a Minecraft Server in the cloud, such as Microsoft Azure, the entire setup is completely automated and the resulting Minecraft Server is available across the Internet to any players you want to invite to your server. Additionally, the cost of running the server is likely much lower than you might expect. In this article, we’ll run through the steps necessary to setup a Minecraft Server to run in Microsoft Azure. We’ll also discuss the cost implications of running a Minecraft Server in the cloud, along with some tips and tricks for keeping the cost as low as possible.

Whether you want to create a Minecraft Server just for yourself, your friends, or your own kids, this article will get you through the setup process and give you the knowledge you’ll need to host your very own Minecraft Server! Read More

Azure CLIDevelopmentDevOpsInfrastructurePowerShell

What is Azure Resource Manager?

In the early days of Microsoft Azure the Portal was the primary tool to go in and configure your cloud components. After some time the Azure Service Manager API’s were introduced as a set of both PowerShell and Command-Line tools (X-Plat CLI). These tools allowed for Azure Automation to be scripted, however they were still a bit cumbersome as they were procedural based. More recently Microsoft overhauled the entire Azure Portal that exists today as well as a brand new set of Azure Resource Manager API’s. The purpose of Azure Resource Manager is more than just replacing Azure Service Manager. It’s real purpose is a story about automation and DevOps. Read More

Architecture

Hosting Environment Isolation: How and Why

Automated Builds, Continuous Integrations, DevOps, Oh my!!┬áThere are a ton of buzz words surrounding the different methods and ideas for managing hosting environments and deployments. One of the greatly implied concepts that isn’t really discussed very much is the importance of keeping different hosting environments for the same application (ala Dev, Test, UAT, Staging, Production, etc.) separate / isolated. During the development and maintenance processes these different environments can easily be mixed and messed with. This article will explain some details on why they should be kept separated, and how to keep them separated. Read More