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
1.9k
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
430
著作権とは何か?〜初歩的概念から権利利用法、侵害要件まで
line_developers
PRO
5
2k
生成AIと著作権 〜生成AIによって生じる著作権関連の課題と対処
line_developers
PRO
3
1.9k
マイクロサービスにおけるBFFアーキテクチャでのモジュラモノリスの導入
line_developers
PRO
9
3k
A/B Testing at LINE NEWS
line_developers
PRO
3
820
LINEのサポートバージョンの考え方
line_developers
PRO
2
1k
Other Decks in Technology
See All in Technology
CyberAgent 生成AI Deep Dive with Amazon Web Services / genai-aws
cyberagentdevelopers
PRO
1
480
サイバーエージェントにおける生成AIのリスキリング施策の取り組み / cyber-ai-reskilling
cyberagentdevelopers
PRO
2
200
生成AIとAWS CDKで実現! 自社ブログレビューの効率化
ymae
2
330
一休.comレストランにおけるRustの活用
kymmt90
3
580
「最高のチューニング」をしないために / hack@delta 24.10
fujiwara3
21
3.4k
とあるユーザー企業におけるリスクベースで考えるセキュリティ業務のお話し
4su_para
3
320
最速最小からはじめるデータプロダクト / Data Product MVP
amaotone
5
730
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
27
12k
Fargateを使った研修の話
takesection
0
110
Amazon_CloudWatch_ログ異常検出_導入ガイド
tsujiba
4
1.5k
【若手エンジニア応援LT会】AWS Security Hubの活用に苦労した話
kazushi_ohata
0
160
AWS CDKでデータリストアの運用、どのように設計する?~Aurora・EFSの実践事例を紹介~/aws-cdk-data-restore-aurora-efs
mhrtech
4
640
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
88
5.7k
How to Think Like a Performance Engineer
csswizardry
19
1.1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
For a Future-Friendly Web
brad_frost
175
9.4k
Unsuck your backbone
ammeep
668
57k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
A Modern Web Designer's Workflow
chriscoyier
692
190k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Writing Fast Ruby
sferik
626
61k
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 ͷಋೖํ๏ɺಋೖͯ͠ಘΒΕͨݟΛհ͠·ͨ͠ • ࢥͬͯҎ্ʹ؆୯ʹಋೖͰ͖ΔͷͰɺ͓ࢼ͍ͩ͘͠͞ ·ͱΊ