Files
spring-cloud-cli/multi/multi__running_spring_cloud_services_in_development.html
2018-10-03 14:01:50 +00:00

36 lines
12 KiB
HTML

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>2.&nbsp;Running Spring Cloud Services in Development</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-cli.html" title="Spring Boot Cloud CLI"><link rel="up" href="multi_spring-cloud-cli.html" title="Spring Boot Cloud CLI"><link rel="prev" href="multi__installation.html" title="1.&nbsp;Installation"><link rel="next" href="multi__writing_groovy_scripts_and_running_applications.html" title="3.&nbsp;Writing Groovy Scripts and Running Applications"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.&nbsp;Running Spring Cloud Services in Development</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__installation.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__writing_groovy_scripts_and_running_applications.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_running_spring_cloud_services_in_development" href="#_running_spring_cloud_services_in_development"></a>2.&nbsp;Running Spring Cloud Services in Development</h1></div></div></div><p>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 <code class="literal">spring cloud --list</code>, and to launch a default set
of services just <code class="literal">spring cloud</code>. To choose the services to deploy,
just list them on the command line, e.g.</p><pre class="screen">$ spring cloud eureka configserver h2 kafka stubrunner zipkin</pre><p>Summary of supported deployables:</p><div class="informaltable"><table class="informaltable" style="border-collapse: collapse;border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Service</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Name</th><th style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top">Address</th><th style="border-bottom: 1px solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>eureka</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Eureka Server</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:8761" target="_top">http://localhost:8761</a></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Eureka server for service registration and discovery. All the other services show up in its catalog by default.</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>configserver</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Config Server</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:8888" target="_top">http://localhost:8888</a></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Spring Cloud Config Server running in the "native" profile and serving configuration from the local directory ./launcher</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>h2</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>H2 Database</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:9095" target="_top">http://localhost:9095</a> (console), jdbc:h2:tcp://localhost:9096/{data}</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Relation database service. Use a file path for <code class="literal">{data}</code> (e.g. <code class="literal">./target/test</code>) when you connect. Remember that you can add <code class="literal">;MODE=MYSQL</code> or <code class="literal">;MODE=POSTGRESQL</code> to connect with compatibility to other server types.</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>kafka</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Kafka Broker</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:9091" target="_top">http://localhost:9091</a> (actuator endpoints), localhost:9092</p></td><td style="border-bottom: 1px solid ; " align="left" valign="top">&nbsp;</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>hystrixdashboard</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Hystrix Dashboard</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:7979" target="_top">http://localhost:7979</a></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Any Spring Cloud app that declares Hystrix circuit breakers publishes metrics on <code class="literal">/hystrix.stream</code>. Type that address into the dashboard to visualize all the metrics,</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>dataflow</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Dataflow Server</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:9393" target="_top">http://localhost:9393</a></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Spring Cloud Dataflow server with UI at /admin-ui. Connect the Dataflow shell to target at root path.</p></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>zipkin</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p>Zipkin Server</p></td><td style="border-right: 1px solid ; border-bottom: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:9411" target="_top">http://localhost:9411</a></p></td><td style="border-bottom: 1px solid ; " align="left" valign="top"><p>Zipkin Server with UI for visualizing traces. Stores span data in memory and accepts them via HTTP POST of JSON data.</p></td></tr><tr><td style="border-right: 1px solid ; " align="left" valign="top"><p>stubrunner</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p>Stub Runner Boot</p></td><td style="border-right: 1px solid ; " align="left" valign="top"><p><a class="link" href="http://localhost:8750" target="_top">http://localhost:8750</a></p></td><td style="" align="left" valign="top"><p>Downloads WireMock stubs, starts WireMock and feeds the started servers with stored stubs. Pass <code class="literal">stubrunner.ids</code> to pass stub coordinates and then go to <code class="literal"><a class="link" href="http://localhost:8750/stubs" target="_top">http://localhost:8750/stubs</a></code>.</p></td></tr></tbody></table></div><p>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 <code class="literal">~/.spring-cloud</code>). E.g. in <code class="literal">configserver.yml</code> you might want to
do something like this to locate a local git repository for the backend:</p><p><b>configserver.yml.&nbsp;</b>
</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> active</span>: git
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> cloud</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> config</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> server</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> git</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> uri</span>: file://${user.home}/dev/demo/config-repo</pre><p>
</p><p>E.g. in Stub Runner app you could fetch stubs from your local <code class="literal">.m2</code> in the following way.</p><p><b>stubrunner.yml.&nbsp;</b>
</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">stubrunner</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> workOffline</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">true</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> ids</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> - com.example</span>:beer-api-producer:+:<span class="hl-number">9876</span></pre><p>
</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_adding_additional_applications" href="#_adding_additional_applications"></a>2.1&nbsp;Adding Additional Applications</h2></div></div></div><p>Additional applications can be added to <code class="literal">./config/cloud.yml</code> (not
<code class="literal">./config.yml</code> because that would replace the defaults), e.g. with</p><p><b>config/cloud.yml.&nbsp;</b>
</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> cloud</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> launcher</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> deployables</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> source</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> coordinates</span>: maven://com.example:source:<span class="hl-number">0.0</span>.<span class="hl-number">1</span>-SNAPSHOT
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span class="hl-number">7000</span>
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> sink</span>:
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> coordinates</span>: maven://com.example:sink:<span class="hl-number">0.0</span>.<span class="hl-number">1</span>-SNAPSHOT
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span class="hl-number">7001</span></pre><p>
</p><p>when you list the apps:</p><pre class="screen">$ spring cloud --list
source sink configserver dataflow eureka h2 hystrixdashboard kafka stubrunner zipkin</pre><p>(notice the additional apps at the start of the list).</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__installation.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__writing_groovy_scripts_and_running_applications.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">1.&nbsp;Installation&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-cli.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;3.&nbsp;Writing Groovy Scripts and Running Applications</td></tr></table></div></body></html>