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
Consulはなめらかか?
Search
KONDO Uchio
May 18, 2016
Technology
6
2.5k
Consulはなめらかか?
https://ezukatechnight.doorkeeper.jp/events/44585
E-zuka tehc night #ezuka_tech_night
KONDO Uchio
May 18, 2016
Tweet
Share
More Decks by KONDO Uchio
See All by KONDO Uchio
大規模レガシーテストを 倒すための CI基盤の作り方 / #CICD2023
udzura
5
2.3k
Ruby x BPF in Action / RubyKaigi 2022
udzura
0
210
Narrative of Ruby & Rust
udzura
0
180
開発者生産性指標の可視化 / pepabo-four-keys
udzura
3
1.6k
Talk of RBS
udzura
0
400
Re: みなさん最近どうですか? / FGN tech meetup in 2021
udzura
0
730
Dockerとやわらかい仮想化 - ProSec-IT/SECKUN 2021 edition -
udzura
2
690
Device access filtering in cgroup v2
udzura
1
800
"Story of Rucy" on RubyKaigi takeout 2021
udzura
0
750
Other Decks in Technology
See All in Technology
「人物ごとのアルバム」の精度改善の軌跡/Improving accuracy of albums by person
mixi_engineers
PRO
1
120
AWSサービスアップデート 2024/12 Part3
nrinetcom
PRO
0
150
AWS re:Invent 2024 re:Cap Taipei (for Developer): New Launches that facilitate Developer Workflow and Continuous Innovation
dwchiang
0
170
なぜfreeeはハブ・アンド・スポーク型の データメッシュアーキテクチャにチャレンジするのか?
shinichiro_joya
2
510
re:Invent2024 KeynoteのAmazon Q Developer考察
yusukeshimizu
1
150
Kotlin Multiplatformのポテンシャル
recruitengineers
PRO
2
150
【JAWS-UG大阪 reInvent reCap LT大会 サンバが始まったら強制終了】“1分”で初めてのソロ参戦reInventを数字で振り返りながら反省する
ttelltte
0
140
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
1
16k
Amazon Q Developerで.NET Frameworkプロジェクトをモダナイズしてみた
kenichirokimura
1
200
デザインシステムを始めるために取り組んだこと - TechTrain x ゆめみ ここを意識してほしい!リファクタリング勉強会
kajitack
1
110
AWSマルチアカウント統制環境のすゝめ / 20250115 Mitsutoshi Matsuo
shift_evolve
0
120
コロプラのオンボーディングを採用から語りたい
colopl
5
1.3k
Featured
See All Featured
Become a Pro
speakerdeck
PRO
26
5.1k
Fireside Chat
paigeccino
34
3.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
Speed Design
sergeychernyshev
25
740
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
How to Ace a Technical Interview
jacobian
276
23k
Side Projects
sachag
452
42k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
500
Transcript
$POTVMͷ׆༻ํ๏࠶ߟ GMO Pepabo, Inc. Uchio Kondo E-Zuka Tech Night @
2016-05-18 $POTVM ͳΊΒ͔͔ʁ
None
ເͷ͖ͭͮ
NF
None
ۙ౻͏͓ͪ (.0ϖύϘॴଐ ٕज़ج൫νʔϜ Ԭࢧࣾۈ 'VLVPLBSC
3BJMT(JSMT'VLVPLB૯߹ࡶ༻ίʔν·ͱΊ
None
ࣗಈԽ
ӡ༻ͷࣗಈԽ
ൿͷλϨ
खॱॻ
खॱʹखଓ͖ ʹϓϩάϥϛϯάͰ͖Δ
ࣗಈԽ
खॱॻˠ ࣗಈԽ
ͬͱࠜຊతͳϧʔϧ ʢʴࣗੑʣˠ ͳΊΒ͔ͳγεςϜ
͔ͳ❓
$POTVM
ΦʔέετϨʔγϣϯ
ΦʔέετϨʔγϣϯ ❓
*OGSBTUSVDUVSFBT$PEF Πϯϑϥͷ͓ࣄΛɺίʔυͰ 0SDIFTUSBUJPO $POpHVSBUJPO #PPUTUSBQQJOH
*OGSBTUSVDUVSF0SDIFTUSBUJPO5PPMT 5FSSBGPSN$MPVE'PSNBUJPOͷΑ͏ͳɺ *BB4্ͰαʔόωοτϫʔΫετϨʔδͱ ͍ͬͨϦιʔεΛ੍ޚ͢ΔͨΊͷπʔϧαʔ Ϗε $POTVM FUDE ;PP,FFQFSͷΑ͏ͳ
$POpHVSBUJPO3FHJTUSZ
SFGT *OGSBTUSVDUVSFBT$PEF࠶ߟ IUUQNJ[[ZPSHCMPH
$POpHVSBUJPO 3FHJTUSZ
ઃఆ߲Λ ෳͷαʔόͰڞ༗͢Δ
3BGU$POTFOTVT "MHPSJUIN
None
ࢄ߹ҙΞϧΰϦζϜ
4FFQBQFST IUUQTXXXVTFOJYPSHTZTUFNpMFT DPOGFSFODFBUDBUDQBQFS POHBSPQEG ຊޠͰͷղઆ IUUQTHJTUHJUIVCDPNTJMF BEDFCGE
DGϒϩοΫνΣʔϯ ͯ͞ɺϒϩοΫνΣʔϯ৫తࢄܕͷܥΛલఏͱͨ͠ ͷͰ͢ɻͦͯ͠ɺෳͷࢀՃऀ͕ಉ͡ϒϩοΫ͔Βಉ ͡ϒϩοΫνΣʔϯΛܾఆ͢Δͱ͍͏ͷ͕ਖ਼ʹ߹ҙܗͰ ͢ SFGTIUUQOFYUCMPDLDIBJOOFU CMPDLDIBJOBCJMJUZ
ࢄγεςϜʹ͓͚Δ߹ҙ ͱ
ެࣜͷઆ໌ )PMEPOXIBUJTDPOTFOTVT $POTFOTVTJOWPMWFTNVMUJQMFTFSWFSTBHSFFJOHPO WBMVFT IUUQTSBGUHJUIVCJP
ෳͷαʔό͕ ಉ͡ʹ͍ͭͯ߹ҙ͢Δ
ز͔ͭͷαʔό͕ յΕ͍ͯͯɺ ͪΌΜͱ߹ҙͰ͖Δ DG2VPSVN IUUQTXXXDPOTVMJPEPDTJOUFSOBMTDPOTFOTVTIUNM
εςʔτϚγϯͷෳ
IUUQTDPNNPOTXJLJNFEJBPSHXJLJ'JMF$15'4..FBMZTWH
DG,74
DG3BGUͷ3VCZ࣮ IUUQTHJUIVCDPNDFMMVMPJEqPTT '4.ͱͯ͠ϋογϡΛͬͨྫ
$POTVMͱ ߹ҙΞϧΰϦζϜΛ༻͍ͯෳͷαʔόؒͰ εςʔτΛڞ༗͠ɺ ͦΕΛ༻͍ͯαʔόӡ༻ͷࣗಈԽΛߦ͏͜ͱ Ͱ͖Δπʔϧ
FHDPOTVMFYFDͷத ίϚϯυͷதΛ,74Ͱڞ༗͢Δ ड͚औͬͨϊʔυͦΕΛ࣮ߦ͢Δ ऴΘͬͨΒফ͢
Πϕϯτ
Ϋϥελͷ ঢ়ଶͷมԽΛࢹ
XBUDIͰ͖Δͷ ͬ͘͟Γͭ OPEFTϊʔυͷՃআ TFSWJDFTϊʔυͰಈ͘αʔϏεͷঢ়ଶ DIFDLTϊʔυ্ͷαʔϏεͷϔϧενΣοΫࢹͷঢ় ଶ
LFZLFZQSFpYϊʔυؒͰڞ༗͍ͯ͠Δ,74ͷத FWFOUҙͷΠϕϯτ
ྫͰ͢
ϩʔυόϥϯαʔͷ ಈతϝϯόʔՃ
͓खॱ ϝϯόʔҰཡΛࢹ͢Δ Ұཡͷσʔλ+40/ͰಘΒΕΔ ͦΕΛ3VCZͳͲͰ৯ͯઃఆϑΝΠϧΛࣗಈ Ͱ࡞Ε0,
ϝϯόʔҰཡΛࢹ > consul watch -type checks -service nginx
Ұཡͷσʔλ+40/ͰಘΒΕΔ Πϕϯτʹ ϊʔυͷՃআɺ ϔϧενΣοΫͷঢ়ଶมߋ Πϕϯτ͕ى͜Δͱ ࣗಈͰ+40/͕ҙͷ ίϚϯυʹ͍ͬͯ͘
ͦΕΛ3VCZͳͲͰ৯ͯ ઃఆϑΝΠϧΛࣗಈͰ࡞Ε0, ʢੜʹޭͨ͠ΒϦϩʔυʣ
#!/usr/bin/env ruby require 'json' data = STDIN.read @nodes = []
JSON.parse(data).each do |node| if node["Checks"].find {|c| c["CheckID"] == "service:nginx" && c["Status"] == "passing" } @nodes << "#{c["Node"]["Address"]}:#{c["Service"]["Port"]}" end end template = <<ERB upstream backend_apps { <% for node in @nodes %> server <%= node %>; <% end %> } server { listen 80; # .... location / { proxy_pass http://backend_apps; } } ERB require 'erb' open("/etc/nginx/dynamic.conf", "w") do |f| f.write ERB.new(template).run(binding) end
ࢀߟ DPOTVMUFNQMBUFͱ͍͏͕ͭதͰେମಉ͡ ͜ͱΛ͍ͯ͠·͢ IUUQTHJUIVCDPNIBTIJDPSQDPOTVM UFNQMBUF
ͬͱ۩ମྫ
ྫTUSFUDIFS
TUSFUDIFS QVMMܕσϓϩΠϛυϧΣΞͷύΠΦχΞ IUUQTHJUIVCDPNGVKJXBSBTUSFUDIFS !GVKJXBSB͞Μ࡞ɺ(P
͓खॱ σϓϩΠΠϕϯτΛൃՐ͢Δ ˠT͔ΒϚχϑΣετΛऔΔ ˠUBSCBMMΛऔΔ ˠల։ɺޙॲཧ
σϓϩΠΠϕϯτͷൃՐ > consul event -name deploy_production ˞Ұճ͚ͩൃߦ͢Ε0,
֤αʔόʔ ͦΕͧΕͷαʔόͰconsul watchͷίϚϯ υΛɺσʔϞϯͱ্ཱ͓ͯͪ͛ͯ͘͠ ൃՐͨ͠ΠϕϯτΛड͚औͬͯιʔεΛQVMM ͦͯ͠ల։ɺඞཁʹԠ͡ΞϓϦͷϦϩʔυ
αʔόʔ͕ʹͳͬͯඇৗʹ͍࣌ؒͰ ө͞ΕΔΑ͏ʹͰ͖Δ
ྫ5-4TFTTJPO UJDLFUͷڞ༗
5-4TFTTJPOUJDLFUͱ 5-4ͷηογϣϯ伴Λอଘ͠ɺ࠶ར༻͢Δ Έ͕͋Δɻ ͦͷࡍɺෳͷαʔόͷ߹ɺ҉߸ԽͷͨΊͷ Ϛελ伴Λڞ༗͢Δඞཁ͕͋Δ ˠલํൿಗੑͷ؍͔Βɺఆظߋ৽͕ඞཁ
ˠ͔͠શಉ࣌ʹʂ ࢀߟCMPHLB[VIPPLVDPNGPSXBSETFDSFDZIUNM
ΠϕϯτΛλΠϚʔʹֻ͚Δ FHTZTUFNEͷλΠϚʔϢχοτ
ൃՐˠߋ৽ˠϦϩʔυ গ͚ͩ͠λΠϜϥά͕͋Δͱͳ͓Α͠ #!/bin/bash set -x ( sleep $(($RANDOM %
30)) && \ cat | jq -r .[-1].Payload | base64 -d > /var/lib/nginx_tls_session_ticket.key && \ systemctl reload nginx && echo reload OK ) || curl -d 'channel=#XXXX' -d "message=Failed reload: $(hostname)" notifier.local/notice
ࢀߟ $POTVMΛར༻ͨ͠5-4ηογϣϯνέοτͷ ࣗಈߋ৽ IUUQUFDINFSDBSJDPNFOUSZ
ྫDPMMFDUPS
DG7*1ʹΑΔՄ༻ੑͷ֬อ ͷαʔόͷલʹ7*1ΛׂΓৼΔྫ GPPVE[VSBKQ"
7*1ͷσϝϦοτ /த.ͷ*1Λάϩʔόϧ*1ͱ͚ͯͭ͠Δɺ ͱ͍͏͜ͱ͕͍͠ɻ %/4ϥϯυϩϏϯͱͷ૬ੑ͕ѱ͍ ͋ΔυϝΠϯ͕/ݸͷ*1Λ͍࣋ͬͯΔͱ͖ɺ ࣮αʔό/ݸҎ্ඞཁʹͳͬͯ͠·͏
͡Ό͋ಈతʹ %/4Λߋ৽ͯ͠Έͯʁ
None
DPMMFDUPSͷத ΫϥΠΞϯτ DPOTVMͷϔϧενΣοΫͰ͏ ίϯγϡʔϚʔ DPOTVMXBUDIͰ্ཱ͓ͪ͛ͯ͘
ϔϧενΣοΫʹߋ৽ͷͨΊͷ*1ΛؚΊΔ
DIFDLΛࢹͯ͠มߋΛऔಘ͢Δ check watch
ͦͷ༰͔Β%/4 3PVUF Λୟ͘ watch GPPVE[VSBKQ" GPPVE[VSBKQ" GPPVE[VSBKQ"
௨ػೳೖΕͯ·͢
ઃܭࢥ %/4ΩϟογϡͳͲʹΑΔҰ࣌తͳෆ௨ڐ༰ ར༻ͷ্Ͱɺ55-Λ͘͢Δ͖ සൟͳߋ৽ʹ͔ͳ͍
ৄࡉ ͬͯΈͯͶ IUUQTHJUIVCDPNVE[VSBDPMMFDUPS
·ͱΊ
$POTVM࣮γϯϓϧʂ
"*ͱ͕ؔͳ͍ ʜ
"*Λۦಈ͢ΔԿ͔͠Βͷج൫ʹ ͑Δ͔͠Εͳ͍͕ɺΞΠσΞ࣍ୈ
͝੩ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ
օ༷ͷΑ͏ͳ ༏लͳएऀΛͭ
ը૾ʹ͍ͭͯ ϑϦʔΞΠίϯ IUUQTDPNNPOTXJLJNFEJBPSHXJLJ'JMF4FSWFS NVMUJQMFTWH IUUQTDPNNPOTXJLJNFEJBPSHXJLJ 'JMF$PNQVUFSCMVFTWH
ͦͷଞɺϩΰɺΞΠίϯ֤ࣾɾஂମʹݖར͕͋Γ·͢ɻ Ҿ༻ͷൣғͰར༻͍ͯ͠·͢ɻ