Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Spring Boot Adminことはじめ / Introduction of Spring...
Search
LINE Developers
PRO
March 25, 2019
Technology
1
1.2k
Spring Boot Adminことはじめ / Introduction of Spring Boot Admin
LINE Developers
PRO
March 25, 2019
Tweet
Share
More Decks by LINE Developers
See All by LINE Developers
LINEスタンプのSREing事例集:大きなスパイクアクセスを捌くためのSREing
line_developers
PRO
1
2k
Java 21 Overview
line_developers
PRO
6
1k
Code Review Challenge: An example of a solution
line_developers
PRO
1
1.1k
KARTEのAPIサーバ化
line_developers
PRO
1
440
著作権とは何か?〜初歩的概念から権利利用法、侵害要件まで
line_developers
PRO
5
2k
生成AIと著作権 〜生成AIによって生じる著作権関連の課題と対処
line_developers
PRO
3
2k
マイクロサービスにおけるBFFアーキテクチャでのモジュラモノリスの導入
line_developers
PRO
9
3k
A/B Testing at LINE NEWS
line_developers
PRO
3
830
LINEのサポートバージョンの考え方
line_developers
PRO
2
1.1k
Other Decks in Technology
See All in Technology
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
550
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
[FOSS4G 2024 Japan LT] LLMを使ってGISデータ解析を自動化したい!
nssv
1
210
強いチームと開発生産性
onk
PRO
34
11k
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
580
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
7
810
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
220
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
310
Featured
See All Featured
Faster Mobile Websites
deanohume
305
30k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Building Applications with DynamoDB
mza
90
6.1k
Docker and Python
trallard
40
3.1k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Automating Front-end Workflow
addyosmani
1366
200k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
The Language of Interfaces
destraynor
154
24k
Embracing the Ebb and Flow
colly
84
4.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Transcript
Spring Boot Admin ͜ͱ͡Ί Kazuhiro OSAWA, LINE Corporation. 2019/03/25 JSUGษڧձ
2019ͦͷ3 LINEʹ͓͚ΔSpringͷ׆༻
@yappo https://github.com/yappo ࣗݾհ େ LINEגࣜձࣾ ։ൃ3ηϯλʔॴଐ LINE LIVE ։ൃ୲ͳͲ
• ಋೖͷ͖͔͚ͬ • ಋೖͯ͠ΈΔ • Tips • ಋೖͯ͠ΈͯΘ͔ͬͨ͜ͱ Agenda
• LINE LIVE ͱ͍͏αʔϏεͰ Spring Boot Admin Λಋೖͨ͠ܦݧΛݩʹ͠·͢ • ಋೖ͔ͯ͠Β1ϲ݄ܦͬͯͳ͍͘Β͍Ͱ͢
• Ωϟϓνϟը૾ͷॴʑʹमਖ਼ೖΕͯ·͢ લఏ
ಋೖͷ͖͔͚ͬ
ଟͷΞϓϦέʔγϣϯίϯϙʔωϯτ ※·ͩະಋೖͷ ίϯϙʔωϯτଟ͋Δ
֤ίϯϙʔωϯτछྨ͝ͱʹ ٕज़ελοΫҧ͍ͬͯͨ ϦϦʔεॳ WAF Ҡߦޙ core Avans Spring Boot 2.1.3
ཧը໘ Spring 4.3.x Spring Boot 2.2.x (༧ఆ) chat Spring Boot 1.4.x Spring Boot 2.2.x (༧ఆ) for LINE Bot Spring Boot 1.5.x Spring Boot 2.1.3 ։ൃνʔϜ͕एׯ͔Ε͍ͯͨɺͱ͔͍͏Α͋͘Δཧ༝ɻ
Spring Boot ՔಇΠϯελϯε 200Πϯελϯεڧ
• γεςϜϝτϦΫε • Grafana • Kibana • Ξϥʔτ௨ • IMON
(https://www.slideshare.net/linecorp/observability-at-line) • Prometheus • ϩάࢹ • IMON • Kibana • ϓϩϑΝΠϦϯά • VisualVM, Java Flight Recorder, jstack, etc ֤छπʔϧ
Ξϥʔτड৴ εϨουμϯϓऔಘ VisualVM ηοτΞοϓ Login ͯ͠ jstack োൃੜ ϓϩϑΝΠϦϯά࡞ۀͷखؒ ෳಉ࣌ଟൃతʹΞϥʔτ͕ඈΜͩΓ͢Δͱɺख͕ؒͳ͔ͳ͔͔͔Δɻɻɻ
VisualVM োରԠͰ׆༂த͕ͩɺͦΕͦΕ https://www.slideshare.net/linecorp/update-of-line-live-over-the-past-year
• దͳόʔδϣϯͷΞϓϦέʔγϣϯ͕σϓϩΠ͞ΕͯΔ͔Γ͍ͨ • JVM ͕దʹՔಇ͍ͯ͠Δ͔ΛϦΞϧλΠϜʹݟ͍ͨ • దͳઃఆͰΞϓϦέʔγϣϯ͕Քಇ͍ͯ͠Δ͔Λݟ͍ͨ • CPU/Memory αϯϓϦϯά
(Spring Boot Admin Ͱݱঢ়Ͱ͖ͳ͍) • αʔόଟΊͳͷͰɺઃఆϑϦʔͩͱେܴ • ίετͷ͜ͱΛߟ͑ΔͱɺαʔόΛݮΒָ͍ͨ࣌ͨ͠͠ • ͜ΕΒͷใΛαʔϏεʹར༻͍ͯ͠ΔαʔόΠϯελϯεશͯͰҰݩཧͰ͖ ΔμογϡϘʔυతͳͷ ཉ͔ͬͨ͠ͷ
ಋೖͯ͠ΈΔ
• ಋೖ͕؆୯ • Actuator ͰऔಘͰ͖ΔใΛ Web UI Ͱදࣔ͢Δ • Πϯελϯεͷ
Up/Down ͷΠϕϯτൃੜ࣌ʹ Slack ͳͲͰ௨͢Δ͜ͱ͕Մೳ • ࣗલͷ௨खஈ࣮ʹΑΓՄೳ • ೝূͷΈͳ͍͕ Spring Boot Security Λར༻͢ΔͳͲͯ͠ಋೖՄೳ • Hazelcast Λར༻ͨ͠ΫϥελϦϯά • ಋೖͷࢀߟʹͳΔαϯϓϧ͕๛ Spring Boot Admin ͷಛ
Spring Boot Admin શମߏ Application With SBA Client Spring Boot
Admin Server Web Browser Application With SBA Client Application With SBA Client Registration Show Instances Fetch Actuators Fetch Actuators (Proxy)
Spring Boot Admin Server ͷΈ Application With SBA Client •
@EnableAdminServer ΞϊςʔγϣϯΛ͚ͭΔ͜ͱͰ AdminServerMarkerConfiguration.Marker (ҎԼ Marker) ͕ Bean ొ͞ΕΔ • ݁Ռతʹ AdminServerAutoConfiguration ͕༗ޮ͔͞Ε SBA ͷΞϓϦέʔγϣϯ ͕࣮ߦ͞ΕΔ • Client ͔ΒͷొΛ /instances ʹ POST ͞ΕΔ͜ͱͰड͚͚Δ • ड͚͚ͨσʔλΛ InMemory ͔ Hazelcast ʹอଘ • Event Journal ͰҰཡදࣔͯ͠Δ • Web UI ͕ /instances/{instanceId}/actuator/** ͷϦΫΤετΛड͚ͨΒɺԼهͷΑ ͏ʹ proxy ͢Δ Spring Boot Admin Server Web Browser
Spring Boot Admin Client ͷΈ • spring.factories ͷதͰ SpringBootAdminClientAutoConfiguration ΛಡΈࠐΜͰΔ
• ͦͷதͰ RegistrationApplicationListener ͷ Bean Λ࡞ͬͯ • ThreadPoolTaskScheduler Λͬͯఆظతʹ ApplicationRegistrator#register Λ࣮ ߦͯ͠ Server ͷ API Λୟ͍ͯɺΞϓϦέʔγϣϯొΛߦ͍ͬͯΔ
࣮ࡍʹ Reference Guide IDEA Λ͍ͳ͕Βઆ໌
ಋೖͯ͠ΈΔ::Tips
git properties ΜΓ pom.xml, build.gradle ʹઃఆՃ͓ͯ͘͠ͱ git.properties ϑΝΠϧΛੜ͠ ͯ͘ΕΔɻ management.info.git.mode
= full ͱ͔ઃఆʹॻ͍͓ͯ͘ͱ Insights ʹ commit ͷৄࡉใΛग़ͯ͘͠ΕΔɻ
git properties ΜΓ
• http trace session header ͳͲɺશ෦ OFF ʹ͢Δ
• ෆඞཁʹ Actuator ղ์͠ͳ͍ management ͷઃఆʹؾΛ͏
• ͦͷ··ͩͱ CSRF ੬ऑੑ͕͋ΔͷͰɺͪΌΜͱ SecurityConfig Λ࣮͢Δ • Ͳͷϗετ͔ΒͰΠϯελϯεͷొͰ͖ͨΓ Admin ͷ
Web Λར༻͢Δͷ ཧ͕Ͱ͖ͳ͘ͳΔͷͰ Spring Boot Security ͳͲͰ࠷ݶͷೝূ͔͚Δ • ͜ΕΒ Reference Guide Ͱઆ໌͞ΕͯΔ Security దʹ͢Δ
• ࣗͷ߹ɺؾܰʹ Web ͔Βઃఆม͑ͨΓͰ͖ͳ͍Α͏ʹ͢ΔͨΊ Actuator ͷ PATH ʹ͚ͩ GET ϝιουҎ֎ͷΞΫηεېࢭͷઃఆΛ͔͚ͯݟͨ
Security దʹ͢Δ
ಋೖͯ͠Θ͔ͬͨ͜ͱ
Client ͷύϑΥʔϚϯεѱ͘ͳ͍ ͱ͍͑ɺಋೖޙͷϝϞϦͷར༻͕มΘ͕ͬͨଟ Actuator ಉ࣌ʹ Enable ͍ͨͤͩ͠ͱߟ͑ΒΕΔ
Basic ೝূॲཧͷॏཱ͕ͬͨ͞ Client ͷσϑΥϧτͷ API Call ִ͕ؒ10ඵͳͷͰɺ50Λ͑ͨ͋ͨΓͰݦஶʹ CPU ෛՙཱ͕ͭΑ͏ʹͳ͖ͬͯͯ100͑ͨ͋ͨΓͰϩʔυΞϕϨʔδ͕ 200ۙ͘·ͰͶ্͕ΔΑ͏ʹͳͬͨ
Basic ೝূॲཧͷѱཱ͕ͬͨ͞ ઃఆϑΝΠϧʹॻ͍ͨ username/password ͳͷͰ BCrypt ͏͜ͱ߽͗ͨ͢ ͷͰɺγϯϓϧͳ NoOpPasswordEncoder ΛͬͨΒෛՙ͕ٸܹʹԼ͕ͬͨ
ࣗࣾͷೝূγεςϜʹΓସ͑Δ Actuator Ͱग़ͯ͠Δଞͷ߲ͳͲͷΞΫηεϑϧղ์͢Δʹ Basic ೝ ূΛͬͨ··Ͱݫ͍͠ͷͰɺࣗࣾͷ LDAP ͳͲͷೝূͱૢ࡞ϩάͷ ΈͳͲΛॆ࣮ͤ͞Δͱྑ͍ɻ ී௨ͷ
Spring Boot ΞϓϦέʔγϣϯͳͷͰɺͦΕͳΓʹΞΫηε੍ޚ࣮ Մೳɻ
Host List ݟਏ͍
• Client ͷ Server ొ༻ͷεϨου໊͕ registrationTask1 ͰΑ͘Θ͔ΒΜॴ • Http Traces
ɺͦͦ͜͜ͷτϥϑΟοΫ͕͋ΔͱϩʔυͪͰݻ·Δ • MBean ΛΧδϡΞϧʹ Web ͰฤूͰ͖Δ/ Log level ฤूͰ͖Δͷා͍ͷ Ͱɺ actuator ͷ PATH ʹରͯ͠ REMOTE ADDR ͰͷΞΫηε੍ޚ Spring Boot Admin ࣗମͷೝূ͔ͬ͠Γ࡞Γࠐ·ͳ͍ͱةݥ • Environment/Configuration Properties σϑΥϧτͰ password/token ͳͲϚε Ϋ͞ΕΔ͕ɺ͘ӡ༻͍ͯ͠Δͱઈର࿙Ε͕ൃੜͯ͠ϦεΫ্͕ΔͷͰɺ্هͱ ಉ͔ͬ͘͡͠ΓΞΫηε੍ޚ࣮͠ͳ͍ͱͩΊ • Http Traces default Ͱ request header ͳͲΛશ෦ग़ྗͪ͠Όͬͯةݥߴ͍ͷ Ͱલड़ͷΦεεϝઃఆ࠷ݶೖΕͱ͔ͳ͍ͱةͳ͍ ؾʹͳΔͱ͜Ζ
• Client ͷ Server ొ༻ͷεϨου໊͕ registrationTask1 ͰΑ͘Θ͔ΒΜॴ • Http Traces
ɺͦͦ͜͜ͷτϥϑΟοΫ͕͋ΔͱϩʔυͪͰݻ·Δ • MBean ΛΧδϡΞϧʹ Web ͰฤूͰ͖Δ/ Log level ฤूͰ͖Δͷා͍ͷ Ͱɺ actuator ͷ PATH ʹରͯ͠ REMOTE ADDR ͰͷΞΫηε੍ޚ Spring Boot Admin ࣗମͷೝূ͔ͬ͠Γ࡞Γࠐ·ͳ͍ͱةݥ • Environment/Configuration Properties σϑΥϧτͰ password/token ͳͲϚε Ϋ͞ΕΔ͕ɺ͘ӡ༻͍ͯ͠Δͱઈର࿙Ε͕ൃੜͯ͠ϦεΫ্͕ΔͷͰɺ্هͱ ಉ͔ͬ͘͡͠ΓΞΫηε੍ޚ࣮͠ͳ͍ͱͩΊ • Http Traces default Ͱ request header ͳͲΛશ෦ग़ྗͪ͠Όͬͯةݥߴ͍ͷ Ͱલड़ͷΦεεϝઃఆ࠷ݶೖΕͱ͔ͳ͍ͱةͳ͍ ؾʹͳΔͱ͜Ζ Spring Boot Admin ͳΒͰͷ෦͕গͳ͔ͬͨɻɻ
• ΞϓϦέʔγϣϯͷϏϧυόʔδϣϯΛ List View ͰݟΕΔΑ͏ʹ • Πϯελϯε ID ΛΘ͔Γ͍ͨ͘͢͠ •
ଟࣗલͰ InstanceIdGenerator Λ࣮ͨ͠ΒͰ͖ͦ͏? • ֤छϦετͰιʔτॱ͕Ṗ͍ͷͰࣗવʹ͍ͨ͠ • υΩϡϝϯτΛ͏গ͠Θ͔Γ͘͢ɻɻɻ • ΫϥελϦϯά௨ઃఆपΓ͕ͱ͖ͬͭʹ͔ͬͨ͘ ͜Εཉ͍͠
• Spring Boot Admin ͷಋೖํ๏ɺಋೖͯ͠ಘΒΕͨݟΛհ͠·ͨ͠ • ࢥͬͯҎ্ʹ؆୯ʹಋೖͰ͖ΔͷͰɺ͓ࢼ͍ͩ͘͠͞ ·ͱΊ