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
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
180
複雑なState管理からの脱却
sansantech
PRO
1
150
心が動くエンジニアリング ── 私が夢中になる理由
16bitidol
0
100
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
AIチャットボット開発への生成AI活用
ryomrt
0
170
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
190
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.7k
FlutterアプリにおけるSLI/SLOを用いたユーザー体験の可視化と計測基盤構築
ostk0069
0
100
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
100
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
How GitHub (no longer) Works
holman
310
140k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Raft: Consensus for Rubyists
vanstee
136
6.6k
RailsConf 2023
tenderlove
29
900
Into the Great Unknown - MozCon
thekraken
32
1.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Git: the NoSQL Database
bkeepers
PRO
427
64k
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 ͷಋೖํ๏ɺಋೖͯ͠ಘΒΕͨݟΛհ͠·ͨ͠ • ࢥͬͯҎ্ʹ؆୯ʹಋೖͰ͖ΔͷͰɺ͓ࢼ͍ͩ͘͠͞ ·ͱΊ