View
1.537
Download
0
Category
Preview:
Citation preview
• Toshiaki Maki (@making)
https://blog.ik.am
• Sr. Solutions Architect @Pivotal
• Spring Framework
• Cloud Foundry
https://github.com/Pivotal-Japan/cloud-native-workshop
Application coordination boilerplate patterns
Application configuration boilerplate patterns
Enterprise Java application boilerplate patterns
Runtime Platform, Infrastructure Automation boilerplate
patterns (provision, deploy, secure, log, data services, etc.)
CLO
U
D
DES
KTO
P
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SER
VIC
ES
Spring Cloud Services今日の範囲
Application coordination boilerplate patterns
Application configuration boilerplate patterns
Enterprise Java application boilerplate patterns
Runtime Platform, Infrastructure Automation boilerplate
patterns (provision, deploy, secure, log, data services, etc.)
CLO
U
D
DES
KTO
P
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SER
VIC
ES
Spring Cloud Services
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
@SpringBootApplication
@EnableConfigServer
public class MyConfigServerApplication { ... }
server.port=8888
spring.cloud.config.server.git.uri=https://github.com/xyz/config.git
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
spring.application.name=order-service
spring.cloud.config.uri=http://localhost:8888
application-dev.properties
order-service-dev.properties
payment-service.profilepayment-service-dev.profilepayment-service-dev.profile
@RefreshScopepublic class OrderService {@Value("${message}")String message;
public String hello() {return message;
}}
spring.profiles.active=vault,git
spring.cloud.config.server.vault.host=...
spring.cloud.config.server.git.uri=...
spring.cloud.config.token=...
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-eureka-server</artifactId>
</dependency>
@SpringBootApplication
@EnableEurekaServer
public class MyEurekaServerApplication { ... }
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
spring.application.name=order-service # config-server使用時は
# bootstrap.propertiesに
eureka.client.service-url.defaultZone=http://localhost:8761
@SpringBootApplication
@EnableDiscovertyClient
public class OrderServiceApplication { ... }
public class OrderService {
DiscoveryClient discoveryClient;
public void order() {
List<ServiceInstance> list =
discoveryClient.getInstances("payment-service");
URL paymentUrl = list.get(0).getUri()
// ...
}
}
http://techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
public class OrderService {
@LoadBalanced RestTemplate restTemplate;
public void order() {
restTemplate
.postForEntity("http://payment-service",
Payment.class);}}
行列ができるECサイトの悩み~ショッピングや決済の技術的問題と処方箋
https://www.slideshare.net/techblogyahoo/ec-72726085
行列ができるECサイトの悩み~ショッピングや決済の技術的問題と処方箋
https://www.slideshare.net/techblogyahoo/ec-72726085
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
@SpringBootApplication
@EnableCircuitBreaker
public class OrderServiceApplication { ... }
@HystrixCommand(fallbackMethod = "getTop10")
public Recommendations getRecommendation(String username) {
return restTemplate.getForObject("http://recommendation?u={u}",
username, Recommendations.class);
}
public Recommendations getTop10(String username) {
return recommendationsCache.getTop10();
}
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
@SpringBootApplication
@EnableHystrixDashboard
public class HystrixDashboardApplication { ... }
@SpringBootApplication
@EnableBinding(Source.class)
public class OrderServiceApplication {
// ...
@Autowired Source source;
@PostMapping void order(@RequestBody Order order) {
Message message = MessageBuilder.fromPayload(order).build();
source.output().send(message);
}
}
spring.cloud.stream.bindings.output.destination=order
@SpringBootApplication
@EnableBinding(Sink.class)
public class DeliveryServiceApplication {
// ...
@StreamListener(Sink.INPUT)
void handlerOrder(@Payload Order order) {
deliverySerivice.deliver(order);
}
}
spring.cloud.stream.bindings.input.destination=order
spring.cloud.stream.bindings.input.destination=order
spring.cloud.stream.bindings.input.group=point-service
spring.cloud.stream.bindings.input.destination=order
spring.cloud.stream.bindings.input.group=delivery-service
spring.cloud.stream.bindings.input.destination=order
spring.cloud.stream.bindings.input.group=notification-service
https://www.slideshare.net/makingx/event-driven-microservices-with-spring-cloud-stream-jjugccc-ccca3
2017-02-26 11:15:47.561 INFO [service1,2485ec27856c56f4,2485ec27856c56f4,true] 68058 --- [nio-8081-exec-1] i.s.c.sleuth.docs.service1.Application : Hello from service1. Calling service22017-02-26 11:15:47.710 INFO [service2,2485ec27856c56f4,9aa10ee6fbde75fa,true] 68059 --- [nio-8082-exec-1] i.s.c.sleuth.docs.service2.Application : Hello from service2. Calling service3 and then service42017-02-26 11:15:47.895 INFO [service3,2485ec27856c56f4,1210be13194bfe5,true] 68060 --- [nio-8083-exec-1] i.s.c.sleuth.docs.service3.Application : Hello from service32017-02-26 11:15:47.924 INFO [service2,2485ec27856c56f4,9aa10ee6fbde75fa,true] 68059 --- [nio-8082-exec-1] i.s.c.sleuth.docs.service2.Application : Got response from service3 [Hello from service3]2017-02-26 11:15:48.134 INFO [service4,2485ec27856c56f4,1b1845262ffba49d,true] 68061 --- [nio-8084-exec-1] i.s.c.sleuth.docs.service4.Application : Hello from service42017-02-26 11:15:48.156 INFO [service2,2485ec27856c56f4,9aa10ee6fbde75fa,true] 68059 --- [nio-8082-exec-1] i.s.c.sleuth.docs.service2.Application : Got response from service4 [Hello from service4]2017-02-26 11:15:48.182 INFO [service1,2485ec27856c56f4,2485ec27856c56f4,true] 68058 --- [nio-8081-exec-1] i.s.c.sleuth.docs.service1.Application : Got response from service2 [Hello from service2, response from service3 [Hello from service3] and from service4 [Hello from service4]]
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
Application coordination boilerplate patterns
Application configuration boilerplate patterns
Enterprise Java application boilerplate patterns
Runtime Platform, Infrastructure Automation boilerplate
patterns (provision, deploy, secure, log, data services, etc.)
CLO
U
D
DES
KTO
P
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SER
VIC
ES
Spring Cloud Services
IaaS Cloud Foundry
ファイアウォールの設定
死活監視の設定
SSLの設定
ロードバランサの設定
アプリケーションのデプロイ
ランタイムのインストール
VMのプロビジョニング
cf push myapp ¥-p app.jar
マーケットプレースからインストール可能https://azuremarketplace.microsoft.com/en-us/marketplace/apps/pivotal.pivotal-cloud-foundry
Application coordination boilerplate patterns
Application configuration boilerplate patterns
Enterprise Java application boilerplate patterns
Runtime Platform, Infrastructure Automation boilerplate
patterns (provision, deploy, secure, log, data services, etc.)
CLO
U
D
DES
KTO
P
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SER
VIC
ES
Spring Cloud Services
Application coordination boilerplate patterns
Application configuration boilerplate patterns
Enterprise Java application boilerplate patterns
Runtime Platform, Infrastructure Automation boilerplate
patterns (provision, deploy, secure, log, data services, etc.)
CLO
U
D
DES
KTO
P
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SER
VIC
ES
Spring Cloud Services武器は揃っています。いつ始めるのですか?
セッションアンケートにご協力ください
➢ 専用アプリからご回答いただけます。
decode 2017
➢ スケジュールビルダーで受講セッションを登録後、アンケート画面からご回答ください。
➢ アンケートの回答時間はたったの 15 秒です!
© 2017 Microsoft Corporation. All rights reserved.
本情報の内容(添付文書、リンク先などを含む)は、作成日時点でのものであり、予告なく変更される場合があります。
Ask the speakerでお待ちしています!
A) PPT 作成時の基本的ルール• de:code 用スライドテンプレートの利用• 16:9 でスライド作成• フォントは以下を基本とし、スライド作成の都合で各自調整
• 英数字: Segoe UI Light (見出し), Segoe UI (本文)
• 日本語: メイリオ (見出し), メイリオ (本文)
• フォントサイズは 32 ポイント以上を推奨(厳しい場合はスライドのズーム機能などを活用)• 半角英数字の前後は半角スペースを空ける• 製品名などは、出来る限りフルスペルで記載• 正規メディア、ロゴ、ドメイン名の使用• 著作権の確認と必要に応じて利用許諾の取得
B) プレゼンテーション練習時に最低限押さえておくべきポイント1. 不測の時代に備え、デモ環境などはビデオ等でも用意2. プレゼンテーションモード、画面複製出力などは、リハ時に指定3. 時間内終了厳守に向け、通し練習などを事前に実施
• プレゼンテーションとデモの切り替えタイミングなど4. 必要に応じて拡大ツールの利用を推奨
• 縦長&小スクリーン部屋ではほぼ必須5. ビデオ撮影されている事を意識し、不要な発言は慎む (不用意なパスワード露出なども)
Recommended