Foreword xiPreface xiiiChapter 1 Microservices 1What are Microservices? 2Autonomous Services 4Small Services 5Benefits of Microservices 6Independent Deployments 6Continuous Innovation 8Improved Scale and Resource Utilization 9Technology Diversity 10Small Focused Teams 12Fault Isolation 12Challenges 13Complexity 14Network Congestion and Latency 14Data Consistency 15Testing 16Integration and Versioning 17Service Discovery and Routing 17Monitoring and Logging 18Skillset and Experience 18Uptime Service Level Agreement 18Best Practices 19Encapsulation 20DevOps Principles and Culture 21Automation 22Monitoring 23Fault Tolerance 23Summary 26Chapter 2 Containers on Azure Basics 29VMs, Containers, and Processes 29When Would We Use a Container Over a Virtual Machine or a Process? 30Containers on Azure 34Creating an Azure VM with Docker 35Generating an SSH Public Key on Windows 37Generating an SSH Public Key on Mac OS X 39Choosing a Virtual Machine Image 40Connecting to the VM Using SSH and Git Bash on Windows 44Connecting to the VM Using SSH and Git Bash on Mac OS X 46Docker Container Basics 47Summary 68Chapter 3 Designing the Application 69Determining Where to Start 70Coarse-Grained Services 70Starting with Microservices 72Defining Services and Interfaces 73Decomposing the Application 74Service Design 76Service to Service Communication 78Synchronous Request/Response 78Asynchronous Messaging 79Monolith to Microservices 80Flak.io e-Commerce Sample 83Flak.io 84Requirements 84Architecture Overview 85Considerations 86Summary 87Chapter 4 Setting Up Your Development Environment 89Using Docker for Local Development 89Docker for Local Development 89Docker for Production Validation 90Docker as a Build/Test Host 90Developer Configurations 90Local Development 90Local and Cloud 91Cloud Only 91Managing Docker Authentication 91Choosing a Base Image 92Build a Hierarchy of Images 95Setting up your Local Dev Environment 101Install Docker Tools 101Install Developer Tools 102Install Windows Utilities 102Install OSX Utilities 103Docker for Local Development 103Local Development Settings 103Starting your Local Docker Host 104Connecting to a Docker Host 105Cloning Samples 105Enabling Live Reload in a Docker Container 107Volumes 108Preparing your Microservice for Production 110Docker Compose 112Debugging Docker Issues 116Unable to Connect to the Docker Host 116Containers That Won't Start 117Diagnosing a Running Container 118Summary 118Chapter 5 Service Orchestration and Connectivity 119Orchestration 121Provisioning 123Infrastructure as Code 123Azure Resource Manager 126Azure Container Service 132Multivendor Provisioning 135Scheduling and Cluster Management 136Challenges 136A Scheduling Solution 138Docker Swarm 141Kubernetes 144Apache Mesos 147Using Apache Mesos to Run Diverse Workloads 150Service Discovery 150Service Registration 152Service Lookup 153Service Registry 155Technologies 156Other Technologies 158Application/API Gateway 159Overlay Networking 161Summary 165Chapter 6 DevOps and Continuous Delivery 167DevOps Overview 167Modern DevOps 169DevOps Culture 170Continuous Integration, Delivery, and Deployment 171Creating Environments in Azure 173Deploying a Microservice with Continuous Delivery 182Application Configuration Changes Across Different Environments 184Continuous Integration 185Testing in a QA Environment 192Deploying to Staging 195Testing in Production 196Choosing a Continuous Delivery Tool 200On-Premises or Hosted? 200On-Premises or Hosted Build Agents? 201Best-of-breed or Integrated Solution? 201Does the Tool Provide the Extensibility You Need? 202Comparison of Jenkins, Team Services, Bamboo, and Tutum 205Docker Cloud (Formerly Called Tutum) 206Summary 207Chapter 7 Monitoring 209Monitoring the Host Machine 210Monitoring Containers 212Monitoring Services 216Monitoring Solutions 222Azure Diagnostics 222Application Insights 227Operations Management Suite (OMS) 231Recommended Solutions by Docker 232Summary 232Chapter 8 Azure Service Fabric 233Service Fabric Overview 234Service Fabric Subsystems 234Cluster Management 236Resource Scheduling 240Service Fabric Application 240Custom Applications (Existing Applications) 242Container Integration 243Service Discovery 244Programming Model 244Stateless Services 244Stateful Services 245Reliable Actors 247Reliable Services 249Application Lifecycle 251Service Updates 251Application Upgrades 252Testability Framework 253Summary 254Appendix A ASP.NET Core 1.0 and Microservices 255A New Version of ASP.NET 255Getting Started 256Choosing the Right ASP.NET Docker Image 262Visual Studio 2015 Tooling 263ASP.NET Microservices Best Practices 265Index 275
Boris Scholl is a Principal Program Manager on the Microsoft Azure compute team, looks after Service Fabric custom application orchestration, container integration, and Azure's OSS developer and DevOps story for container based workloads Prior to this, he was leading the Visual Studio Cloud Tools team focusing on architectural and implementation patterns for large scale distributed Cloud applications, IaaS developer tooling, provisioning of Cloud environments and the entire ALM life cycle. Boris gained his experience by working as an architect for global cloud and SharePoint solutions with Microsoft Services. In addition to being a speaker at various events, Boris is author on many articles related to Azure development and Diagnosing cloud applications as well as co-author of the book SharePoint 2010 development with Visual Studio 2010 (Addison Wesley Professional).Trent Swanson is a typical entrepreneur. As a co-founder and consultant with Full Scale 180, he works with some of Microsoft's largest customers, helping them migrate and build applications on the Microsoft Azure platform. He has been involved in building some of the largest applications running on Microsoft Azure today, some of which now utilize Docker and a microservices architecture. Trent often works with the Microsoft Patterns and Practices team developing guidance and best practices for cloud applications where he also co-authored a book on cloud design patterns. As a co-founder of Krillan and Threadsoft he has built applications based on a microservices architectural style using Docker, Node.js, Go, and Mesos. As a co-founder of B & S Enterprises, he dabbles with various IoT technologies for commercial building management.Dan Fernandez is a Principal Director managing the Developer Content teams for Visual Studio, Team Services, ASP.NET and parts of Azure. Prior to this, Dan worked as a Principal Program Manager managing the developer experience for Docker including Visual Studio, Visual Studio Code, and Docker continuous integration using Visual Studio Team Services. Dan is also the author of the Channel 9 video series Docker for .NET Developers. You can find Dan on Twitter at @danielfe.