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
730
pt-osc的何かとマイグレーションのすりあわせについて
winebarrel
3
1.2k
Elixir Meetup #2 Plugのモジュールを一通り使ってみた
winebarrel
2
1k
Other Decks in Technology
See All in Technology
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
150
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
SSMRunbook作成の勘所_20241120
koichiotomo
2
130
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
280
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
170
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
590
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
Featured
See All Featured
Building an army of robots
kneath
302
43k
Code Reviewing Like a Champion
maltzj
520
39k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Making Projects Easy
brettharned
115
5.9k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Practical Orchestrator
shlominoach
186
10k
It's Worth the Effort
3n
183
27k
Writing Fast Ruby
sferik
627
61k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
The Invisible Side of Design
smashingmag
298
50k
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