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
フルカイテン株式会社 採用資料
fullkaiten
0
36k
生成AIとAWS CDKで実現! 自社ブログレビューの効率化
ymae
2
330
pandasはPolarsに性能面で追いつき追い越せるのか
vaaaaanquish
4
4.4k
Aurora_BlueGreenDeploymentsやってみた
tsukasa_ishimaru
1
120
MAMを軸とした動画ハンドリングにおけるAI活用前提の整備と次世代ビジョン / abema-ai-mam
cyberagentdevelopers
PRO
1
110
「視座」の上げ方が成人発達理論にわかりやすくまとまってた / think_ perspective_hidden_dimensions
shuzon
2
130
Apple/Google/Amazonの決済システムの違いを踏まえた定期購読課金システムの構築 / abema-billing-system
cyberagentdevelopers
PRO
1
210
顧客が本当に必要だったもの - パフォーマンス改善編 / Make what is needed
soudai
24
6.7k
30万人が利用するチャットをFirebase Realtime DatabaseからActionCableへ移行する方法
ryosk7
5
330
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
220
[JAWS-UG金沢支部×コンテナ支部合同企画]コンテナとは何か
furuton
3
240
WINTICKETアプリで実現した高可用性と高速リリースを支えるエコシステム / winticket-eco-system
cyberagentdevelopers
PRO
1
190
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
What's new in Ruby 2.0
geeforr
342
31k
Building Adaptive Systems
keathley
38
2.2k
BBQ
matthewcrist
85
9.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
The Invisible Side of Design
smashingmag
297
50k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
Being A Developer After 40
akosma
86
590k
Writing Fast Ruby
sferik
626
61k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
32
1.8k
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 ͷಋೖํ๏ɺಋೖͯ͠ಘΒΕͨݟΛհ͠·ͨ͠ • ࢥͬͯҎ্ʹ؆୯ʹಋೖͰ͖ΔͷͰɺ͓ࢼ͍ͩ͘͠͞ ·ͱΊ