Book Image

Microservices Deployment Cookbook

By : Vikram Murugesan
Book Image

Microservices Deployment Cookbook

By: Vikram Murugesan

Overview of this book

This book will help any team or organization understand, deploy, and manage microservices at scale. It is driven by a sample application, helping you gradually build a complete microservice-based ecosystem. Rather than just focusing on writing a microservice, this book addresses various other microservice-related solutions: deployments, clustering, load balancing, logging, streaming, and monitoring. The initial chapters offer insights into how web and enterprise apps can be migrated to scalable microservices. Moving on, you’ll see how to Dockerize your application so that it is ready to be shipped and deployed. We will look at how to deploy microservices on Mesos and Marathon and will also deploy microservices on Kubernetes. Next, you will implement service discovery and load balancing for your microservices. We’ll also show you how to build asynchronous streaming systems using Kafka Streams and Apache Spark. Finally, we wind up by aggregating your logs in Kafka, creating your own metrics, and monitoring the metrics for the microservice.
Table of Contents (15 chapters)
Microservices Deployment Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

How to do it...


We will use Docker Compose to orchestrate Kafka. Go ahead and create a new YML file called docker-compose-kafka.yml directly under the geolocation project. Then, add the following snippet to the newly created Docker Compose file:

version: "2" 
 
services: 
  zookeeper: 
    image: wurstmeister/zookeeper 
    ports: 
      - "2181:2181" 
       
  kafka: 
    image: wurstmeister/kafka:0.10.1.0-1 
    ports: 
      - "9092:9092" 
    environment: 
      KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100 
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 
    volumes: 
      - /var/run/docker.sock:/var/run/docker.sock 

As you can see, we have not used any official images. At the time of writing this, there is no official image for Kafka. However, there are Kafka images listed under the Confluent organization in Docker Hub. Confluent is the company behind Kafka and the Confluent platform. It was built by...