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
Hashをめぐる冒険
Search
Genki Sugawara
December 08, 2016
Technology
0
3.8k
Hashをめぐる冒険
Codenize.toolsの今までとこれから、とか
Genki Sugawara
December 08, 2016
Tweet
Share
More Decks by Genki Sugawara
See All by Genki Sugawara
Poolにおける足を止めないシステム基盤構築
winebarrel
3
8.2k
Ruby for Iac
winebarrel
0
740
pt-osc的何かとマイグレーションのすりあわせについて
winebarrel
3
1.2k
Elixir Meetup #2 Plugのモジュールを一通り使ってみた
winebarrel
2
1k
Other Decks in Technology
See All in Technology
事業貢献を考えるための技術改善の目標設計と改善実績 / Targeted design of technical improvements to consider business contribution and improvement performance
oomatomo
0
100
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
210
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
390
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
270
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
270
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
460
podman_update_2024-12
orimanabu
1
280
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
37
14k
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
169
14k
Making the Leap to Tech Lead
cromwellryan
133
9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
A Philosophy of Restraint
colly
203
16k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Gamification - CAS2011
davidbonilla
80
5.1k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
450
Transcript
HashΛΊ͙Δݥ Codenize.toolsͷࠓ·Ͱͱ͜Ε͔Βɺͱ͔ Genki Sugawara
$ whoami Author of Codenize.tools github: winebarrel twitter: @sgwr_dts ܙൺणͷํͰಇ͍͍ͯ·͢
Codnize.toolsʹݶΒͣ RubyɾAWSؔ࿈πʔϧΛ࡞͍ͬͯ·͢
ΞδΣϯμ • Codenize.toolsʹ͍ͭͯ • ίʔυԽʹ͍ͭͯ • Codenize.toolsͷ͜Ε͔Β
Codenize.toolsʹ͍ͭͯ
Ξϯέʔτ!
Codenize.tools (ҰԠɺհ) • https://codenize.tools/ • AWSͳͲͷίʔυԽπʔϧू • DatadogMySQLͷπʔϧ͋Γ·͢ • ۀͰࠔͬͨλΠϛϯάͰదʹ࡞
Benefits • ঢ়ଶཧͷ؆қԽ • ΦϖϨʔγϣϯͷ؆қԽ • Gitͱͷ࿈ܞͱϫʔΫϑϩʔ
ྫ: Route53 RoadworkerʹΑΔίʔυԽ hosted_zone "example.com." do rrset "example.com.", "A" do
ttl 300 resource_records( "127.0.0.1" ) end end
Demo or Cut✂
࡞ͷܦҢ 2013/7 Roadworker first commit
࡞ͷܦҢ • ΦϖϛεͰMXϨίʔυ͕ਧͬඈͿ • ChefͬΆ͘DNSΛཧ͍ͨ͠ • Roadworker࡞ • ͍Ζ͍Ζ࡞
Roadworker - Route53 Piculet - Security Groups Kelbim - ELB
Miam - IAM Kumogata2 - CloudFormation Eipmap - Elastic IP Radiosonde - CloudWatch Alarm Meteorlog - CloudWatch Logs Mappru - VPC Route table Bukelatta - S3 Bucket Policy Repol - ECR Repository Policy Cfdef - CloudFront
πʔϧͷϙϦγʔ • εςʔτΛ࣋ͨͳ͍ • ΤΫεϙʔτͰ͖Δ
εςʔτΛ࣋ͨͳ͍ • ϫʔΫϑϩʔ͕γϯϓϧʹͳΔ • ͕͚ɾS3ɾJenkinsෆཁ • ͍ɾRate exceededʢWebαʔϏεʹ͍ͭͯʣ • ࠷ۙɺIAMͷAPIίʔϧ੍ݶ͕ݫͯͭ͘͠Β͍
ΤΫεϙʔτͰ͖Δ • GUIͰ͍͡Γ͍ͨ • AWSউखʹIAMɾSGΛՃ͢Δ
Ͱ͖Δ͚ͩγϯϓϧͳͷΛ ࢦ͍ͯ͠·͢
Roadmap • ALB༻πʔϧͷ࡞ • ࡶEMR༻πʔϧͷ࡞ • PiculetͷϦϑΝΫλϦϯά • CIͷվળʢ͍ɾ͚͜Δʣ
͍͖ͬͯ·͢!
ίʔυԽʹ͍ͭͯ
ίʔυԽʹ͍ͭͯ ͍͍ͩͨ̎छྨ͘Β͍ͷ ҙຯ͕͋Δͱࢥ͍·͢
ίʔυԽʹ͍ͭͯ • ςΩετͰঢ়ଶΛཧ • ႈੑ →ੈؒతʹΞάϦʔ
ίʔυԽʹ͍ͭͯ • ઃఆΛಈతʹ͢Δ →ࢍ൱྆
ίʔυԽʹ͍ͭͯ େ·͔ʹ͚Δͱ… • εΠεΞʔϛʔφΠϑࢮ͢͠ • σʔλهड़ݴޠDSL • ΘΒ͔ઃఆେ͖ • ൚༻ݴޠDSL
جຊతʹલऀ͕ϚδϣϦςΟͩͱࢥ͍·͢
σʔλهड़ݴޠDSL • yamlɾjsonɾhcl • ࠷ۙͩͱtomlʁ
σʔλهड़ݴޠDSL Pros • Մಡੑ͕ߴ͘ͳΔ • ϓϩάϥϚҎ֎ʹॻ͚Δ • ΤϥʔՕॴ͕Θ͔Γ͘͢ͳΔʢͱࢥ͏ʣ
σʔλهड़ݴޠDSL Cons • ϑϩʔ੍ޚͳͲ͕hackyʹͳΔ • yaml++͕Ͱ͖Δ • ςϯϓϨʔτΛ͏ͱຒΊࠐΈεΫϦϓτʹΩϝϥײ
൚༻ݴޠDSL • Ruby…Ҏ֎Կ͔͋Γ·͔͢Ͷ…ʁ • chefɾitamae
൚༻ݴޠDSL Pros • ԿͰͰ͖Δ • γʔϜϨεͳϑϩʔ੍ޚ
൚༻ݴޠDSL Cons • ཚ༻͍͢͠ • Γա͗ΔͱʰઃఆϑΝΠϧʱ͔Βҳ • ϓϩάϥϚҎ֎ʹॻ͖ʹ͍͘ʁ • Θ͔Γʹ͍͘Τϥʔ
• method_missing': undefined local variable or method 'foo'
ίʔυԽʹ͍ͭͯ εΠεΞʔϛʔφΠϑࢮ͢͠ͷ࠷ӈཌྷͰ͋ΔCFn͕ Fn::JoinΛ༻ҙ͍ͯ͠Δͱ͜ΖΛݟΔͱɺ͋Δఔͷಈత͞ʹ ͍ͭͯੈؒతʹΞάϦʔʁ
ίʔυԽʹ͍ͭͯ ͨͿΜΈΜͳΓ͍ͨͷ • ܁Γฦ͠ • ݅ذ • ม • ͪΐͬͱͨؔ͠
• ڥมऔಘͳͲ
ίʔυԽʹ͍ͭͯ ͦͷҰઢΛӽ͑Δͱɺࢍ൱྆ • EC2ΠϯελϯεҰཡ͔ΒDNS࡞ • IPϦετΛμϯϩʔυͯ͠SGઃఆ ͳͲͳͲ
ίʔυԽʹ͍ͭͯ • Codenize.toolsΘΒ͔Ͱ͢ʂ • ͩͬͯˣͷΑ͏ʹॻ͖͍ͨ͠… instances.each do |i| resource_records i.name
+ ".example.com" do • ͱ͍͑Τϥʔʹ͍ͭͯԿͱ͔͍ͨ͠…
গ͕ͦ͠Ε·͢
ؓ ઃఆϑΝΠϧͰಈతͳॲཧΛߦ͏߹ ੩తܕ͖ݴޠ͕͍͍ͯΔؾ͕͠·͢ ઃఆͷద༻ʢධՁʣલʹΤϥʔνΣοΫ͕Ͱ͖ͯ ৺ͷฏԺ͕ΑΓಘΒΕͦ͏ ઃఆͷద༻్தʹϥϯλΠϜΤϥʔ͕ग़ΔͱͭΒ͍
ؓ ͔͠͠ͳ͕Β੩తܕ͖ͷΈࠐΈݴޠ ༨Γݟ͔͚ͳ͍ Golangͷtemplateͱ͔Ͱ {{}} ͷจ๏νΣοΫͯ͘͠Εͯ ؔʹ͢ͷܕ࣮ߦ࣌ͷνΣοΫ…
ؓ AngleScriptͱ͍͏੩తܕ͖ΈࠐΈݴޠ͕͋ͬͨΜͰ͕͢ CScriptBuilder builder; int r = builder.StartNewModule(engine, "MyModule"); if(
r < 0 ) { printf("...\n"); return; }
ؓ ͦΕͳΜͯC++ʢry
ؓ ઃఆϑΝΠϧͰ੩తܕ͖ݴޠΛ͓͏ͱ͓ͬͨΒ Ұ෦ͷؔܕݴޠͷΑ͏ʹ؆ܿͰܕνΣοΫͯ͠Δ͘ΕΔ ΈࠐΈݴޠ͕ඞཁͳΑ͏Ͱ͢ ݚڀʹ͠·͕͢ ͬ͘͞ͱ࣮༻ஈ֊ʹͰ͖ͳͦ͏…
ؓٳ
Codenize.toolsͷ͜Ε͔Β
Codenize.toolsͷ͜Ε͔Β ϩʔυϚοϓઌ΄Ͳ্͛ͨͱ͓Γɻ ͔͕͠͠Ұͭ
ർΕͨ!
ർΕͨ! • CIͭΒ͍ • ٕज़తͳֶͼ͕গͳ͍
CIͭΒ͍ • ओʹAWSͷͰ͢ • CI࣮ࡍͷAWSͰςετ • ͍ • πʔϧಉ࢜ͷڝ߹ •
CIڥ࡞ΓͮΒ͍
͍ ͋Δఔํͳ͍ΜͰ͕͢ • ૣ͘͢ΔˠRate exceededʹҾ͔͔ͬΔ • ࠷ۙɺͳΜ͔ݫ͘͠ͳͬͨΑ͏ͳ… • ฒྻԽ͢Δˠςετ͕ڝ߹͢ΔͷͰΞΧϯτ͍ͬͺ͍ඞཁ •
ݱࡏɺॴ༗ΞΧϯτ̎ݸ • ͜ΕҎ্૿͢ͷͭΒ͍!
πʔϧಉ࢜ͷڝ߹ • roadworker CI • ελϒͱͯ͠ELBͳͲඞཁ • kelbim CI •
ELBશ෦ফ͢ • miam CI • IAM શ෦ফ͢ ಉ͡ΞΧϯτͰฒྻͰςετΔͱഁ໓
CIڥ࡞ΓͭΒ͍ • TravisCIͬͯ·͢ɻମྗඞཁ • σόοά • Rete exceededରࡦ • ԼखʹΫϨσϯγϟϧΛ͓͚ͳ͍
• encrypt key͑Δ͚ͲPRͰಈ͔ͳ͍ • ಛʹmiam͕͍
CIڥ࡞ΓͭΒ͍ APIݺͼ͗͢ഁ࢈ରࡦ์غͯ͠·͢…
CIͭΒ͍ ࠓޙʹ͍ͭͯϞοΫͷςετΛ૿ͦ͏ͱࢥͬͯ·͕͢ ͬͱ͍͍ιϦϡʔγϣϯ͋Δͱ͍͍ͳ͊ |ωɾ`ʣνϥ
ٕज़తͳֶͼ͕গͳ͍ Codenize.toolsͷΈ
Codenize.toolsͷΈ Apply • API→Hash • DSL→Hash • Hashಉ࢜Λൺֱ • ࠩΛຒΊΔAPIΛͨͨ͘
Codenize.toolsͷΈ Export • API→Hash • Hash→DSL
ͪΐ͏͔ΜͨΜΜ ʢ಄ΛΘͳ͍ʣ
ͩΔ͍ • ຖಉ͡Α͏ͳΫϥεΛॻ͘ͷ͕ͩΔ͍ • DSLΫϥεॻ͘ͷ͕ͩΔ͍ • όϦσʔγϣϯ͕ͩΔ͍
ରͩΔ͍ • DSLʹ͍ͭͯઐ༻ͷϥΠϒϥϦΛॻ͍ͨ • https://github.com/winebarrel/dslh • DSL→HashɾHadh→DSLͷ૬ޓޓ͕Մೳ • ͔͠͠όϦσʔγϣϯ͕Ͱ͖ͳ͍…
ରͩΔ͍ • yamlͷόϦσʔλʔ͋ͬͨ • Kwalify type: map mapping: "name": type:
str required: yes "age": type: int
ରͩΔ͍ • Dslh͕ੜͨ͠Hashʹରͯ͠όϦσʔγϣϯ • όϦσʔγϣϯ࣮Ͱ͖ͨ • ͋Εɺ͜ΕΖΖࣗಈԽͰ͖ΔΜ͡ΌͶʁ
https://github.com/ winebarrel/codenize
codenize • Codenize.toolsͷܗΛੜ • API→Hashͷ࣮Λ͢Ε͍͍ͩͨͰ͖Δ • Ruby DSLͷ࣮ෆཁ • όϦσʔγϣϯͰ͖Δ
Demo
࣮ྫ ecman - EasyCronͷίʔυԽπʔϧ - https://github.com/winebarrel/ecman/commit/ 941555eee0ca59894efc9b3b3b52e8e66b5a63fa
Έͳ͞ΜͲΜͲΜ Codenize͢ΔͱΑ͍ͱ ͓͍·͢
࠷ޙʹ PRɾIssue͓ͪͯ͠·͢! • ຊޠͰେৎͰ͢ • όάͷ߹ɺΤϥʔڥͱ࠶ݱίʔυ͕͋Δͱॿ͔Γ·͢
͓ΘΓ https://suzuri.jp/winebarrel/591154/t-shirt/s/white