ALM and DevOps practices with a sample ASP.NET Core 2.0 web app hosted in Azure Web App (Windows and Linux).
TOC
- History of changes
- Overview
- App Service (Windows) - Build and Release Definitions with VSTS
- App Service (Linux) - Build and Release Definitions with VSTS
- Other Misc DevOps practices implemented
- Alternatives
- Resources
- November 2017 - Integrate YAML build definition for CIs PR#8
- October 2017 - Update to ASP.NET Core 2.0.
- July 2017 - Add deployment as App Service (Linux)
- June 2017 - Update to ASP.NET Core 1.1.
- November 2016 - Initial setup deployment as App Service (Windows) for my presentation "Your DevOps journey starts with ALM!" at the Agile Tour Quebec city 2016
The goal of this GitHub repository is to demonstrate and use DevOps practices by leveraging a very simple ASP.NET Core web application on Azure Web Apps on both platform Windows and Linux. ASP.NET Core has this ability to be cross-platform, so throughout this GitHub repository, with one codebase/project we will see how deploy this web application on both platform: App Service Windows (WebDeploy package) and App Service Linux (Docker container).
By opening the .sln with Visual Studio 2017 you should see the structure of the solution like this:
To be able to setup the Build and Release definitions within VSTS described in the section below, you will need a Team Services (VSTS) account. If you don't have one, you could create it for free here.
To be able to deploy the Azure services (Function App, Application Insights, etc.), you will need an Azure subscription. If you don't have one, you could create it for free here.
For the Build definition, details could be found here: Build - CI
Here are the DevOps practices highlighted within this CI pipeline:
- CI/Build triggered at each commit on the master branch
- Compile the ASP.NET Core application
- Run unit tests
- Infrastructure as Code with the ARM Templates and the PowerShell scripts
- Expose artifacts to be used then by the CD pipeline (WebDeploy package, ARM Templates, PowerShell scripts and UITests (Selenium) dlls)
- Create a bug work item on build failure (assign to requestor)
For the Release definition, details could be found here: Release - CD
Here are the DevOps practices highlighted within this CD pipeline:
- CD triggered at each CI/Build succesfully completed
- Deploy the Infrastructure as Code with the ARM Templates and the PowerShell scripts
- Deploy the ASP.NET Core application on an Azure PaaS service: Azure App Service (Web App) on Windows
- Run UITests (Selenium) once the Web App is deployed on Staging
- Use the Staging Slot mechanism with the associated Swap action to minimize downtime while upgrading the Production
- Use Entity Framework code-first approach to manage the database migrations
- Securing the production environment by adding a Lock on the associated Azure Resource Group
- Monitor the Web App by using Application Insights
For the Build definition, details could be found here: Build - CI
Here are the DevOps practices highlighted within this CI pipeline:
- CI/Build triggered at each commit on the master branch
- Compile the ASP.NET Core application
- Run unit tests
- Infrastructure as Code with the ARM Templates and the PowerShell scripts
- Publish the web app as a Docker container in an Azure Container Registry
- Expose artifacts to be used then by the CD pipeline (ARM Templates, PowerShell scripts and UITests (Selenium) dlls)
- Create a bug work item on build failure (assign to requestor)
For the Release definition, details could be found here: Release - CD
Here are the DevOps practices highlighted within this CD pipeline:
- CD triggered at each CI/Build succesfully completed
- Deploy the Infrastructure as Code with the ARM Templates and the PowerShell scripts
- Deploy the Docker container on an Azure PaaS service: Azure App Service (Web App) on Linux
- Run UITests (Selenium) once the Web App is deployed on Staging
- Use the Staging Slot mechanism with the associated Swap action to minimize downtime while upgrading the Production
- Use Entity Framework code-first approach to manage the database migrations
- Securing the production environment by adding a Lock on the associated Azure Resource Group
- Monitor the Web App by using Application Insights
- GitHub as source control to leverage key features for collaboration such as feature-branch with pull request, etc.
- CI/CD definitions as Code with the exported yml and json files of the Build and Release Definitions respectively
- Instead of using an Azure Container Registry to expose the Docker container, use DockerHub instead.
- Instead of having an ASP.NET Core web application, use a NodeJS, Java, etc. web application instead.