From 227c3144aac226ebc0893f6616b96d44800d89d5 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Mon, 5 Aug 2019 22:41:27 +0200 Subject: [PATCH] Added the redirection link to the documentation --- index.html | 122 +-------- multi/multi_spring-cloud-cli.html | 15 +- single/index.html | 12 + single/spring-cloud-cli.html | 91 +------ spring-cloud-cli.html | 423 +----------------------------- 5 files changed, 51 insertions(+), 612 deletions(-) create mode 100644 single/index.html diff --git a/index.html b/index.html index 7b5cd12..48e6a8f 100644 --- a/index.html +++ b/index.html @@ -1,120 +1,12 @@ ---- -# The name of your project -title: Spring Cloud CLI - -badges: - - # Specify your project's twitter handle, if any. Delete if none. - # twitter: SpringData - - # Customize your project's badges. Delete any entries that do not apply. - custom: - - name: Source (GitHub) - url: https://github.com/spring-cloud/spring-cloud-cli - icon: github - - - name: StackOverflow - url: https://stackoverflow.com/questions/tagged/spring-cloud - icon: stackoverflow - ---- - - -{% capture parent_link %} -[Spring Parent]({{ site.projects_site_url }}/spring-cloud) -{% endcapture %} + + + -{% capture billboard_description %} +Page Redirection -Spring Cloud CLI is a set of extensions for the [Spring Boot -CLI](https://docs.spring.io/spring-boot) making it possible to run -Spring Cloud server apps and write Spring Cloud apps in Groovy scripts -and run them from a shell. Auto-imports and dependency management is -provided for all Spring Cloud projects. - -{% endcapture %} - -{% capture main_content %} - - - -## Quick Start - -To install the CLI, make -sure you have -[Spring Boot CLI](https://github.com/spring-projects/spring-boot) -(1.4.4 or better): - - $ spring version - Spring CLI v1.5.3.RELEASE - -E.g. for SDKMan users - -``` -$ sdk install springboot 1.5.3.RELEASE -$ sdk use springboot 1.5.3.RELEASE -``` - -and install the Spring Cloud plugin: - -``` -$ spring install org.springframework.cloud:spring-cloud-cli:1.3.1.RELEASE -``` - -### Launch a Server - -To run a config server: - -``` -$ spring cloud configserver -``` - -You can also run eureka, zipkin, hystrixdashboard, h2, kafka or -dataflow (multiple apps can be run if separated by spaces on the -command line). - -### Write a Groovy Script and Run It - -Any Spring Boot CLI app with the Cloud CLI extensions installed will -be a Spring Cloud Config Client, so set the `spring.cloud.config.uri` -to point to a Config Server and you are in business (defaults to -"http://localhost:8888"). - -Here's a complete Eureka Server: - -```groovy -@EnableEurekaServer -@RestController -class Eureka {} -``` - -### Encrypt and Decrypt - -Example (symmetric key): - -``` -$ spring encrypt --key=secret foo -``` - -IMPORTANT: **Prerequisites:** to use the encryption and decryption features -you need the full-strength JCE installed in your JVM (it's not there by default). -You can download the "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" -from Oracle, and follow instructions for installation (essentially replace the 2 policy files -in the JRE lib/security directory with the ones that you downloaded). - -{% endcapture %} - -{% capture related_resources %} - -### Sample Projects - -* [Minimal (Groovy) Client](https://github.com/spring-cloud-samples/scripts/blob/master/demo/client.groovy) - -{% endcapture %} - - -{% include project_page.html %} - +If you are not redirected automatically, follow the link to latest snapshot documentation diff --git a/multi/multi_spring-cloud-cli.html b/multi/multi_spring-cloud-cli.html index 01959df..48e6a8f 100644 --- a/multi/multi_spring-cloud-cli.html +++ b/multi/multi_spring-cloud-cli.html @@ -1,3 +1,12 @@ - - - Spring Boot Cloud CLI

Spring Boot Cloud CLI


\ No newline at end of file + + + + + + + +Page Redirection + +If you are not redirected automatically, follow the link to latest snapshot documentation diff --git a/single/index.html b/single/index.html new file mode 100644 index 0000000..48e6a8f --- /dev/null +++ b/single/index.html @@ -0,0 +1,12 @@ + + + + + + + +Page Redirection + +If you are not redirected automatically, follow the link to latest snapshot documentation diff --git a/single/spring-cloud-cli.html b/single/spring-cloud-cli.html index 9359fa1..48e6a8f 100644 --- a/single/spring-cloud-cli.html +++ b/single/spring-cloud-cli.html @@ -1,79 +1,12 @@ - - - Spring Boot Cloud CLI

Spring Boot Cloud CLI


Spring Boot CLI provides Spring -Boot command line features for Spring -Cloud. You can write Groovy scripts to run Spring Cloud component -applications (e.g. @EnableEurekaServer). You can also easily do -things like encryption and decryption to support Spring Cloud Config -clients with secret configuration values. With the Launcher CLI you -can launch services like Eureka, Zipkin, Config Server -conveniently all at once from the command line (very useful at -development time).

[Note]Note

Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github.

1. Installation

To install, make -sure you have -Spring Boot CLI -(2.0.0 or better):

$ spring version
-Spring CLI v2.1.0.M4

E.g. for SDKMan users

$ sdk install springboot 2.1.0.M4
-$ sdk use springboot 2.1.0.M4

and install the Spring Cloud plugin

$ mvn install
-$ spring install org.springframework.cloud:spring-cloud-cli:2.1.0.BUILD-SNAPSHOT
[Important]Important

Prerequisites: to use the encryption and decryption features -you need the full-strength JCE installed in your JVM (it’s not there by default). -You can download the "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" -from Oracle, and follow instructions for installation (essentially replace the 2 policy files -in the JRE lib/security directory with the ones that you downloaded).

2. 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 cloud eureka configserver h2 kafka stubrunner zipkin

Summary of supported deployables:

ServiceNameAddressDescription

eureka

Eureka Server

http://localhost:8761

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

configserver

Config Server

http://localhost:8888

Spring Cloud Config Server running in the "native" profile and serving configuration from the local directory ./launcher

h2

H2 Database

http://localhost:9095 (console), jdbc:h2:tcp://localhost:9096/{data}

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.

kafka

Kafka Broker

http://localhost:9091 (actuator endpoints), localhost:9092

 

hystrixdashboard

Hystrix Dashboard

http://localhost:7979

Any Spring Cloud app that declares Hystrix circuit breakers publishes metrics on /hystrix.stream. Type that address into the dashboard to visualize all the metrics,

dataflow

Dataflow Server

http://localhost:9393

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

zipkin

Zipkin Server

http://localhost:9411

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

stubrunner

Stub Runner Boot

http://localhost:8750

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.

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:

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.

stubrunner.yml.  -

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

-

2.1 Adding Additional Applications

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

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 cloud --list
-source sink configserver dataflow eureka h2 hystrixdashboard kafka stubrunner zipkin

(notice the additional apps at the start of the list).

3. Writing Groovy Scripts and Running Applications

Spring Cloud CLI has support for most of the Spring Cloud declarative -features, such as the @Enable* class of annotations. For example, -here is a fully functional Eureka server

app.groovy.  -

@EnableEurekaServer
-class Eureka {}

-

which you can run from the command line like this

$ spring run app.groovy

To include additional dependencies, often it suffices just to add the -appropriate feature-enabling annotation, e.g. @EnableConfigServer, -@EnableOAuth2Sso or @EnableEurekaClient. To manually include a -dependency you can use a @Grab with the special "Spring Boot" short -style artifact co-ordinates, i.e. with just the artifact ID (no need -for group or version information), e.g. to set up a client app to -listen on AMQP for management events from the Spring CLoud Bus:

app.groovy.  -

@Grab('spring-cloud-starter-bus-amqp')
-@RestController
-class Service {
-  @RequestMapping('/')
-  def home() { [message: 'Hello'] }
-}

-

4. Encryption and Decryption

The Spring Cloud CLI comes with an "encrypt" and a "decrypt" -command. Both accept arguments in the same form with a key specified -as a mandatory "--key", e.g.

$ spring encrypt mysecret --key foo
-682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda
-$ spring decrypt --key foo 682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda
-mysecret

To use a key in a file (e.g. an RSA public key for encyption) prepend -the key value with "@" and provide the file path, e.g.

$ spring encrypt mysecret --key @${HOME}/.ssh/id_rsa.pub
-AQAjPgt3eFZQXwt8tsHAVv/QHiY5sI2dRcR+...
\ No newline at end of file + + + + + + + +Page Redirection + +If you are not redirected automatically, follow the link to latest snapshot documentation diff --git a/spring-cloud-cli.html b/spring-cloud-cli.html index 3f5f34f..48e6a8f 100644 --- a/spring-cloud-cli.html +++ b/spring-cloud-cli.html @@ -1,419 +1,12 @@ - - - + + - - - -Spring Boot Cloud CLI - - + - - - - - - -
-
-
-
-

Spring Boot CLI provides Spring -Boot command line features for Spring -Cloud. You can write Groovy scripts to run Spring Cloud component -applications (e.g. @EnableEurekaServer). You can also easily do -things like encryption and decryption to support Spring Cloud Config -clients with secret configuration values. With the Launcher CLI you -can launch services like Eureka, Zipkin, Config Server -conveniently all at once from the command line (very useful at -development time).

-
-
- - - - - -
- - -Spring Cloud is released under the non-restrictive Apache 2.0 license. If you would like to contribute to this section of the documentation or if you find an error, please find the source code and issue trackers in the project at github. -
-
-
-
-
-

Installation

-
-
-

To install, make -sure you have -Spring Boot CLI -(2.0.0 or better):

-
-
-
-
$ spring version
-Spring CLI v2.2.0.BUILD-SNAPSHOT
-
-
-
-

E.g. for SDKMan users

-
-
-
-
$ sdk install springboot 2.2.0.BUILD-SNAPSHOT
-$ sdk use springboot 2.2.0.BUILD-SNAPSHOT
-
-
-
-

and install the Spring Cloud plugin

-
-
-
-
$ mvn install
-$ spring install org.springframework.cloud:spring-cloud-cli:2.2.0.BUILD-SNAPSHOT
-
-
-
- - - - - -
- - -Prerequisites: to use the encryption and decryption features -you need the full-strength JCE installed in your JVM (it’s not there by default). -You can download the "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" -from Oracle, and follow instructions for installation (essentially replace the 2 policy files -in the JRE lib/security directory with the ones that you downloaded). -
-
-
-
-
-

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 cloud eureka configserver h2 kafka stubrunner zipkin
-
-
-
-

Summary of supported deployables:

-
- ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ServiceNameAddressDescription

eureka

Eureka Server

http://localhost:8761

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

configserver

Config Server

http://localhost:8888

Spring Cloud Config Server running in the "native" profile and serving configuration from the local directory ./launcher

h2

H2 Database

http://localhost:9095 (console), jdbc:h2:tcp://localhost:9096/{data}

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.

kafka

Kafka Broker

http://localhost:9091 (actuator endpoints), localhost:9092

hystrixdashboard

Hystrix Dashboard

http://localhost:7979

Any Spring Cloud app that declares Hystrix circuit breakers publishes metrics on /hystrix.stream. Type that address into the dashboard to visualize all the metrics,

dataflow

Dataflow Server

http://localhost:9393

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

zipkin

Zipkin Server

http://localhost:9411

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

stubrunner

Stub Runner Boot

http://localhost:8750

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.

-
-

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:

-
-
-
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.

-
-
-
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. with

-
-
-
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 cloud --list
-source sink configserver dataflow eureka h2 hystrixdashboard kafka stubrunner zipkin
-
-
-
-

(notice the additional apps at the start of the list).

-
-
-
-
-
-

Writing Groovy Scripts and Running Applications

-
-
-

Spring Cloud CLI has support for most of the Spring Cloud declarative -features, such as the @Enable* class of annotations. For example, -here is a fully functional Eureka server

-
-
-
app.groovy
-
-
@EnableEurekaServer
-class Eureka {}
-
-
-
-

which you can run from the command line like this

-
-
-
-
$ spring run app.groovy
-
-
-
-

To include additional dependencies, often it suffices just to add the -appropriate feature-enabling annotation, e.g. @EnableConfigServer, -@EnableOAuth2Sso or @EnableEurekaClient. To manually include a -dependency you can use a @Grab with the special "Spring Boot" short -style artifact co-ordinates, i.e. with just the artifact ID (no need -for group or version information), e.g. to set up a client app to -listen on AMQP for management events from the Spring CLoud Bus:

-
-
-
app.groovy
-
-
@Grab('spring-cloud-starter-bus-amqp')
-@RestController
-class Service {
-  @RequestMapping('/')
-  def home() { [message: 'Hello'] }
-}
-
-
-
-
-
-

Encryption and Decryption

-
-
-

The Spring Cloud CLI comes with an "encrypt" and a "decrypt" -command. Both accept arguments in the same form with a key specified -as a mandatory "--key", e.g.

-
-
-
-
$ spring encrypt mysecret --key foo
-682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda
-$ spring decrypt --key foo 682bc583f4641835fa2db009355293665d2647dade3375c0ee201de2a49f7bda
-mysecret
-
-
-
-

To use a key in a file (e.g. an RSA public key for encyption) prepend -the key value with "@" and provide the file path, e.g.

-
-
-
-
$ spring encrypt mysecret --key @${HOME}/.ssh/id_rsa.pub
-AQAjPgt3eFZQXwt8tsHAVv/QHiY5sI2dRcR+...
-
-
-
-
-
- - - - - - - \ No newline at end of file +Page Redirection + +If you are not redirected automatically, follow the link to latest snapshot documentation