Running Spring Cloud Services in Development

The Launcher CLI can be used to run common services like Eureka, Config Server etc. from the command line. To list the available services you can do spring cloud --list, and to launch a default set of services just spring cloud. To choose the services to deploy, just list them on the command line, e.g.spring-doc.cn

$ spring cloud eureka configserver h2 kafka stubrunner zipkin

Summary of supported deployables:spring-doc.cn

Service Name Address Description

eurekaspring-doc.cn

Eureka Serverspring-doc.cn

http://localhost:8761spring-doc.cn

Eureka server for service registration and discovery. All the other services show up in its catalog by default.spring-doc.cn

configserverspring-doc.cn

Config Serverspring-doc.cn

http://localhost:8888spring-doc.cn

Spring Cloud Config Server running in the "native" profile and serving configuration from the local directory ./launcherspring-doc.cn

h2spring-doc.cn

H2 Databasespring-doc.cn

http://localhost:9095 (console), jdbc:h2:tcp://localhost:9096/{data}spring-doc.cn

Relation database service. Use a file path for {data} (e.g. ./target/test) when you connect. Remember that you can add ;MODE=MYSQL or ;MODE=POSTGRESQL to connect with compatibility to other server types.spring-doc.cn

kafkaspring-doc.cn

Kafka Brokerspring-doc.cn

http://localhost:9091 (actuator endpoints), localhost:9092spring-doc.cn

dataflowspring-doc.cn

Dataflow Serverspring-doc.cn

http://localhost:9393spring-doc.cn

Spring Cloud Dataflow server with UI at /admin-ui. Connect the Dataflow shell to target at root path.spring-doc.cn

zipkinspring-doc.cn

Zipkin Serverspring-doc.cn

http://localhost:9411spring-doc.cn

Zipkin Server with UI for visualizing traces. Stores span data in memory and accepts them via HTTP POST of JSON data.spring-doc.cn

stubrunnerspring-doc.cn

Stub Runner Bootspring-doc.cn

http://localhost:8750spring-doc.cn

Downloads WireMock stubs, starts WireMock and feeds the started servers with stored stubs. Pass stubrunner.ids to pass stub coordinates and then go to http://localhost:8750/stubs.spring-doc.cn

Each of these apps can be configured using a local YAML file with the same name (in the current working directory or a subdirectory called "config" or in ~/.spring-cloud). E.g. in configserver.yml you might want to do something like this to locate a local git repository for the backend:spring-doc.cn

configserver.yml
spring:
  profiles:
    active: git
  cloud:
    config:
      server:
        git:
          uri: file://${user.home}/dev/demo/config-repo

E.g. in Stub Runner app you could fetch stubs from your local .m2 in the following way.spring-doc.cn

stubrunner.yml
stubrunner:
  workOffline: true
  ids:
    - com.example:beer-api-producer:+:9876

Adding Additional Applications

Additional applications can be added to ./config/cloud.yml (not ./config.yml because that would replace the defaults), e.g. withspring-doc.cn

config/cloud.yml
spring:
  cloud:
    launcher:
      deployables:
        source:
          coordinates: maven://com.example:source:0.0.1-SNAPSHOT
          port: 7000
        sink:
          coordinates: maven://com.example:sink:0.0.1-SNAPSHOT
          port: 7001

when you list the apps:spring-doc.cn

$ spring cloud --list
source sink configserver dataflow eureka h2 kafka stubrunner zipkin

(notice the additional apps at the start of the list).spring-doc.cn