<commit_before>= Spring Boot Cloud CLI
:github: https://github.com/spring-cloud/spring-cloud-cli
:githubmaster: {github}/tree/master
:docslink: {githubmaster}/docs/src/main/asciidoc
:nofooter:

include::intro.adoc[]

include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing-docs.adoc[]

== Installation

include::install.adoc[]

== 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 zipkin
----

Summary of supported deployables:

[options="header"]
|===
|Service | Name | Address | Description

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

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"). E.g. in `configserver.yml` you might want to
do something like this to locate a local git repository for the backend:

.configserver.yml
[source,yaml,indent=0]
----
spring:
  profiles:
    active: git
  cloud:
    config:
      server:
        git:
          uri: file://${user.home}/dev/demo/config-repo
----

== 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
[source,groovy,indent=0]
----
@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
[source,groovy,indent=0]
----
@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+...
----
<commit_msg>Added reference for ~/.spring-cloud config location<commit_after>= Spring Boot Cloud CLI
:github: https://github.com/spring-cloud/spring-cloud-cli
:githubmaster: {github}/tree/master
:docslink: {githubmaster}/docs/src/main/asciidoc
:nofooter:

include::intro.adoc[]

include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing-docs.adoc[]

== Installation

include::install.adoc[]

== 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 zipkin
----

Summary of supported deployables:

[options="header"]
|===
|Service | Name | Address | Description

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

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
[source,yaml,indent=0]
----
spring:
  profiles:
    active: git
  cloud:
    config:
      server:
        git:
          uri: file://${user.home}/dev/demo/config-repo
----

== 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
[source,groovy,indent=0]
----
@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
[source,groovy,indent=0]
----
@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+...
----

{'fraction_non_alphanumeric': 0.100975720444747, 'fraction_numerical': 0.029952348536419333, 'mean_word_length': 4.206733608978145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2969474', 'n_tokens_mistral': 2852, 'n_tokens_neox': 2657, 'n_words': 1046}