Presented at GR8Conf US 2016 in Minneapolis, MN.
You've got your microservices, cloud config & Eureka servers running in development, but how do you take that to production? A single instance of each isn't a viable solution for these critical services. In this talk, we'll walk through how to configure and run the cloud config and Eureka servers in a high availability manner. We will also cover other production tasks like pushing config updates and monitoring all your Hystrix circuit breakers using Turbine. This is not an introductory talk and assumes a basic familiarity with the Spring Cloud Services.
2. SPRING CLOUD INTO PRODUCTION
ABOUT ME
Atlanta, GA
Inc 5000 fastest growing companies 5 years in a row
Forbes 25 Best Small Businesses 2016
Father of four
todd@zifty.com
@ziftytodd
4. SPRING INTO PRODUCTION
MICROSERVICE âTAXâ
⸠ConďŹguration Management
⸠Service Discovery
(and registration)
⸠More faults to handle
(and more gracefully)
⸠Authentication & Authorization
⸠and so onâŚ
5.
6. SPRING CLOUD INTO PRODUCTION
WHAT IS SPRING CLOUD?
⸠ConďŹg management
⸠Service discovery
⸠Circuit breakers
⸠Intelligent routing
⸠Micro-proxy
⸠Control bus
⸠One-time tokens
⸠Global locks
⸠Distributed sessions âŚ. and more!
7. SPRING CLOUD INTO PRODUCTION
CONFIGURATION - SPRING CLOUD CONFIG
⸠Separate server service
⸠Keep conďŹg in a repository
⸠YAML or Properties ďŹles
⸠Supports multiple services and
proďŹles
⸠Super simple client
⸠One conďŹg line
⸠One dependency
8. SPRING CLOUD INTO PRODUCTION
SERVICE DISCOVERY - EUREKA
⸠Separate server service
⸠Service registry
⸠Clients register and discover
⸠Some fault tolerance
⸠Add Ribbon for intelligent routing
9. SPRING CLOUD INTO PRODUCTION
CIRCUIT BREAKERS - HYSTRIX
⸠Part of your serviceâs code
⸠Circuit breaker
⸠Failure isolation
⸠Graceful degradation
⸠Built-in monitoring
⸠Use with Turbine to aggregate
10.
11.
12.
13.
14. SPRING CLOUD INTO PRODUCTION
EC2 CONTAINER SERVICE (ECS)
⸠Manages containers & cluster
⸠DeďŹne tasks
⸠Compose tasks into services
⸠Load balancing
⸠Auto-scaling
⸠AWSâs Docker registry (ECR)
15.
16.
17.
18.
19.
20.
21. SPRING INTO PRODUCTION
CLOUD CONFIG INTO PRODUCTION
⸠Which comes ďŹrst? Eureka or ConďŹg?
⸠How do you ďŹnd the ConďŹg Server?
⸠Use an ELB to point to conďŹg server instances
22. SPRING CLOUD INTO PRODUCTION
Gr8ConďŹgApplication.groovy
bootstrap.yml
DockerďŹle
34. SPRING CLOUD INTO PRODUCTION
IT RUNS!
⸠Access via ELBâs endpoint URL
⸠But who wants to remember a URL like this?
⸠Plus, itâs not very portable
⸠Enter AWS Route 53 and private DNS
37. SPRING CLOUD INTO PRODUCTION
IT RUNS BETTER!
⸠Any service in our VPC can access via
http://conďŹg.gr8conf.vpc:8888/
⸠Private hosted zones do not work from outside VPC access
⸠Use public DNS records if external access is needed
38. SPRING INTO PRODUCTION
EUREKA INTO PRODUCTION
⸠How do you ďŹnd a server?
⸠How do servers ďŹnd each other?
⸠Route53 and DNS to the rescue again
42. SPRING INTO PRODUCTION
ROUTE 53 FOR EUREKA
⸠TXT record per region to point to AZ in that region
txt.us-east-1.gr8conf.vpc ->
us-east-1d.gr8conf.vpc
us-east-1e.gr8conf.vpc
⸠TXT record per AZ in region
txt.us-east-1d.gr8conf.vpc ->
ec2-##-##-##-##.compute-1.amazonaws.com
ec2-##-##-##-##.compute-1.amazonaws.com
45. SPRING CLOUD INTO PRODUCTION
A FEW TRICKS
⸠List of EC2 instances must use the expanded EIP hostname
⸠Separated by spaces
⸠Space at start, and space at end
⸠Failure results in Eureka servers using wrong hostname
and not recognizing each other properly
52. SPRING CLOUD INTO PRODUCTION
HOW DO OUR SERVICES USE THIS?
⸠Point to conďŹg server ELB
⸠Store Eureka conďŹg details for clients in conďŹg server
⸠EurekaInstanceConďŹgBean has to happen on services too
57. SPRING CLOUD INTO PRODUCTION
DEPLOY TO PRODUCTION
⸠Same as weâve seen
⸠Push Docker image to ECR
⸠Create Task DeďŹnition
⸠Create Service
⸠Public facing? Use an ELB to get a reliable URL
61. SPRING CLOUD INTO PRODUCTION
http://techblog.netďŹix.com/2012/12/hystrix-dashboard-and-turbine.html
62. SPRING CLOUD INTO PRODUCTION
HYSTRIX MONITORING FOR THEM ALL
⸠Start a Turbine server
⸠Finds services to get Hystrix streams via Eureka
⸠Need AMPQ broker
63. SPRING CLOUD INTO PRODUCTION
http://www.programering.com/a/MDN3gzNwATE.html
64.
65. SPRING CLOUD INTO PRODUCTION
THANK YOU
⸠https://github.com/ziftytodd
⸠todd@zifty.com
⸠@ziftytodd
⸠www.zifty.com