chapter twelve

12 Deploying your microservices

 

This chapter covers

  • Understanding why the DevOps movement is critical to microservices
  • Configuring the core Amazon infrastructure used by Ostock services
  • Manually deploying Ostock services to Amazon
  • Designing a build and deployment pipeline for your services
  • Moving from continuous integration to continuous deployment
  • Treating your infrastructure as code
  • Building the immutable server
  • Testing in deployment
  • Deploying your application to the cloud

We’re almost at the end of the book, but not the end of our microservices journey. While most of this book has focused on designing, building, and operationalizing Spring-based microservices using the Spring Cloud technology, we haven’t yet touched on how to build and deploy microservices. Creating a build and deployment pipeline might seem like a mundane task, but in reality, it’s one of the most critical pieces of our microservices architecture.

Why? Remember, one of the key advantages of a microservices architecture is that microservices are small units of code that can be quickly built, modified, and deployed to production independently of one another. The small size of the service means that new features (and critical bug fixes) can be delivered with a high degree of velocity. Velocity is the keyword here because velocity implies that little to no friction exists between making a new feature or fixing a bug and getting our service deployed. Lead times for deployment should be minutes, not days.

12.1  Ostock: setting up the core infrastructure in the cloud

12.1.1    Creating the PostgreSQL database using Amazon RDS

12.1.2    Creating the Redis cluster in Amazon

12.2  Beyond the infrastructure: deploying OStock and ELK

12.2.1    Creating an EC2 with the ELK Services

12.2.2    Deploying the ELK stack in the EC2 instance  

12.2.3    Creating an EKS Cluster

12.3  The architecture of a build/deployment pipeline

12.4  Your build and deployment pipeline in action

12.5  Beginning our build deploy/pipeline: Github and Jenkins

12.5.1    Setting up Github

12.5.2    Enabling our services to build in Jenkins

12.5.3    Understanding and generating the pipeline script

12.5.4    Creating the Kubernetes pipeline scripts

12.6  Closing thoughts on the build/deployment pipeline

12.7  Summary