Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
• Toshiaki Maki (@making)
https://blog.ik.am
• Sr. Solutions Architect @Pivotal
• Spring Framework
• Cloud Foundry
https://github.com/Pivotal-Japan/cloud-native-workshop
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
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.)
CLOU
D
DESKTOP
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SERVICES
Spring Cloud Services
今日の範囲
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
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.)
CLOU
D
DESKTOP
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SERVICES
Spring Cloud Services
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
API Gateway
API Gateway
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
<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
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
application-dev.properties
order-service-dev.properties
payment-service.profile
payment-service-dev.profile
payment-service-dev.profile
message message
POST
/refresh
@RefreshScope
public class OrderService {
@Value("${message}")
String message;
public String hello() {
return message;
}
}
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
https://www.vaultproject.io/
spring.profiles.active=vault,git
spring.cloud.config.server.vault.host=...
spring.cloud.config.server.git.uri=...
spring.cloud.config.token=...
API Gateway
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
RESTAPIRESTAPI
#0: URL + MD
#1: URL + MD
#2: URL + MD
#0: URL + MD
#1: URL + MD
#2: URL + MD
http://techblog.netflix.com/2012/09/eureka.html
<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);}}
Ribbon
Server List
Server List
⏱
API Gateway
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
行列ができるECサイトの悩み~ショッピングや決済の技術的問題と処方箋
https://www.slideshare.net/techblogyahoo/ec-72726085
行列ができるECサイトの悩み~ショッピングや決済の技術的問題と処方箋
https://www.slideshare.net/techblogyahoo/ec-72726085
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
http://techblog.netflix.com/2012/11/hystrix.html
ClosedOpenHalf-OpenClosed
<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 { ... }
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
API Gateway
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
@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
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
https://www.slideshare.net/makingx/event-driven-microservices-with-spring-cloud-stream-jjugccc-ccca3
API Gateway
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
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 service2
2017-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 service4
2017-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 service3
2017-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 service4
2017-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]]
http://zipkin.io/
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
<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>
API Gateway
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
Consumer Producer
API Gateway
steeltoe.io
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
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.)
CLOU
D
DESKTOP
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SERVICES
Spring Cloud Services
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
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.)
CLOU
D
DESKTOP
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SERVICES
Spring Cloud Services
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
https://youtu.be/BiY3amrDIo0
run.pivotal.io
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.)
CLOU
D
DESKTOP
Spring Boot
Spring Framework
Pivotal Cloud Foundry
Spring Cloud
Microservice operation boilerplate patterns
(Config Server, Service Discovery, Circuit Breaker)
SERVICES
Spring Cloud Services
武器は揃っています。
いつ始めるのですか?
📧
セッションアンケートにご協力ください
➢ 専用アプリからご回答いただけます。
decode 2017
➢ スケジュールビルダーで受講セッションを
登録後、アンケート画面からご回答ください。
➢ アンケートの回答時間はたったの 15 秒です!
Ask the Speaker のご案内
本セッションの詳細は『Ask the Speaker Room』各コーナーカウンタにて
ご説明させていただきます。是非、お立ち寄りください。
© 2017 Microsoft Corporation. All rights reserved.
本情報の内容(添付文書、リンク先などを含む)は、作成日時点でのものであり、予告なく変更される場合があります。
Ask the speaker
でお待ちしています!
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
A) PPT 作成時の基本的ルール
• de:code 用スライドテンプレートの利用
• 16:9 でスライド作成
• フォントは以下を基本とし、スライド作成の都合で各自調整
• 英数字: Segoe UI Light (見出し), Segoe UI (本文)
• 日本語: メイリオ (見出し), メイリオ (本文)
• フォントサイズは 32 ポイント以上を推奨(厳しい場合はスライドのズーム機能などを活用)
• 半角英数字の前後は半角スペースを空ける
• 製品名などは、出来る限りフルスペルで記載
• 正規メディア、ロゴ、ドメイン名の使用
• 著作権の確認と必要に応じて利用許諾の取得
B) プレゼンテーション練習時に最低限押さえておくべきポイント
1. 不測の時代に備え、デモ環境などはビデオ等でも用意
2. プレゼンテーションモード、画面複製出力などは、リハ時に指定
3. 時間内終了厳守に向け、通し練習などを事前に実施
• プレゼンテーションとデモの切り替えタイミングなど
4. 必要に応じて拡大ツールの利用を推奨
• 縦長&小スクリーン部屋ではほぼ必須
5. ビデオ撮影されている事を意識し、不要な発言は慎む (不用意なパスワード露出なども)
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある
アンケートにご協力ください。
■アンケートに ・・・・・・・・・・・・・
■アンケートは・・・・・・・・・・・・・
■アプリ・・・・・・・・・・・・・

More Related Content

[DO07] マイクロサービスに必要な技術要素はすべて Spring Cloud にある