Video: Streamline Service Configuration with Pivotal’s Spring Cloud

Deploying software into production can be a headache. When working at scale, having the ability to integrate microservices quickly is something that’s on every organization’s mind. When moving to production, microservices must be easily discovered, managed, and structured. Ease of use is key when deploying services into production, and avoiding having to restart a process just to update a few lines of code can be a valuable time saver when the clock is ticking.
The video embedded below is the final segment in a four-part series highlighting Pivotal’s Cloud Foundry and its offerings for developers working with Spring. In this segment, we’re taking a look at Spring Cloud Config, a way for developers to quickly configure easily discoverable Spring applications for distributed systems.
Deploying Microservices with Spring Cloud Config
In this demonstration, Pivotal’s principle developer advocate Josh Long begins by addressing common patterns of centralized configuration. When more than one service is running, restarting processes to change information such as passwords and hostnames can quickly become tedious. Spring Cloud Config is a microservice that sits in front of a repository configuration file, allowing for users to quickly deploy Spring instances into production.
Long continues the demonstration by taking another look at the stand-up reservation application from the previous demo. In this case, the service is a standard reservation service designed to return reservation properties. When creating an application in Spring Cloud Config, users can point to a repository on their desktop, allowing for any microservice which identifies as their chosen destination to discover the applicable repo. Should a conflict occur, users can retrofit Spring to add dependencies as needed, allowing for centralized configuration. Spring Boot reads property files upon startup while the REST controller parrots its message and then inject a specified message key.
When committing changes to a property file, Spring Cloud Config is immediately aware of new values. Users can then trigger an external refresh by doing an empty post to localhost 8000/refresh. When this is complete, the service discovery immediately reflects the change in the code without having to restart the process.
“This gives me the ability to centrally change and administer updates and federate changes across all my services very simply,” said Long. When working with distributed systems, decoupling services from hosts and ports is critical to success when operating at scale. Long notes that one approach to this is to use DNS, but this can present challenges. Often, DNS runs in front of a load balancer, which then sits in front of any running microservices. “If one of these components is sick, there is no way to ask about the state of the cluster to ask if it is down,” said Long.
By setting up Netflix Eureka within Spring Cloud Config, users are able to utilize client discovery abstraction. This allows for the creation of unique service IDs which are discoverable through service registration. Other services can communicate to the registry API and REST API once a service is registered in Eureka. Spring Cloud Config is particularly powerful for those interested in creating edge services. Enterprises may have a suite of microservices talking to one another through a registry, or through a secure setup.
Edge services are set up between microservices and the back end of an organization’s infrastructure. As such, this makes them an ideal place to put security, authentication, API and protocol translation and gateways. If a user is starting more than one service, load balancing is handled by Netflix Ribbon through Spring Cloud. This client-side load balancer allows for users to make decisions regarding how their traffic is routed on a client. “This way we can make something more interesting than round robin load balancing,” said Long.
As Long notes at the end of the tutorial, part of the part and parcel of working with distributed systems is the discovery and application of patterns. These patterns integrate and interlock together, making them more fluid and adaptable to today’s software development landscape. Solutions such as Spring Cloud Config allow for enterprises to run their code on top of an already robust platform, rather than having to write additional code and create their own platform from scratch.
Links:
Feature Image via Pixabay