logo资料库

Cloud Native Programming with Golang.pdf

第1页 / 共399页
第2页 / 共399页
第3页 / 共399页
第4页 / 共399页
第5页 / 共399页
第6页 / 共399页
第7页 / 共399页
第8页 / 共399页
资料共399页,剩余部分请下载后查看
Cover
Title Page
Copyright
Credits
About the Authors
About the Reviewer
Customer Feedback
Table of Contents
Preface
Chapter 1: Modern Microservice Architectures
Why Go?
Basic design goals
Cloud service models
Cloud application architecture patterns
The twelve-factor app
What are microservices?
Deploying microservices
REST web services and asynchronous messaging
The MyEvents platform
Summary
Chapter 2: Building Microservices Using Rest APIs
The background
So, what are microservices?
Microservices internals
RESTful Web APIs
Gorilla web toolkit
Implementing a Restful API
Persistence layer
MongoDB
MongoDB and the Go language
Implementing our RESTful APIs handler functions
Summary
Chapter 3: Securing Microservices
HTTPS
Symmetric cryptography
Symmetric-key algorithms in HTTPS
Asymmetric cryptography
Asymmetrical cryptography in HTTPS
Secure web services in Go
Obtaining a certificate
OpenSSL
generate_cert.go
Building an HTTPS server in Go
Summary
Chapter 4: Asynchronous Microservice Architectures Using Message Queues
The publish/subscribe pattern
Introducing the booking service
Event collaboration
Implementing publish/subscribe with RabbitMQ
The Advanced Message Queueing Protocol
RabbitMQ quickstart with Docker
Advanced RabbitMQ setups
Connecting RabbitMQ with Go
Publishing and subscribing to AMQP messages
Building an event emitter
Building an event subscriber
Building the booking service
Event sourcing
Implementing publish/subscribe and event sourcing with Apache Kafka
Kafka quickstart with Docker
Basic principles of Apache Kafka
Connecting to Kafka with Go
Publishing messages with Kafka
Consuming messages from Kafka
Summary
Chapter 5: Building a Frontend with React
Getting started with React
Setting up Node.js and TypeScript
Initializing the React project
Basic React principles
Kick-starting the MyEvents frontend
Implementing the event list
Bringing your own client
Building the event list components
Enabling CORS in the backend services
Testing the event list
Adding routing and navigation
Implementing the booking process
Summary
Chapter 6: Deploying Your Application in Containers
What are containers?
Introduction to Docker
Running simple containers
Building your own images
Networking containers
Working with volumes
Building containers
Building containers for the backend services
Using static compilation for smaller images
Building containers for the frontend
Deploying your application with Docker Compose
Publishing your images
Deploying your application to the cloud
Introduction to Kubernetes
Setting up a local Kubernetes with Minikube
Core concepts of Kubernetes
Services
Persistent volumes
Deploying MyEvents to Kubernetes
Creating the RabbitMQ broker
Creating the MongoDB containers
Making images available to Kubernetes
Deploying the MyEvents components
Configuring HTTP Ingress
Summary
Chapter 7: AWS I – Fundamentals, AWS SDK for Go, and EC2
AWS fundamentals
The AWS console
AWS command-line interface (CLI)
AWS regions and zones
AWS tags
AWS Elastic Beanstalk
AWS services
AWS SDK for Go
Configuring the AWS region
Configuring AWS SDK authentication
Creating IAM Users
Creating IAM Roles
The fundamentals of the AWS SDK for Go
Sessions
Service clients
Native datatypes 
Shared configuration
Pagination methods
Waiters
Handling Errors
Elastic Compute Cloud (EC2)
Creating EC2 instances
Accessing EC2 instances
Accessing EC2 instances from a Linux or macOS machine
Accessing EC2 from Windows
Security groups
Summary
Chapter 8: AWS II – S3, SQS, API Gateway, and DynamoDB
Simple Storage Service (S3)
Configuring S3
Simple Queue Service (SQS)
AWS API gateway
DynamoDB 
DynamoDB components
Attribute value data types
Primary keys
Secondary indexes
Creating tables
The Go language and DynamoDB
Summary
Chapter 9: Continuous Delivery
Setting up your project
Setting up version control
Vendoring your dependencies
Using Travis CI
Deploying to Kubernetes
Using GitLab
Setting up GitLab
Setting up GitLab CI
Summary
Chapter 10: Monitoring Your Application
Setting up Prometheus and Grafana
Prometheus's basics
Creating an initial Prometheus configuration file
Running Prometheus on Docker
Running Grafana on Docker
Exporting metrics
Using the Prometheus client in your Go application
Configuring Prometheus scrape targets
Exporting custom metrics
Running Prometheus on Kubernetes
Summary
Chapter 11: Migration
What is a monolithic application?
What are microservices?
Migrating from monolithic applications to microservices
Humans and technology
Cutting a monolithic application to pieces
How do we break the code?
Glue code
Microservices design patterns
Sacrificial architecture
A four-tier engagement platform
Bounded contexts in domain-driven designs
Data consistency
Event-driven architecture for data consistency
Events sourcing
CQRS
Summary
Chapter 12: Where to Go from Here?
Microservices communications
Protocol buffers
GRPC
More on AWS
DynamoDB streams
Autoscaling on AWS
Amazon Relational Database Service
Other cloud providers
Microsoft Azure
Google Cloud Platform
OpenStack
Running containers in the cloud
Serverless architectures
Summary
Index
Cloud Native programming with Golang Mina Andrawos Martin Helmich BIRMINGHAM - MUMBAI
Cloud Native programming with Golang 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 authors, 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: December 2017 Production reference: 1261217 ISBN 978-1-78712-598-8
Credits Authors Mina Andrawos Martin Helmich Reviewer Jelmer Snoeck Copy Editor Dhanya Baburaj Project Coordinator Sheejal Shah Commissioning Editor Aaron Lazar Proofreader Safis Editing Acquisition Editor Nitin Dasan Indexer Francy Puthiry Content Development Editor Sreeja Nair Graphics Jason Monteiro Technical Editor Prashant Mishra Production Coordinator Arvindkumar Gupta
About the Authors Mina Andrawos is an experienced engineer who has developed deep experience in Go from using it personally and professionally. He regularly authors articles and tutorials about the language, and also shares Go's open source projects. He has written numerous Go applications with varying degrees of complexity. Other than Go, he has skills in Java, C#, Python, and C++. He has worked with various databases and software architectures. He is also skilled with the agile methodology for software development. Besides software development, he has working experience of scrum mastering, sales engineering, and software product management. For Nabil, Mervat, Catherine, and Fady. Thanks to all my family for their amazing support, and continuous encouragement. Martin Helmich studied computer science at the University of Applied Sciences in Osnabrck and lives in Rahden, Germany. He works as a software architect, specializing in building distributed applications using web technologies and Microservice Architectures. Besides programming in Go, PHP, Python, and Node.js, he also builds infrastructures using configuration management tools such as SaltStack and container technologies such as Docker and Kubernetes. He is an Open Source enthusiast and likes to make fun of people who are not using Linux. In his free time, you'll probably find him coding on one of his open source pet projects, listening to music, or reading science-fiction literature.
About the Reviewer Jelmer Snoeck is a software engineer with a focus on performance, reliability, and scaling. He's very passionate about open source and maintains several open source projects. Jelmer comes from a Ruby background and has been working with the Go language since 2014. He's taken a special interest in containers and Kubernetes, and is currently working on several projects to help with the deployment flow for these tools. Jelmer understands how to operate and scale distributed systems and is excited to share his experience with the world.
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 . If you'd like to join our team of regular reviewers, you can e-mail us at . We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents Preface Chapter 1: Modern Microservice Architectures Why Go? Basic design goals Cloud service models Cloud application architecture patterns The twelve-factor app What are microservices? Deploying microservices REST web services and asynchronous messaging Chapter 2: Building Microservices Using Rest APIs The MyEvents platform Summary The background So, what are microservices? Microservices internals RESTful Web APIs Gorilla web toolkit Implementing a Restful API Persistence layer MongoDB MongoDB and the Go language Implementing our RESTful APIs handler functions Chapter 3: Securing Microservices Summary HTTPS Symmetric cryptography Symmetric-key algorithms in HTTPS Asymmetric cryptography Asymmetrical cryptography in HTTPS Secure web services in Go Obtaining a certificate OpenSSL generate_cert.go 1 8 9 10 12 13 14 16 16 17 19 21 22 22 25 26 27 31 32 37 38 44 51 59 60 61 61 62 63 65 67 67 68 69
分享到:
收藏