ebook img

Bootstrapping Microservices with Docker, Kubernetes, and Terraform: A project-based guide PDF

440 Pages·2021·14.26 MB·english
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Bootstrapping Microservices with Docker, Kubernetes, and Terraform: A project-based guide

A project-based guide Ashley Davis M A N N I N G Developing and testing multiple microservices under Docker Compose Development workstation Docker Compose Developing and testing individual microservices directly under Node.js Web Creating infrastructure and browser Creating infrastructure and microservices automatically microservices directly from through a continuous Node.js your dev workstation with delivery (CD) pipeline with Terraform Terraform FlixTube Kubernetes developer Terraform Continous delivery Git Code Code Terraform repo repo Essential microservice skills Developers write and test code on Less frequently, changes are merged their development workstations. to the test environment. Development Developers frequently Even less frequently, when the test workstation merge their changes environment is deemed stable, Microservices to the dev environment. functional, and well tested, it is Developer application merged to production. Development Test Production environment environment environment Microservices Microservices Microservices application application application Customer Development workstation Microservices Developer application Prior to moving changes to Code is now live in Changes are integrated and production, these are tested the customer-facing tested in the dev environment. in the test environment. production environment. Developers must work together Code is updated less frequently to fix problems that are found so there is more time for testing. in dev after integration. Typical workflow progression Bootstrapping Microservices with Docker, Kubernetes, and Terraform Bootstrapping Microservices with Docker, Kubernetes, and Terraform A - PROJECT BASED GUIDE ASHLEY DAVIS MANNING SHELTER ISLAND For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: [email protected] ©2021 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Manning Publications Co. Development editor: Helen Sturgius 20 Baldwin Road Technical development editor: Jeanne Boyarsky PO Box 761 Review editor: Aleks Dragosavljevic´ Shelter Island, NY 11964 Production editor: Lori Weidert Copy editor: Frances Buran Proofreader: Jason Everett Technical proofreader: Alain Couniot Typesetter: Gordan Salinovic Cover designer: Marija Tudor ISBN 9781617297212 Printed in the United States of America brief contents 1 ■ Why microservices? 1 2 ■ Creating your first microservice 20 3 ■ Publishing your first microservice 51 4 ■ Data management for microservices 82 5 ■ Communication between microservices 121 6 ■ Creating your production environment 162 7 ■ Getting to continuous delivery 202 8 ■ Automated testing for microservices 233 9 ■ Exploring FlixTube 278 10 ■ Healthy microservices 322 11 ■ Pathways to scalability 358 v contents preface xv acknowledgments xvii about this book xviii about the author xxii about the cover illustration xxiii 1 Why microservices? 1 1.1 This book is practical 2 1.2 What will I learn? 4 1.3 What do I need to know? 5 1.4 Managing complexity 6 1.5 What is a microservice? 6 1.6 What is a microservices application? 7 1.7 What’s wrong with the monolith? 9 1.8 Why are microservices popular now? 11 1.9 Benefits of microservices 12 1.10 Drawbacks of microservices 14 1.11 Modern tooling for microservices 15 1.12 Designing a microservices application 16 1.13 An example application 18 vii viii CONTENTS 2 Creating your first microservice 20 2.1 New tools 21 2.2 Getting the code 22 2.3 Why Node.js? 22 2.4 Our philosophy of development 24 2.5 Establishing our single-service development environment 27 Installing Git 28 ■ Cloning the code repo 29 ■ Getting Visual Studio (VS) Code 30 ■ Installing Node.js 30 2.6 Building an HTTP server for video streaming 31 Creating a Node.js project 32 ■ Installing Express 34 Creating the Express boilerplate 37 ■ Running our simple web server 38 ■ Adding streaming video 39 ■ Configuring our microservice 41 ■ Setting up for production 44 ■ Live reloading for fast iteration 45 ■ Running the finished code from this chapter 48 2.7 Node.js review 49 2.8 Continue your learning 50 3 Publishing your first microservice 51 3.1 New tools 52 3.2 Getting the code 52 3.3 What is a container? 53 3.4 What is an image? 54 3.5 Why Docker? 55 3.6 What are we doing with Docker? 55 3.7 Extending our development environment with Docker 56 Installing Docker 57 ■ Checking your Docker installation 57 3.8 Packaging our microservice 58 Creating a Dockerfile 58 ■ Packaging and checking our Docker image 60 ■ Booting our microservice in a container 63 3.9 Publishing our microservice 66 Creating a private container registry 67 ■ Pushing our microservice to the registry 72 ■ Booting our microservice from the registry 76 3.10 Docker review 78 3.11 Continue your learning 80

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.