DevOps with Windows Server 2016: Click here to enter text.
By Ritesh Modi
()
About this ebook
Delivering applications swiftly is one of the major challenges faced in fast-paced business environments. Windows Server 2016 DevOps is the solution to these challenges as it helps organizations to respond faster in order to handle the competitive pressures by replacing error-prone manual tasks using automation.
This book is a practical description and implementation of DevOps principles and practices using the features provided by Windows Server 2016 and VSTS vNext. It jumps straight into explaining the relevant tools and technologies needed to implement DevOps principles and practices. It implements all major DevOps practices and principles and takes readers through it from envisioning a project up to operations and further. It uses the latest and upcoming concepts and technologies from Microsoft and open source such as Docker, Windows Container, Nano Server, DSC, Pester, and VSTS vNext.
By the end of this book, you will be well aware of the DevOps principles and practices and will have implemented all these principles practically for a sample application using the latest technologies on the Microsoft platform. You will be ready to start implementing DevOps within your project/engagement.
Read more from Ritesh Modi
Learning Windows Server Containers: Build and deploy high-quality portable apps faster Rating: 0 out of 5 stars0 ratingsSolidity Programming Essentials.: A guide to building smart contracts and tokens using the widely used Solidity language Rating: 0 out of 5 stars0 ratingsSolidity Programming Essentials: A beginner's guide to build smart contracts for Ethereum and blockchain Rating: 0 out of 5 stars0 ratingsDeployment of Microsoft Azure Cloud Solutions: A complete guide to cloud development using Microsoft Azure Rating: 0 out of 5 stars0 ratingsDeveloping Bots with Microsoft Bots Framework: Create Intelligent Bots using MS Bot Framework and Azure Cognitive Services Rating: 0 out of 5 stars0 ratingsDeep-Dive Terraform on Azure: Automated Delivery and Deployment of Azure Solutions Rating: 0 out of 5 stars0 ratings
Related to DevOps with Windows Server 2016
Related ebooks
DevOps with Windows Server 2016 Rating: 0 out of 5 stars0 ratingsNode.js Web Development - Third Edition Rating: 2 out of 5 stars2/5Troubleshooting Docker: Develop, test, automate, and deploy production-ready Docker containers Rating: 0 out of 5 stars0 ratingsGetting Started with XenDesktop® 7.x Rating: 0 out of 5 stars0 ratingsMiddleware Management with Oracle Enterprise Manager Grid Control 10g R5 Rating: 3 out of 5 stars3/5Go Programming Blueprints - Second Edition Rating: 4 out of 5 stars4/5Microsoft Application Virtualization Advanced Guide: This book will take your App-V skills to the ultimate level. Dig deep into the technology and learn stuff you never knew existed. The step-by-step approach makes it surprisingly easy to realize the full potential of App-V. Rating: 0 out of 5 stars0 ratingsPractical DevOps: Implement DevOps in your organization by effectively building, deploying, testing, and monitoring code Rating: 0 out of 5 stars0 ratingsBuilding Web APIs with ASP.NET Core Rating: 0 out of 5 stars0 ratingsMastering Visual Studio: A Comprehensive Guide Rating: 0 out of 5 stars0 ratingsVisual SourceSafe 2005 Software Configuration Management in Practice Rating: 0 out of 5 stars0 ratingsMicrosoft Hyper-V Cluster Design Rating: 0 out of 5 stars0 ratingsMastering System Center Configuration Manager Rating: 0 out of 5 stars0 ratingsLearning PowerShell DSC Rating: 0 out of 5 stars0 ratingsContinuous Delivery with Docker and Jenkins, 3rd Edition: Create secure applications by building complete CI/CD pipelines Rating: 0 out of 5 stars0 ratingsDesigning Hyper-V Solutions Rating: 0 out of 5 stars0 ratingsVMware Horizon 6 Desktop Virtualization Solutions Rating: 0 out of 5 stars0 ratingsPHP Microservices Rating: 3 out of 5 stars3/5Mastering VMware Horizon 7 - Second Edition Rating: 0 out of 5 stars0 ratingsWeb Application Development with MEAN Rating: 0 out of 5 stars0 ratingsOdoo 10 Development Essentials Rating: 0 out of 5 stars0 ratingsIBM WebSphere Application Server v7.0 Security Rating: 0 out of 5 stars0 ratingsExpert PHP 5 Tools Rating: 4 out of 5 stars4/5Professional Plone 4 Development: Build robust, content-centric web applications with Plone 4. Rating: 3 out of 5 stars3/5Getting Started with Microsoft System Center Operations Manager Rating: 0 out of 5 stars0 ratingsGoogle App Engine Java and GWT Application Development Rating: 0 out of 5 stars0 ratingsGetting Started With Oracle SOA Suite 11g R1 - A Hands-On Tutorial Rating: 4 out of 5 stars4/5MEAN Web Development Rating: 5 out of 5 stars5/5Applied Architecture Patterns on the Microsoft Platform Rating: 0 out of 5 stars0 ratings
Operating Systems For You
Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5The Mac Terminal Reference and Scripting Primer Rating: 4 out of 5 stars4/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Bash Command Line Pro Tips Rating: 5 out of 5 stars5/5Ubuntu Linux Bible Rating: 0 out of 5 stars0 ratingsiPhone Unlocked Rating: 0 out of 5 stars0 ratingsLinux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsHacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5Windows 11 For Dummies Rating: 0 out of 5 stars0 ratingsCompTIA Linux+ Study Guide: Exam XK0-004 Rating: 0 out of 5 stars0 ratingsMake Your PC Stable and Fast: What Microsoft Forgot to Tell You Rating: 4 out of 5 stars4/5The Windows Command Line Beginner's Guide: Second Edition Rating: 4 out of 5 stars4/5PowerShell: A Beginner's Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Windows 11 For Seniors For Dummies Rating: 0 out of 5 stars0 ratingsIBM Mainframe Security: Beyond the BasicsA Practical Guide from a z/OS and RACF Perspective Rating: 4 out of 5 stars4/5The Linux Command Line Beginner's Guide Rating: 4 out of 5 stars4/5Mac Unlocked: Everything You Need to Know to Get Cracking in macOS Big Sur Rating: 0 out of 5 stars0 ratingsExploring Windows 11: The Illustrated, Practical Guide to Using Microsoft Windows Rating: 0 out of 5 stars0 ratingsNetworking for System Administrators: IT Mastery, #5 Rating: 5 out of 5 stars5/5macOS Sonoma For Dummies Rating: 0 out of 5 stars0 ratingsWindows 11 All-in-One For Dummies Rating: 5 out of 5 stars5/5Hacking for Beginners: Mastery Guide to Learn and Practice the Basics of Computer and Cyber Security Rating: 0 out of 5 stars0 ratingsiPhone For Dummies Rating: 0 out of 5 stars0 ratingsOneNote: The Ultimate Guide on How to Use Microsoft OneNote for Getting Things Done Rating: 1 out of 5 stars1/5Operating Systems DeMYSTiFieD Rating: 0 out of 5 stars0 ratingsLinux Command Line and Shell Scripting Bible Rating: 3 out of 5 stars3/5Mastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Linux Bible Rating: 0 out of 5 stars0 ratings
Reviews for DevOps with Windows Server 2016
0 ratings0 reviews
Book preview
DevOps with Windows Server 2016 - Ritesh Modi
Table of Contents
DevOps with Windows Server 2016
Credits
About the Author
Acknowledgments
About the Reviewer
Acknowledgments
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introducing DevOps
Software delivery challenges
Resistance to change
Rigid processes
Isolated teams
Monolithic design and deployments
Manual execution
Lack of innovation
What is DevOps?
DevOps principles
Collaboration and communication
Flexible to change
Application lifecycle management
Development methodology
Software design
Automating processes and tools
Failing fast and early
Innovation and continuous learning
DevOps practices
Configuration management
Continuous integration
Build automation
Test automation
Application packaging
Continuous deployment
Preproduction deployment
Test automation
Staging environment deployment
Acceptance tests
Deployment to production
Continuous delivery
Continuous learning
Measuring DevOps
Summary
2. DevOps Tools and Technologies
Cloud technology
Infrastructure as a Service (IaaS)
Platform as a Service (PaaS)
Software as a Service (SaaS)
Advantages of using cloud computing
Windows Server 2016
Application platform
Windows Server as a hosting platform
Nano servers
Windows Containers and Docker
Hyper-V containers
Nested virtual machines
Enabling microservices
Reduced maintenance
Configuration management tools
Deployment and packaging
Visual Studio Team Services
Source code management service
Team Foundation Version Control
Exploring Git
Build Management service
Executing Build Definitions
Build architecture
Agents, agent pools, and agent queues
Queuing Build Definitions
Configuring a Build definition
Release Management service
Executing release definitions
Release Management architecture
Release definition configuration
Setting up a cloud environment
Visual Studio Team Services
Azure account
Summary
3. DevOps Automation Primer
Azure Resource Manager
ARM and ASM
ARM advantages
ARM concepts
Resource providers
Resource types
Resource groups
Resource and resource instances
Azure Resource Manager
Azure Resource Manager architecture
Azure Resource Manager features
Role-Based Access Control
Tags
Policies
Locks
Multi-region
Idempotent
Extensible
Azure Resource Manager templates
Template basics
Parameters
Variables
Resources
Outputs
Expressions and functions
Nested resources
A minimal template
ARM template tools
Authoring tools
Deployment tools
Deployments
PowerShell
PowerShell features
Cmdlets
Pipeline
Variables
Scripts and modules
Azure PowerShell development environment
Pester
Installing Pester
Writing tests with Pester
Pester real-time example
Desired State Configuration
DSC Push architecture
DSC Pull architecture
Pull configuration example
DscLocalConfigurationManager() attribute
ConfigurationRepositoryWeb
Partial Configurations
Pushing LCM Configuration
Summary
4. Nano, Containers, and Docker Primer
Virtualization
Containers
Docker
Container host
Container images
Docker Hub/Docker Registry
Installing a Windows Server 2016 Container on Azure
Provisioning Azure virtual machines
Installing Windows Nano Server on Azure
Provisioning Nano Server
Using Docker client
Container life cycle management
Docker run
Docker ps
Docker start
Docker stop
Docker rm
Docker restart
Docker pause
Docker unpause
Image management
Docker build
Docker commit
Docker images
Docker rmi
Docker tag
Monitoring commands
Docker logs
Docker stats
Docker inspect
Docker events
Docker registry management
Docker login
Docker push
Docker pull
Understanding Dockerfile
Docker build command
Shell and Exec instruction forms
Shell form
Exec form
Dockerfile instructions
COMMENT
FROM
MAINTAINER
COPY
ADD
WORKDIR
EXPOSE
ENV
VOLUME
RUN
CMD
ENTRYPOINT
Summary
5. Building a Sample Application
Experiencing the application
Application architecture
Preparing development environment
Installing SQL Server Management Studio
Creating Azure SQL Server and SQL database
Creating database tables
Understanding database schema
Setting up Visual Studio solution
Modify web.config connection string
Publish profile for web application
Parameters.xml
Running the sample application
Understanding Visual Studio Solution
Entity Framework
Controllers and Views
Controllers
Views
Configuration management
Unit testing
Unit testing DrugController
Mocking Drug data access class
Drug controller unit tests
Summary
6. Source Code Control
Configuration Management
Source Configuration Management
Centralized
Distributed
Visual Studio Team Services
Git 101
Git init
Git clone
Git add
Git commit
Git branch
Git merge
Git remote
Installing Git for Windows on the development environment
Adding Online Pharmacy to the VSTS Git repository using Visual Studio 2015
Managing a Git Repository using VSTS
Submitting code changes to a Git repository
Pulling code changes from a Git repository
Onboarding another developer for the same application
Cloning and adding a solution to the VSTS Git repository
Adding a project to the VSTS Git repository using the command-line tool
Cloning and adding a solution to VSTS Git repository using the Git command-line tool
Summary
7. Configuration Management
Infrastructure as Code
Objectives of Infrastructure as Code
Revisiting sample application architecture
Azure Key Vault
Operational Insights
Desired State Configuration Pull Server
Azure storage account
Azure virtual machines and containers
Azure public load balancer
Azure SQL
Security considerations
Storing secrets and credentials
Secure login to Azure subscription
Storage account keys and shared access signature tokens
Network Security Groups and firewalls
The IT administrator and deployment role
Steps for deployment for an IT administrator
PreCreate.ps1
GeneralServices.json
Parameters
Variables
Resources
Microsoft.OperationalInsights/workspaces
Microsoft.KeyVault/vaults
Microsoft.KeyVault/vaults secrets
Outputs
Steps for deployment of the operator or release pipeline
UploadScriptFiles.ps1
Test-ARMTemplate.ps1
New-TemplateDeployment.ps1
OnlineMedicine.parameters.json
OnlineMedicine.json
Parameters
Variables
Resources
Microsoft.Compute/availabilitySets
Microsoft.Storage/storageAccounts
Microsoft.Network/virtualNetworks
Microsoft.Network/networkSecurityGroups
Microsoft.Network/publicIPAddresses
Microsoft.Network/networkInterfaces
Microsoft.Compute/virtualMachines
Microsoft.Compute/virtualMachines/extensions - CustomScriptExtension
Microsoft.Compute/virtualMachines/extensions - MicrosoftMonitoringAgent
Microsoft.Network/publicIPAddresses - for load balancer
Microsoft.Network/loadBalancers
Microsoft.Network/publicIPAddresses - web application public IP addresses
Microsoft.Network/networkInterfaces - web application NICs
Microsoft.Compute/virtualMachines - web application virtual machines
Microsoft.Compute/virtualMachines/extensions - CustomScriptExtension
Microsoft.Compute/virtualMachines/extensions - MicrosoftMonitoringAgent
Microsoft.Sql/servers, databases, firewallRules
Outputs
Summary
8. Configuration Management and Operational Validation
Steps for deployment through the release pipeline
PullServer.ps1
IISInstall.ps1
ContainerConfig.ps1
dockerfile
lcm.ps1
ChangeConnectionString.ps1
PreparePesterEnvironment.ps1
Execute-Pester.ps1
Environment unit tests
Unit testing availability set
Unit testing virtual networks
Unit testing Network Security Groups
Unit testing load balancer
Unit testing Azure SQL
Unit testing Azure SQL Firewall
Unit testing the count of virtual machines
Unit testing virtual machine 01
Unit testing virtual machine 02
Unit testing the DSC Pull Server virtual machine
Unit testing the DSC Pull Server operating system
Unit testing the web application operating system
Environment operational validation
The operational validation folder structure
The operational validation of the web application on the first virtual machine
The operational validation of the web application on the second virtual machine
The operational validation of the web application using an Azure load balancer
Unit and operational validation tests
Summary
9. Continuous Integration
Continuous integration
Why continuous integration?
Fail fast and often
High confidence and cadence
Better collaboration
Reduction of technical debt
Principles of Continuous Integration
Automation
Single repository
Fast execution
Reporting
Security
Continuous integration process
Types of continuous integration
Scheduled builds
Continuous build
Gated builds
Integration with source code configuration management
Integration with work item management
Build definition
Defining variables
Build activities
NuGet installer activity
Visual Studio Build activity for the OnlinePharmacy project
Visual Studio Build activity for the OnlinePharmacy test project
The Visual Studio Test activity for OnlinePharmacy project binaries
Replace Tokens activity for updating the web application's name
Archive Files activity for deployment.zip
Copy and Publish Build Artifacts activity
Build options
Repository
Triggers
General, retention, and history
Build pipeline execution
Summary
10. Continuous Delivery and Deployment
Understanding releases
Release management
Continuous delivery
Continuous deployment
Why continuous delivery and deployment?
Detecting deployment issues early
Eliminating surprises and risks
Reducing cost of change
Pushing frequent changes to production
Removing risky manual deployments
Moving away from human dependency
The principles of continuous deployment
Automation as an enabler
Infrastructure as Code
Shortened execution time
Reporting
Secure deployments
Continuous deployment process
Continuous delivery process
Alternate strategies
Using Azure automation for DSC Pull Server
Using Docker hub/Docker registry
Using Docker compose
Using Docker management tools such as Swarm or Kubernetes
Types of releases
Scheduled releases
Continuous deployment
Azure Resource Manager service endpoint
Release pipeline definition
Variables configuration
Artifacts configuration
Triggers configuration
General, retention, and history
Release environments
Preparation environment
Azure file copy task
Azure PowerShell
Test environment
Azure PowerShell - test ARM template deployment
Azure PowerShell - deploy test environment
PowerShell - prepare Pester environment
Copy files - copy operational validation module
Azure PowerShell - execute Pester and operational validation tests
Production environment
Azure PowerShell - test ARM template deployment
Azure PowerShell - deploy test environment
PowerShell - prepare Pester environment
Copy Files - copy operational validation module
Azure PowerShell - execute Pester and operational validation tests
Release pipeline execution
Release pipeline strategies
A/B testing
Blue/Green deployments
Canary releases
Summary
11. Monitoring and Measuring
Application Insights
Provisioning
Changes to sample application
Application Insights dashboard
Operational Insights
Provisioning
OMS agents
Search
Solutions
Summary
DevOps with Windows Server 2016
DevOps with Windows Server 2016
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: March 2017
Production reference: 1210317
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-855-0
www.packtpub.com
Credits
About the Author
Ritesh Modi is currently working as Senior Technology Evangelist at Microsoft, where he ensures that developers, startups, and companies are successful in their endeavors using technology. Prior to that, he was an Architect with Microsoft Services and Accenture. He is passionate about technology and his interest lies in both Microsoft as well as open source technologies. He believes optimal technology should be employed to solve business challenges. He is very active in communities and has spoken at national and international conferences.
He is a known industry leader and already a published author. He is a technology mentor for T-Hub and IIIT Hyderabad startup incubators. He has more than 20 certifications and is a Microsoft certified trainer. He's an expert on Azure, DevOps, Bots, Cognitive, IOT, PowerShell, SharePoint, SQL Server, and System Center. He has co-authored a book titled Introducing Windows Server 2016 Technical Preview with the Windows Server team. He has spoken at multiple conferences, including TechEd and PowerShell Asia conference, does lots of internal training and is a published author for MSDN magazine. He has more than a decade of experience in building and deploying enterprise solutions for customers. He blogs at https://automationnext.wordpress.com/ and can be followed on Twitter @automationnext. His linked profile is available at https://www.linkedin.com/in/ritesh-modi/.
Ritesh currently lives in Hyderabad, India.
Acknowledgments
Writing this book has been a fantastic experience. I personally have gained as a person who has more patience, perseverance, and tenacity than before. I owe a lot to the people who pushed me through their encouragement and motivation. I would like to thank the Almighty and my parents for their blessings. I would like to thank many people for making this book happen.
I must start with the people who mean the world to me, who inspire me to push myself and who ultimately make everything worthwhile. I am talking about my mother Bimla Modi, wife Sangeeta Modi, and daughter Avni Modi, the three wonderful ladies in my life.
Thanks of course must go to the PacktPub team. I would like to thank my editors Rashmi Suvarna and Juliana Nair for taking this project and helping me through it. I would like to thank the acquisition editor, Kirk D'costa, for finding me for this book. I would also like to thank my technical editor, Aditya Khadye, who walked through the book multiple times and gave incredibly useful feedback.
Last but not the least, I would like to thank my team at Microsoft, Manoj Damodaran, Michael Hopmere, and Ravi Mallela with whom I had several discussions to make this book better.
About the Reviewer
Satya works as a DevOps consultant at Microsoft. He enables teams to adopt best DevOps practices across different delivery domains which leads to better agility, reliability, and consistency.
In the past 18 years, he has gathered diverse experience in product planning, development, testing, and release management areas that helps him define DevOps strategy for various software projects.
He delivered multiple product releases in engineering domains such as Geographic Information System, Software Delivery, Unified Communications, Modern Engineering, and Application Lifecycle Management while working at Intergraph, Computer Associates, and Microsoft.
Satya has also contributed to Release Management service, which is an integral part of Visual Studio Team Services (VSTS) and Team Foundation Server (TFS).
Acknowledgments
I would like to thank my son, Kaushal, and my daughter, Srikari, for being patient when I spent most of my personal time during technical review. They are awesome. I would like to thank my wife, Swati, for her constant support. It would not be possible without her. I would like to thank my mother, Surya Parvathamma, and my father, Krishna Rao, for their blessings. They are foundation of what I am. I would like to thank the author, Ritesh Modi, for asking me to be a part of this wonderful project. I am sure this book will make the implementation of best DevOps practices real. I would like to thank my manager, Manoj Damodaran, and leadership at Microsoft for allowing me to undertake this.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
www.PacktPub.comhttps://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1786468557.
If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Preface
With the adoption and popularity of cloud technology, DevOps has become the most happening buzzword in the industry. The concepts of DevOps are not new and have been implemented historically. In recent times, DevOps is getting implemented widespread in enterprise world. Companies that have not yet implemented DevOps have started discussing its potential implementation. In short, DevOps is becoming ubiquitous across both big and small organizations. Organizations are trying to reach out to their customers more often with quality deliverables. They want to achieve this while reducing the risks involved in releasing to production. DevOps helps in releasing features more frequently, faster, and better, in a risk-free manner. It is a common misconception that DevOps is either about automation or technology. Technology and automation are enablers for DevOps and help better and faster DevOps implementation. DevOps is a mindset and culture, it is about how multiple teams come together for a common cause and collaborate with each other, it is about ensuring customers can derive value from software releases, and it is about bringing consistency, predictability, and confidence to overall application life cycle processes. DevOps also has levels of maturity. The highest level of DevOps is achieved when multiple releases can be made in an automated fashion with high quality through continuous integration, continuous delivery, and deployment. It is not necessary that every company should achieve this level of DevOps maturity. It depends on the nature of the company and its projects. While fully automated deployment is a need for some companies, it could be overkill for others. DevOps is a journey and companies typically start from a basic level of maturity by implementing a few of its practices. Eventually, these companies achieve high maturity as and when they keep improving and implementing more and more DevOps practices. DevOps is not complete without appropriate infrastructure for monitoring and measuring health of both environment and application. DevOps forms a closed loop, with operations providing feedback to development teams about things that work well in production and things that do not work well.
In this book, we will explore the main motivation for using DevOps and discuss in detail the implementation of its important practices. Configuration management, source code control, continuous integration, continuous delivery and deployment, monitoring and measuring concepts and implementation will be discussed in depth with the help of a sample application. We will walk through the entire process from scratch. On this journey, we will also explore all the relevant technologies used to achieve the end goal of DevOps.
This book has relevant theory around DevOps, but is heavy on actual implementation using tools and technologies available today. There are many ways to implement DevOps and this book talks about approaches using hands-on technology implementation. There is little or no material that talks about end-to-end DevOps implementations, and this book tries to fill this gap.
I have approached this book by keeping architects, developers and operations teams in mind. I have played these roles, understand the problems they go through, and tried to solve their challenges through practical DevOps implementation.
DevOps is an evolving paradigm and there will be advancements and changes in future. Readers will find this book relevant even in those times.
What this book covers
Chapter 1, Introducing DevOps, introduces the motivation for implementing the DevOps paradigm in any software development endeavor. The chapter focuses on practices and principals at a high level, creating the context for other chapters in the book.
Chapter 2, DevOps Tools and Technologies, walks through the major technology components important from a DevOps implementation perspective. It discusses cloud technologies, build and release management services, Git, Windows Server 2016, Docker containers, and Nano servers. This chapter provides a brief introduction to each of these technologies.
Chapter 3, DevOps Automation Primer, walks through major automation technologies, enabling faster and better DevOps implementation. This chapter provides a brief introduction to PowerShell, Azure Resource Manager templates, Pester, and Desired State Configuration.
Chapter 4, Nano, Containers, and Docker Primer, focuses on new Windows Server 2016 features such as Nano servers, containers, and Docker. It provides an introduction to these technologies with examples. The chapter shows how to provision Nano servers using Azure PowerShell, containers using Azure Resource Manager template, and working with Docker and dockerfiles.
Chapter 5, Building a Sample Application, introduces a sample application that helps in showing and implementing DevOps practices. It is an ASP.NET MVC web application consisting of a frontend and a database. The chapter also discusses important technical components that are integral to the sample application.
Chapter 6, Source Code Control, discusses the importance of using a version control system and provides multiple ways to interact and work with Visual Studio Team Services using Git. It shows ways to check-in the sample application into Git, and multiple ways to interact and work with VSTS Git repositories using Visual Studio. It also provides a small primer into working with Git using commands.
Chapter 7, Configuration Management, introduces one of the most important DevOps practices and its implementation. It discusses the concept of Infrastructure as Code and its importance. This chapter focuses on infrastructure and application configuration management. It provides descriptions of the code, scripts, and configuration used for the sample application. The sample application will be deployed using these configuration management artifacts.
Chapter 8, Configuration Management and Operational Validation, continues where the last chapter ended. It shows implementation of Infrastructure as Code, along with unit testing and the operational validation of environments.
Chapter 9, Continuous Integration, discusses another important DevOps practice and provides details about its importance, principles, benefits, and implementation. Visual Studio Build pipelines are discussed extensively while providing details about a sample build pipeline built for the sample application.
Chapter 10, Continuous Delivery and Deployment, discusses two of the most important DevOps practices and provides details about their importance, principles, benefits, and implementation. Visual Studio Release pipelines are discussed extensively while providing details about a sample release pipeline consisting of multiple environments built for the sample application.
Chapter 11, Monitoring and Measuring, discusses at length the concepts and implementation related to monitoring and measuring the different aspects of applications and environments in the production environment for the sample application.
What you need for this book
This book assumes a basic level knowledge on Windows operating system, cloud computing and application development using a web programming language, and moderate experience with the application development life cycle. The book will go through deployment of a sample application on Azure within Windows Containers using a set of virtual machine. This requires a basic understanding of cloud storage, computing, networking, and virtualization concepts on Azure. The book implements DevOps practices using Visual Studio Team Services and basic knowledge of this is expected, although this book tries to cover its foundations. If you have experience with Azure and Visual Studio Team Services, this is a big plus.
A valid Azure subscription and Visual Studio Team Services subscription is needed to get started with this book. They are both available free of cost on a trial basis.
As all deployments are made to the cloud, you will require a development environment on a local computer, consisting of:
CPU: 4 cores
Memory: 8 GB RAM
Disk space: 250 GB
This should be enough for the development environment.
In this book, you will need the following software:
Azure subscription
Visual Studio Team Services subscription
Windows 10 OS build 14393 version 1607 or Windows Server 2016 build 14393
SQL Server Management Studio version 12 or 13
Git for Windows 64-bit 2.12.0
Visual Studio community 2015 SP 3 version 14.0
Docker 1.12.2-cs2-ws-beta
Internet connectivity is required to work with chapters in this book.
Who this book is for
The primary audience of this book are developers, IT professionals, enterprise architects, and software and solution architects who are shaping, implementing and designing strategies for their customers. DevOps engineers, IT operations professionals and students interested in learning and implementing DevOps will find this book extremely useful.
To make full use of the content of this book, basic prior knowledge of a programming language, scripting language, containers, and cloud computing is expected. If you feel you do not have that knowledge, it is always possible to catch up on the basic requirements by quick reading the documentation available on the Internet at https://docs.microsoft.com/en-gb/.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: Dockerfile is a file containing instructions to create an image
A block of code is set as follows:
{
type
: Microsoft.Storage/storageAccounts
,
name
: [variables('vhdStorageName')]
,
apiVersion
: 2015-06-15
,
location
: [resourceGroup().location]
,
tags
: {
displayName
: StorageAccount
},
properties
: {
accountType
: [variables('vhdStorageType')]
}
},
Any command-line input or output is written as follows:
PS C:> docker --version Docker version 1.12.2-cs2-ws-beta, build 050b611
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: Right-click on *.westeurope.cloudapp.azure.com | Certificate | All Tasks and then Export.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
Log in or register to our website using your e-mail address and password.
Hover the mouse pointer on the SUPPORT tab at the top.
Click on Code Downloads & Errata.
Enter the name of the book in the Search box.
Select the book for which you're looking to download the code files.
Choose from the drop-down menu where you purchased this book from.
Click on Code Download.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/DevOps-with-Windows-Server-2016. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Downloading the color images of this book
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/DevOpswithWindowsServer2016_ColorImages.pdf.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected] with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.
Chapter 1. Introducing DevOps
Change is the only constant in life is something I have been hearing since I was a child. I never understood the saying; school remained the same, the curriculum was the same for years, home was the same, and friends were the same. However, once I joined my first software company, it immediately struck me that yes, Change is the only constant! Change is inevitable for any product or service, and this is amplified many times over when related to a software product, system, or service.
Software development is a complex undertaking comprising multiple processes and tools, and involves people from different departments. They all need to come together and work in a cohesive manner. With so much variability, the risks are high when delivering to the end customer. One small omission or misconfiguration and the application might come crashing down. This book is about adopting and implementing practices that reduce this risk considerably and ensure that high-quality software can be delivered to the customer again and again. This chapter is about explaining how DevOps brings people, processes, culture, and technology together to deliver software services to the customer effectively and efficiently. It is focused on the theory and concepts of DevOps. The remaining chapters will focus on realizing these concepts through practical examples using Microsoft Windows 2016 and Visual Studio Team Services.
This chapter will answer the following questions:
What is DevOps?
Why is DevOps needed?
What problems are resolved by DevOps?
What are its constituents, principles, and practices?
Before we get into the details of DevOps itself, let's understand some of the problems software companies face that are addressed by DevOps.
Software delivery challenges
There are inherent challenges when engaged in the activity of software delivery. It involves multiple people with different skills using different tools and technologies with multiple different processes. It is not easy to bring all these together in a cohesive manner. Some of these challenges are mentioned in this section. Later, in subsequent chapters, we will see how these challenges are addressed with the adoption of DevOps principles and practices.
Resistance to change
Organizations work within the realms of economic, political, and social backdrops, and they have to constantly adapt themselves to a continuously changing environment. Economic changes might introduce an increase in competition in terms of price, quality of products and services, changing marketing strategies, and mergers and acquisitions. The political environment introduces changes in legislation, which has an impact on the rules and regulation for enterprise. The tax system and international trade policies are also examples of areas in which change can have an impact. Society decides which products and services are acceptable or preferred and which are discarded. Customers demand change on a constant basis. Their needs and requirements change often and this manifests in the systems they are using. Organizations not adept at handling changes in their delivery processes and who resist making changes to their products and features eventually find themselves outdated and irrelevant. These organizations are not responsive to change. In short, the environment is ever changing and organizations perish if they do not change along with it.
Rigid processes
Software organizations with a traditional mindset release their products and services on a yearly or multi-year basis. Their software development life cycle is long and their operations do not have many changes to deploy and maintain. Customers demand more but they wait till the next release from the company. The organization is either not interested or does not have the capability to release changes faster. Meanwhile, if the competitor is able to provide more and better features faster, customers will soon shift their loyalty and start using them. The first organization will start losing customers, have reduced revenues, and fade away.
Isolated teams
Generally, there are multiple teams behind any system or service provided to the customer. Typically, there is a development team and an operations team. The development team is responsible for developing and testing the system, while the operations team is responsible for managing and maintaining the system on production. The operations team provides post-deployment services to the customer. These two teams have different skills, experience, mindset, and working culture. The charter of the development team is to develop newer features and upgrade existing ones. They constantly produce code and want to see it in production. However, the operations team is not comfortable with frequent changes. The stability of the existing environment is more important to them. There is a constant conflict between these two teams.
There is little or no collaboration and communication between these two teams. The development team often provides code artifacts to the operations team for deployment on production without helping them to understand the change. The operations team is not comfortable deploying the new changes since they are neither aware of the kind of changes coming in as part of a new release nor have confidence deploying the software. There is no proper hand-off between the development and operations teams. Often, the deployments fail on production and the operations team has to spend sleepless nights ensuring that the current deployment is either fixed or rolled back to a previous working release. Both the development and operations teams are working in silos. The development team does not treat the operations team as equivalent to itself. The operations team has no role to play in the software development life cycle, while the development team has no role to play in operations.
Monolithic design and deployments
Development goes on for multiple months before testing begins. The flow is linear and the approach is Waterfall, where the next stage in software development life cycle happens only when the prior stage is completed or nearing completion. Deployment is one giant exercise in deploying multiple artifacts on multiple servers based on documented procedures. Such practices have many inherent problems. There are a lot of features and configuration steps for large applications and everything needs to be done, in order, on multiple servers. Deploying a huge application is risky and fails when a small step is missed during deployment. It generally takes weeks to deploy a system such as this in production.
Manual execution
Software development enterprises often do not employ proper automation in their application lifecycle management. Developers tend to check-in code only after a week, the testing is manual, configuration of the environment and system is manual, and documentation is either missing or very dense, comprising hundreds of pages. The operations team follows the provided documentation to deploy the system manually on production. Often this results in a lot of downtime on production because smaller steps have been missed in deployment. Eventually, customers become dissatisfied with the services provided by the company. Also, this introduces human dependencies within the organization. If a person leaves the organization, their knowledge leaves with them and a new person has to struggle significantly to gain the same level of expertise and knowledge.
Lack of innovation
Organizations starts losing out to competition when they are not flexible to meet customer expectation with newer and upgraded products and services. The result is falling revenues and profits, eventually making them nonexistent in the marketplace. Organizations that do not innovate newer products and services consistently nor update them cannot provide exponential customer satisfaction.
What is DevOps?
Today, there is no consensus in industry regarding the definition of DevOps. Every organization has formulated their own definition of DevOps and has tried to implement it accordingly. They have their own perspective and tend to think they have implemented DevOps if they have automation in place, configuration management is enabled, they are using agile processes, or any combination thereof.
DevOps is about the delivery mechanism of software systems. It is about bringing people together, making them collaborate and communicate, working together toward a common goal and vision. It is about taking joint responsibility, accountability, and ownership. It is about implementing processes that foster a collective and service mindset. It enables a delivery mechanism that brings agility and flexibility within the organization. Contrary to popular belief, DevOps is not about tools, technology, and automation .Automation acts as an enabler to implement agile processes, induce collaboration within teams and help in delivering faster and better.
There are multiple definitions of DevOps available on the Internet and they do not provide complete definition. DevOps does not provide a framework or methodology. It is a set of principles and practices that, when employed within an organization, engagement, or project, achieve the goal and vision of both DevOps and the organization. These principles and practices do not mandate any specific process, tools and technologies, or environment. DevOps provides guidance which can be implemented through any tool, technology, and process, although some of the technology and processes might be more appropriate