<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Tips from the Cloudnative Playground - Medium]]></title>
        <description><![CDATA[Cloudnative tips - Medium]]></description>
        <link>https://medium.com/tips-from-the-cloudnative-playground?source=rss----ded905e04136---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Tips from the Cloudnative Playground - Medium</title>
            <link>https://medium.com/tips-from-the-cloudnative-playground?source=rss----ded905e04136---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 14:14:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/tips-from-the-cloudnative-playground" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Spring dependency management]]></title>
            <link>https://medium.com/tips-from-the-cloudnative-playground/spring-dependency-management-539e02c306bd?source=rss----ded905e04136---4</link>
            <guid isPermaLink="false">https://medium.com/p/539e02c306bd</guid>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring-cloud]]></category>
            <dc:creator><![CDATA[Tyson Gern]]></dc:creator>
            <pubDate>Tue, 08 Aug 2017 16:42:18 GMT</pubDate>
            <atom:updated>2017-08-08T16:42:17.521Z</atom:updated>
            <content:encoded><![CDATA[<p>Managing dependency versions in a distributed system is a problem with many variables. While there’s no silver bullet that solves it easily, there are ways to approach dependency management that can simplify the problem. I use the following process to ensure version compatibility between dependencies when building a distributed system with Spring Boot and Spring Cloud.</p><p>While these strategies will work with a wide variety of architectures and codebase structures, this article will follow the architecture described in <a href="http://www.appcontinuum.io/">The Application Continuum</a>. Additionally, I include a <em>platform-services</em> folder that contains Spring Cloud Services applications. These applications may be used for local development or can be deployed to cloud environments.</p><h3>Software to consider</h3><p>A typical application using Spring Cloud will have dependencies on the following libraries:</p><ul><li>Spring</li><li>Spring Boot</li><li>Jackson, SLF4J</li><li>Spring Cloud</li><li>Netflix OSS (Eureka, Hystrix, etc.)</li><li>Spring Cloud Services</li></ul><p>It is vital to use compatible versions of these dependencies. Failing to do so may cause runtime errors that are hard to debug.</p><p>There are two different packages that contain Spring Cloud Dependencies: org.springframework.cloud and io.pivotal.spring.cloud. The io.pivotal.spring.cloud dependencies will allow your applications to easily bind to services on <a href="https://pivotal.io/platform">Pivotal Cloud Foundry</a>, so it is best to use them when deploying to PCF.</p><h3>Where to put dependencies</h3><p>Use these guidelines when deciding where to store dependencies:</p><ul><li>The <em>applications </em>folder contains dependencies on Spring Boot and Spring Cloud.</li><li>The <em>components</em> folder contains dependencies on Spring, Jackson, SLF4J, and Netflix OSS.</li><li>The <em>platform-services</em> folder contains dependencies on Spring Cloud Services.</li></ul><h3>How to keep track of versions</h3><p>Store variables containing common dependency versions in the top-level build.gradle file in a buildscript.ext closure:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb6496f131cd20751f0aa58f30635b3f/href">https://medium.com/media/bb6496f131cd20751f0aa58f30635b3f/href</a></iframe><p>These variables can then be used in the subprojects’ build.gradle files:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8be93688d15e488040f782a31260fa7a/href">https://medium.com/media/8be93688d15e488040f782a31260fa7a/href</a></iframe><p>Spring Boot and Spring Cloud use the Gradle <a href="https://github.com/spring-gradle-plugins/dependency-management-plugin">Dependency Management Plugin</a> to manage dependency versions. The plugin uses Maven boms to synchronize dependency versions. It is vital to make sure that your bom versions are compatible with each other. If two versions that come from different boms conflict, you may run into unexpected behavior since dependencies resolve in unexpected ways.</p><p>If you are using Spring Boot 1.x, be aware that the Spring Boot Gradle plugin will automatically apply the dependency management plugin with your version of the spring-boot-dependencies bom. Thankfully, this will <a href="https://spring.io/blog/2017/04/05/spring-boot-s-new-gradle-plugin#dependency-management">not be the case</a> for Spring Boot 2.x.</p><p>When I use the dependency management plugin I limit its use to the applications and platform-services folders, since these are the only places with containing Spring Boot or Spring Cloud dependencies.</p><h3>How to find versions</h3><p>I use several sources to find compatible versions:</p><ul><li><a href="https://mvnrepository.com/">MVNrepository</a> is my go-to search engine for Maven Central.</li><li>Run gradle dependencies to see a list of all project dependencies and versions.</li><li>The IntelliJ <a href="https://www.jetbrains.com/help/idea/gradle-tool-window.html">Gradle tool window</a> has collapsable view of your current Gradle dependencies.</li><li>This Spring Cloud Services <a href="https://docs.pivotal.io/spring-cloud-services/common/client-dependencies.html">client dependency chart</a> shows compatible versions of Spring Cloud Services, Spring Boot, and Spring Cloud.</li></ul><h3>How to choose versions</h3><p>Start by determining the version of Spring Cloud Services that is available on your Cloud Foundry installation. If you are manually deploying Spring Cloud Services, choose the latest approved version.</p><p>Next, choose the highest approved version of Spring Boot that is compatible with your Spring Cloud Services version, and finally pick the compatible Spring Cloud version. Once these versions are set, versions for Spring, Netflix OSS, Jackson, SLF4J, and others can be found using the MVNrepository search or by searching through Gradle dependencies.</p><p>Once you’ve found your version numbers add them to the buildscript.ext closure. As your project accumulates more dependencies use these same methods to ensure compatibility. When you upgrade versions be sure to check compatibility between your new versions.</p><h3>Wrap-up</h3><p>This method is a reasonable starting point for managing Spring dependencies, but it will require adjustment over the course of a project. Some projects have client-specific libraries that require another layer of management techniques, while other projects with straightforward dependency structures can use a simpler technique. Above all, be ready to change your strategy when you experience friction, and be as consistent as possible across similar projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=539e02c306bd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tips-from-the-cloudnative-playground/spring-dependency-management-539e02c306bd">Spring dependency management</a> was originally published in <a href="https://medium.com/tips-from-the-cloudnative-playground">Tips from the Cloudnative Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring a Java application for local development]]></title>
            <link>https://medium.com/tips-from-the-cloudnative-playground/configuring-a-java-application-for-local-development-60e2c9794ca7?source=rss----ded905e04136---4</link>
            <guid isPermaLink="false">https://medium.com/p/60e2c9794ca7</guid>
            <category><![CDATA[configuration]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Tyson Gern]]></dc:creator>
            <pubDate>Fri, 05 May 2017 16:28:13 GMT</pubDate>
            <atom:updated>2017-05-05T16:27:51.154Z</atom:updated>
            <content:encoded><![CDATA[<p>The <a href="https://12factor.net/config">third factor</a> of the T<em>welve-Factor App</em> methodology promotes storing configuration in the environment rather than in code. To ensure that our code runs correctly we must be able to run the same build artifact in each environment, which should provide our application with the information necessary for it to run.</p><h3>The problem</h3><p>Many Java applications store development-specific configuration in an <em>application.properties</em> or <em>application.yml</em> file. These files are included in the application’s jar file, violating the third factor. Such a configuration file might look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee8a4d464d1f226f814b32257a4369d6/href">https://medium.com/media/ee8a4d464d1f226f814b32257a4369d6/href</a></iframe><p>These configuration properties are often overridden with environment variables in other environments. In some cases, developers even check environment-specific profiles into source control, flagrantly violating the third factor.</p><h3>A cumbersome solution</h3><p>A common way to externalize configuration is to store all development configuration in environment variables. This successfully conforms to 12-factor, but can be inconvenient to manage. Consider the following command, which we would use to start our application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de06045bdf58d6fe99f9c14dcd3a77ca/href">https://medium.com/media/de06045bdf58d6fe99f9c14dcd3a77ca/href</a></iframe><p>This solution becomes messier as the number of properties grows. Setting up a new development environment is cumbersome. Running the application from an IDE can be a pain. The addition of a new property must be manually communicated to the whole team.</p><p>If a different configuration is needed for testing, developers must remember to set the right properties before running tests.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0df49b24dd1fc5092d89f907db11f706/href">https://medium.com/media/0df49b24dd1fc5092d89f907db11f706/href</a></iframe><h3>An better solution</h3><p>The <a href="https://docs.gradle.org/current/userguide/java_plugin.html">Gradle Java Plugin</a> provides us with a way to set environment variables in our buildscript without including them in our build artifacts.</p><p>Any task extending the <a href="https://docs.gradle.org/3.4.1/dsl/org.gradle.api.tasks.JavaExec.html">JavaExec</a> task (like the <a href="https://github.com/spring-projects/spring-boot/blob/4a3d389bc33b5ea1095607f5e8a21d59281189fc/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java">BootRun</a> task from the Spring Boot plugin) or the <a href="https://docs.gradle.org/3.4.1/javadoc/org/gradle/api/tasks/testing/Test.html">Test</a> task has an <em>environment</em> method which sets task-specific environment variables. This lets us easily set properties for any of our development tasks:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2925846265543383e6937907dcee4cae/href">https://medium.com/media/2925846265543383e6937907dcee4cae/href</a></iframe><h3>Sensitive properties</h3><p>If we need to configure sensitive properties there are a couple of options. We can use environment variables.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c616d4d744ac284701c7092048132c33/href">https://medium.com/media/c616d4d744ac284701c7092048132c33/href</a></iframe><p>As discussed above, this approach can become unwieldy as the number of secrets grows. We can also use a local <em>properties</em> file (which is not included in our jar, of course).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a3dbe4d64b0a7cbfa58fbd3eecca7126/href">https://medium.com/media/a3dbe4d64b0a7cbfa58fbd3eecca7126/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9886bb4ef8a717d95671d41ec43fffc6/href">https://medium.com/media/9886bb4ef8a717d95671d41ec43fffc6/href</a></iframe><p>However, we run the risk of accidentally checking out secrets into source control.</p><p>Following either of these methods will help you build a 12-factor application that allows for flexible deploys to multiple environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60e2c9794ca7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tips-from-the-cloudnative-playground/configuring-a-java-application-for-local-development-60e2c9794ca7">Configuring a Java application for local development</a> was originally published in <a href="https://medium.com/tips-from-the-cloudnative-playground">Tips from the Cloudnative Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring OAuth authentication on PCF]]></title>
            <link>https://medium.com/tips-from-the-cloudnative-playground/spring-oauth-authentication-on-pcf-e5f1ac330309?source=rss----ded905e04136---4</link>
            <guid isPermaLink="false">https://medium.com/p/e5f1ac330309</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[oauth2]]></category>
            <dc:creator><![CDATA[Tyson Gern]]></dc:creator>
            <pubDate>Fri, 18 Nov 2016 19:42:35 GMT</pubDate>
            <atom:updated>2016-11-18T19:42:25.447Z</atom:updated>
            <content:encoded><![CDATA[<p>We can use <a href="https://projects.spring.io/spring-boot/">Spring Boot</a> and <a href="https://projects.spring.io/spring-security/">Spring Security</a> to create a web application that authenticates users against an OAuth2 provider. Just add <em>spring-boot-starter-web</em> and <em>spring-cloud-starter-oauth2</em> to your <em>build.gradle</em> file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ca1826826290ed2ca35478334df91bd/href">https://medium.com/media/5ca1826826290ed2ca35478334df91bd/href</a></iframe><p>Then add a configuration file to enable security for the application. In this example we’ll secure all endpoints.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1dff6be0d498f39c280284498f8492c/href">https://medium.com/media/a1dff6be0d498f39c280284498f8492c/href</a></iframe><p>We now have to configure our application with the endpoints, client id, and client secret needed to communicate with out OAuth2 provider.</p><p><a href="https://pivotal.io/platform">Pivotal Cloud Foundry</a> (PCF) provides a <a href="https://docs.pivotal.io/pivotalcf/concepts/architecture/uaa.html">User Account and Authentication</a> (UAA) server that acts as an OAuth2 provider interfacing with many different backends. On our PCF instance we can create a <a href="https://docs.pivotal.io/p-identity/">Single Sign-On</a> service which creates a UAA instance. We bind this service to out application which makes the necessary endpoints and credentials for communication.</p><p>To allow our application to use this configuration we’ll add <em>spring-cloud-sso-connector</em> to our dependencies .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c654e69a2db5f28bdc721aa803db8bae/href">https://medium.com/media/c654e69a2db5f28bdc721aa803db8bae/href</a></iframe><p>When we deploy to PCF we can bind the SSO service to our application and it will be able to successfully authenticate users against our backend of choice.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5f1ac330309" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tips-from-the-cloudnative-playground/spring-oauth-authentication-on-pcf-e5f1ac330309">Spring OAuth authentication on PCF</a> was originally published in <a href="https://medium.com/tips-from-the-cloudnative-playground">Tips from the Cloudnative Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passing CSRF tokens with RestTemplate]]></title>
            <link>https://medium.com/tips-from-the-cloudnative-playground/passing-csrf-tokens-with-resttemplate-736b336a6cf6?source=rss----ded905e04136---4</link>
            <guid isPermaLink="false">https://medium.com/p/736b336a6cf6</guid>
            <category><![CDATA[csrf]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[resttemplate]]></category>
            <category><![CDATA[spring]]></category>
            <dc:creator><![CDATA[Georg Apitz]]></dc:creator>
            <pubDate>Fri, 18 Nov 2016 19:42:35 GMT</pubDate>
            <atom:updated>2016-11-18T19:42:22.835Z</atom:updated>
            <content:encoded><![CDATA[<p>Building on <a href="https://medium.com/tips-from-the-cloudnative-playground/testing-auth-in-spring-apps-while-using-resttemplate-92e8fc3fc6d0#.icd320dg5">my previous post</a> on passing auth headers with RestTemplate we are going to look at using the same approach to pass <a href="https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)">CSRF</a> tokens in the RestTemplate call.</p><p>First, we expose the <a href="https://github.com/spring-projects/spring-security/blob/master/web/src/main/java/org/springframework/security/web/csrf/CsrfTokenRepository.java">CsrfTokenRepositoy</a> as a bean in our DevelopmentSecurityConfig introduced in the previous post. There are two things we added.</p><ul><li>Expose the CsrfTokenRepository as bean, line 5ff.</li><li>Override configure for the HttpSecurity to handle Csrf tokens and use the CsrfTokenRepository we exposed as a bean, line 10ff.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae1b7267b8eb3858286ac56314b0ee35/href">https://medium.com/media/ae1b7267b8eb3858286ac56314b0ee35/href</a></iframe><p>Next, let’s add the Csrf capability to the TestAuthentication.</p><ul><li>Wire in the CsrfTokenRepository on line 8f</li><li>Add a method to get csrfHeaders on line 22ff</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d210bacc06cec17550968180f8958b7/href">https://medium.com/media/9d210bacc06cec17550968180f8958b7/href</a></iframe><p>Then, in our test we follow the <a href="https://gist.github.com/geapi/31c75d845bc309011be9abea3f13602a">same patterns</a> we use in the <a href="https://medium.com/tips-from-the-cloudnative-playground/testing-auth-in-spring-apps-while-using-resttemplate-92e8fc3fc6d0#.icd320dg5">previous post</a> except for the changes:</p><ul><li>Make a POST call.</li><li>Make our HttpEntity of type Todo, line 13.</li><li>Use the csrfHeaders() method, line 14.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5990bfb043cd30b4d514ef2b140d4033/href">https://medium.com/media/5990bfb043cd30b4d514ef2b140d4033/href</a></iframe><p>And, with that we can test using RestTemplate with auth and csrf headers.</p><p>Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=736b336a6cf6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tips-from-the-cloudnative-playground/passing-csrf-tokens-with-resttemplate-736b336a6cf6">Passing CSRF tokens with RestTemplate</a> was originally published in <a href="https://medium.com/tips-from-the-cloudnative-playground">Tips from the Cloudnative Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing Auth in Spring apps while using RestTemplate]]></title>
            <link>https://medium.com/tips-from-the-cloudnative-playground/testing-auth-in-spring-apps-while-using-resttemplate-92e8fc3fc6d0?source=rss----ded905e04136---4</link>
            <guid isPermaLink="false">https://medium.com/p/92e8fc3fc6d0</guid>
            <category><![CDATA[resttemplate]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Georg Apitz]]></dc:creator>
            <pubDate>Fri, 18 Nov 2016 18:44:18 GMT</pubDate>
            <atom:updated>2016-11-18T19:37:24.366Z</atom:updated>
            <content:encoded><![CDATA[<p>Usually when you have auth in your <a href="http://spring.io/">Spring</a> app the default for testing becomes <a href="https://github.com/spring-projects/spring-test-mvc/blob/master/src/main/java/org/springframework/test/web/server/MockMvc.java">MockMvc</a> as most references are using it. I like to use <a href="https://github.com/spring-projects/spring-framework/blob/master/spring-web/src/main/java/org/springframework/web/client/RestTemplate.java">RestTemplate</a> and find it easier to use and test Spring applications. So here is a quick guide on how you can make RestTemplate work with auth in testing.</p><p>Let’s assume we have a todo app that uses <a href="https://en.wikipedia.org/wiki/OAuth">oauth</a> in production and displays a user name in the menubar. In testing I do no want to have to deal with an oauth server. To achieve this, we set up basic auth through a <a href="https://gist.github.com/geapi/19d8d3fb0f1faa036e9f045e2f8e3209">DevelopmentSecurityConfig</a> as below. In there we set a user and password and define a role for that combination. Simple enough.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88007b192748dddd764155f5fd9b3eb3/href">https://medium.com/media/88007b192748dddd764155f5fd9b3eb3/href</a></iframe><p>Then, we create a <a href="https://gist.github.com/geapi/7c04701232471e74c49a6b695174d9fb">TestAuthentication</a> class that gives as an encoded basic auth header like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0868d5fd18d78a8dfd61c6f8d60a681d/href">https://medium.com/media/0868d5fd18d78a8dfd61c6f8d60a681d/href</a></iframe><p>Next we tie it up nicely in our test by simply adding the basic auth header to our RestTemplate call. Line 13 is the line where we create an HttpEntity and pass in the basic auth headers form our <a href="https://gist.github.com/geapi/7c04701232471e74c49a6b695174d9fb">TestAuthentication</a> above. On line 18 we pass the requestEntity into the exchange call on the RestTemplate.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2970945d6e3f0920cd3c97cfb2621517/href">https://medium.com/media/2970945d6e3f0920cd3c97cfb2621517/href</a></iframe><p>That’s it. With this example you can keep using RestTemplate and still have basic auth in your tests.</p><p>Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92e8fc3fc6d0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tips-from-the-cloudnative-playground/testing-auth-in-spring-apps-while-using-resttemplate-92e8fc3fc6d0">Testing Auth in Spring apps while using RestTemplate</a> was originally published in <a href="https://medium.com/tips-from-the-cloudnative-playground">Tips from the Cloudnative Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Local service discovery with Ribbon]]></title>
            <link>https://medium.com/tips-from-the-cloudnative-playground/local-service-discovery-with-ribbon-60bdffb198e4?source=rss----ded905e04136---4</link>
            <guid isPermaLink="false">https://medium.com/p/60bdffb198e4</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[cloud-foundry]]></category>
            <category><![CDATA[eureka]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Tyson Gern]]></dc:creator>
            <pubDate>Fri, 18 Nov 2016 18:37:48 GMT</pubDate>
            <atom:updated>2016-11-18T18:35:05.283Z</atom:updated>
            <content:encoded><![CDATA[<p>Using the service discovery pattern is a common way to manage interactions between applications and services in a distributed system. <a href="http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html">Spring Cloud Netflix</a> includes Eureka and Ribbon to help implement this pattern. Users run a Eureka server that acts as a service registry, client applications self-register with the Eureka server, and Ribbon coordinates client-side load balancing.</p><p>In production environments <a href="https://pivotal.io/platform">Pivotal Cloud Foundry</a> allows developers to easily run a Eureka server and to automatically configure client applications to self-register with that server. During local development this process is a bit more manual. Developers must ensure that a Eureka server is always running and must configure each client to register with the server. This can be especially clunky when running integration tests, as the test suite must manage the startup and shutdown of the Eureka server.</p><p>Fortunately, we can configure Ribbon to bypass the Eureka server and allow services to communicate with each using local configuration. Consider the following example. Suppose we have three applications running locally: <strong>todo-app</strong> on port <em>8080</em>, <strong>task-service</strong> on port <em>8081</em>, <strong>notification-service</strong> running on port <em>8082</em>. We provide our application with the following configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0220cb44554613ffeb9a5ff0f21f119/href">https://medium.com/media/d0220cb44554613ffeb9a5ff0f21f119/href</a></iframe><p>This configuration accomplishes the following.</p><ul><li>Instruct clients not to attempt to register with the Eureka server.</li><li>Configure Ribbon to resolve service addresses without Eureka.</li><li>Provide the location of each service to Ribbon.</li></ul><p>We are able to run tests and run our system in our local environment without the needing to run a local Eureka server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60bdffb198e4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tips-from-the-cloudnative-playground/local-service-discovery-with-ribbon-60bdffb198e4">Local service discovery with Ribbon</a> was originally published in <a href="https://medium.com/tips-from-the-cloudnative-playground">Tips from the Cloudnative Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>