From f26980043a3a45c18e32beb179a47aa2b3ff790e Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 30 Sep 2014 10:15:42 +0100 Subject: [PATCH] Add generated docs --- spring-cloud.html | 340 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 340 insertions(+) create mode 100644 spring-cloud.html diff --git a/spring-cloud.html b/spring-cloud.html new file mode 100644 index 0000000..8809bd8 --- /dev/null +++ b/spring-cloud.html @@ -0,0 +1,340 @@ + + + + + + + +Spring Cloud + + + + + +
+
+
+
+

Spring Cloud provides tools for developers to quickly build some of +the common patterns in distributed systems (e.g. configuration +management, service discovery, circuit breakers, intelligent routing, +micro-proxy, control bus, one-time tokens, global locks, leadership +election, distributed sessions, cluster state). Coordination of +distributed systems leads to boiler plate patterns, and using Spring +Cloud developers can quickly stand up services and applications that +implement those patterns. They will work well in any distributed +environment, including the developer’s own laptop, bare metal data +centres, and managed platforms such as Pivotal Cloudfoundry.

+
+
+
+
+

Features

+
+
+

Spring Cloud focuses on providing good out of box experience for typical use cases and extensibility mechanism to cover others.

+
+
+
    +
  • +

    Distributed/versioned configuration

    +
  • +
  • +

    Service registration and discovery

    +
  • +
  • +

    Routing

    +
  • +
  • +

    Service-to-service calls

    +
  • +
  • +

    Load balancing

    +
  • +
  • +

    Circuit Breakers

    +
  • +
  • +

    Global locks

    +
  • +
  • +

    Leadership election and cluster state

    +
  • +
  • +

    Distributed messaging

    +
  • +
+
+
+

Unresolved directive in spring-cloud.adoc - include::../../../config/src/main/asciidoc/spring-cloud-config.adoc[]

+
+
+
+

Spring Cloud Netflix

+
+

This project provides Netflix OSS integrations for Spring Boot apps through autoconfiguration +and binding to the Spring Environment and other Spring programming model idioms. With a few +simple annotations you can quickly enable and configure the common patterns inside your +application and build large distributed systems with battle-tested Netflix components. The +patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), +Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon).

+
+
+

Service Discovery: Eureka Clients

+
+
+

Example eureka client:

+
+
+
+
@Configuration
+@ComponentScan
+@EnableAutoConfiguration
+@EnableEurekaClient
+@RestController
+public class Application {
+
+	@RequestMapping("/")
+	public String home() {
+		return "Hello world";
+	}
+
+	public static void main(String[] args) {
+		new SpringApplicationBuilder(Application.class).web(true).run(args);
+	}
+
+}
+
+
+
+

(i.e. utterly normal Spring Boot app). Configuration is required to locate the Eureka server. Example:

+
+
+
+
eureka:
+  client:
+    serviceUrl:
+      defaultZone: http://localhost:8080/v2/
+      default.defaultZone: http://localhost:8080/v2/
+
+
+
+

The default application name, virtual host and non-secure port are taken from the Environment is +${spring.application.name}, ${spring.application.name}.mydomain.net and ${server.port} respectively.

+
+
+
+
+

Service Discovery: Eureka Server

+
+
+

Example eureka server:

+
+
+
+
@Configuration
+@EnableAutoConfiguration
+@EnableEurekaServer
+public class Application {
+
+	public static void main(String[] args) {
+		new SpringApplicationBuilder(Application.class).web(true).run(args);
+	}
+
+}
+
+
+
+

The server has a home page with a UI, and HTTP API endpoints per the +normal Eureka functionality under /v2/*.

+
+
+

Eureka (apache → tomcat) see flux capacitor and google group discussion.

+
+
+
+
+

Circuit Breaker: Hystrix Clients

+
+ +
+
+
+

Circuit Breaker: Hystrix Dashboard

+
+
+

Turbine

+ +
+
+
+
+

Declarative REST Client: Feign

+
+ +
+
+
+

Client Side Load Balancer: Ribbon

+
+ +
+
+
+

External Configuration: Archaius

+
+ +
+
+
+

Router and Filter: Zuul

+
+ +
+
+

Spring Cloud Cluster

+
+

Spring Cloud Cluster offers a set of primitives for building "cluster" +features into a distributed system. Example are leadership election, +consistent storage of cluster state, global locks and one-time tokens.

+
+

Spring Platform Bus

+
+

Spring Cloud Bus links nodes of a distributed system with a lightweight message broker. This can then be used to broadcast state changes (e.g. configuration changes) or other management instructions.

+
+
+

Quick Start

+
+ +
+
+

Spring Cloud for Cloud Foundry

+
+

Integration between Cloud Foundry +and Spring Cloud.

+
+
+

Service Broker Example

+
+
+

Example script to deploy and regis#ter a broker:

+
+
+
+
DOMAIN=mydomain.net
+cf push app -p target/*.jar --no-start
+cf env app | grep SPRING_PROFILES_ACTIVE || cf set-env app SPRING_PROFILES_ACTIVE cloud
+cf env app | grep APPLICATION_DOMAIN || cf set-env app APPLICATION_DOMAIN ${DOMAIN}
+
+cf services | grep configserver && cf bind app configserver
+
+cf restart app
+cf create-service-broker app user secure http://app.${DOMAIN}
+
+for f in `cf curl /v2/service_plans | grep '\"guid' | sed -e 's/.*: "//' -e 's/".*//'`; do
+    cf curl v2/service_plans/$f -X PUT -d '{"public":true}'
+done
+
+cf create-service app free appi
+
+
+
+

At which point you have a service called "app" and a service instance called "appi":

+
+
+
+
$ cf marketplace
+OK
+
+service        plans   description
+app            free    Singleton service app
+$ cf services
+Getting services in org default / space development as admin...
+OK
+
+name           service        plan   bound apps
+appi           app            free
+
+
+
+

Your application can define a configuration property +application.domain (defaults to "cfapps.io") which will be used to +construct the credentials for any app that binds to your service. Or +it can define the URI directly using +cloudfoundry.service.definition.metadata.uri.

+
+
+

You can change some other basic metadata by setting config properties:

+
+
+
    +
  • +

    cloudfoundry.service.definition.* is bound to a +ServiceDefinition (defined in spring-boot-cf-service-broker) which +has optional setters for plans and metadata.

    +
  • +
  • +

    cloudfoundry.service.broker.* is bound to an internal bean. It has +optional setters for "name" (the service name), "description" (user +friendly description) and "prefix" (used to create a unique id from +the name).

    +
  • +
+
+
+

An app which binds to your service will get credentials that contain a +"uri" property linking to your service. A Spring Boot app can bind to +that through the vcap.services.[service].credentials.uri environment +property.

+
+
+

If your service also has a +Eureka core dependency, and you +can expose it as a Eureka service, then any service which registers +with Eureka will also become a Cloud Foundry service.

+
+
+
+
+ + + \ No newline at end of file