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
AWSを使っているならOpsWorksでDevOpsしよう!
Search
Daiki Hirakata
August 29, 2016
Technology
1
1.6k
AWSを使っているならOpsWorksでDevOpsしよう!
2016/8/24に行った以下のイベントで使ったスライドです。
http://isao.connpass.com/event/37731/
Daiki Hirakata
August 29, 2016
Tweet
Share
More Decks by Daiki Hirakata
See All by Daiki Hirakata
Firestoreコスト圧縮の旅
bigplants
0
29
Rails on Docker
bigplants
2
530
Road to k8s
bigplants
0
240
Next Level Git
bigplants
0
600
Other Decks in Technology
See All in Technology
隣接領域をBeyondするFinatextのエンジニア組織設計 / beyond-engineering-areas
stajima
1
270
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
【若手エンジニア応援LT会】ソフトウェアを学んできた私がインフラエンジニアを目指した理由
kazushi_ohata
0
150
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
720
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
3
200
Evangelismo técnico: ¿qué, cómo y por qué?
trishagee
0
360
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
130
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
510
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
BBQ
matthewcrist
85
9.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
How to Ace a Technical Interview
jacobian
276
23k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
The Language of Interfaces
destraynor
154
24k
A Philosophy of Restraint
colly
203
16k
Being A Developer After 40
akosma
86
590k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Designing the Hi-DPI Web
ddemaree
280
34k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Transcript
Twitter: #ISAOcorp AWSΛͬͯΔͳΒOPSWORKSͰ DEVOPS͠Α͏ʂ @BIGPLANTS
Twitter: #ISAOcorp ࣗݾհ ฏܗ େथ @BIGPLANTS ▸ ࢁܗݝग़ 34ࡀ ABܕ
▸ גࣜձࣾISAOྺ 4 ▸ ιϑτΣΞΤϯδχΞྺ 6 ▸ OpsWorksྺ 3 ▸ ಘҙݴޠPHP, Rubyগʑ ▸ ؔ৺ࣄΞδϟΠϧɺϦʔϯελʔτΞο ϓɺDevOpsɺTDDɺDDD ▸ ࠓ5݄ʹୈҰࢠ͕ੜ͠ΠΫϝϯΤϯδ χΞͱͯ͠ҭࣇฃಆதɻ
Twitter: #ISAOcorp ࣗݾհ OpsWorksͱԶ ▸ AWSͷOpsWorks։ൃνʔϜ͔ΒҙݟΛٻΊΒΕͨ࣌ɺૉ ʹʮOpsWorksؒҧ͍ͳ͘কདྷͷAWSͷओྗαʔϏε ʹͳΔͱ֬৴͍ͯ͠ΔͷͰվળΨϯΨϯ͓ئ͍͠·͢ʯͱ ͑ͨ͘Β͍OpsWorksΛѪ͍ͯ͠·͢w ▸
৭ʑؾ͍ͭ͠Ͱ͕͢ɻɻw
Twitter: #ISAOcorp ࣗݾհ ԶͷϓϩδΣΫτ “Goalous” Goalous: www.goalous.com
Twitter: #ISAOcorp GOALOUSͷ։ൃʹ͍ͭͯ GoalousͷAWSڥ
Twitter: #ISAOcorp GOALOUSͷ։ൃʹ͍ͭͯ Goalousͷٕज़ελοΫ
Twitter: #ISAOcorp GOALOUSͷ։ൃʹ͍ͭͯ GoalousͷDeploy Routine ཁ݅Λ(JU)VCJTTVFʹॻ͘ ͔ΜΜϘʔυͰશମͷਐḿΛཧ (JU)VCJTTVFʹਐḿΛ͢ σΟεΧογϣϯ (JU)VCͰίʔυϨϏϡʔ
Ϛʔδ͓Αͼ σϓϩΠ
Twitter: #ISAOcorp ΞδΣϯμ ࠓճ͢͜ͱ ▸ ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DevOpsͷ৺ಘ ʹ͍ͭͯ ▸ DevOpsΛࢧ͑Δपลπʔϧʹ͍ͭͯ ▸
OpsWorksͷ֓ཁʹ͍ͭͯ ▸ OpsWorksΛ࣮ۀʹ׆༻͢ΔͨΊͷTips ▸ ࠓ·Ͱىͬͨ͜ͱղܾํ๏ ▸ ·ͱΊ
Twitter: #ISAOcorp ΞδΣϯμ ࠓճ͞ͳ͍ࣄ ▸ Chefͷৄࡉʹ͍ͭͯ ▸ OpsWorksͷৄࡉͳ༷ʹ͍ͭͯ ▸ पลπʔϧͷৄࡉʹ͍ͭͯ
Twitter: #ISAOcorp ΞδΣϯμ ▸ ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DevOpsͷ৺ಘ ʹ͍ͭͯ ▸ DevOpsΛࢧ͑Δपลπʔϧʹ͍ͭͯ ▸ OpsWorksͷ֓ཁʹ͍ͭͯ
▸ OpsWorksΛ࣮ۀʹ׆༻͢ΔͨΊͷTips ▸ ࠓ·Ͱىͬͨ͜ͱղܾํ๏ ▸ ·ͱΊ
Twitter: #ISAOcorp ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DEVOPSͷ৺ಘʹ͍ͭͯ What’s DevOps? ▸ ։ൃ୲ऀ(Dev)ͱӡ༻୲ऀ(Ops)͕࿈ܞͯ͠ڠྗ͢Δ։ൃ ख๏Λ͢͞ɻ ▸ DevOpsͷ࣮ݱʹߏཧπʔϧͰ͋ΔChefPuppet͕
༻͍ΒΕΔ͜ͱ͋ΓɺDevOpsͱ͍͏ޠ͔۟Β͜͏ͨ͠ πʔϧ͕Πϝʔδ͞ΕΔ͜ͱ͋Δɻ
Twitter: #ISAOcorp ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DEVOPSͷ৺ಘʹ͍ͭͯ What’s DevOps?
Twitter: #ISAOcorp ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DEVOPSͷ৺ಘʹ͍ͭͯ ߟ͑Δ͖ࣄ(1) ▸ ։ൃνʔϜͱӡ༻νʔϜͷίϛϡχέʔγϣϯʹ͍ͭͯ ▸ ίʔυϕʔεͷίϛϡέʔγϣϯΛࢦ͢͠ɻto be programable.
▸ ৽͍͠։ൃऀ͕νʔϜʹࢀՃͨ͠ΒͲΜͳΦϖϨʔγϣϯ͕ඞཁ͔ʁ ▸ ༷ʑͳΦϖϨʔγϣϯͷίετΛࢼࢉ͠Α͏ɻ ▸ ͳΔ͘γϯϓϧͰগͳ͍खॱΛ৺ֻ͚Δ͠ɻ ▸ ࢀՃোนͳΔ͘ഉআ͢ΔɻίϯτϦϏϡʔτ͍͢͠ڥΛ৺ֻ͚Δɻ ▸ OSSͷΞϓϩʔνΛࢀߟʹ͢ΔɻΨΠυΛॆ࣮ͤ͞Δɻ ▸ ςελϒϧɻ
Twitter: #ISAOcorp ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DEVOPSͷ৺ಘʹ͍ͭͯ ߟ͑Δ͖ࣄ(2) ▸ deployखॱ ▸ ԿεςοϓͷΦϖϨʔγϣϯ͔ʁͳΔ͘গͳ͍εςοϓΛ৺ֻ͚Δɻ ▸ ϩʔϧόοΫՄೳ͔ʁ
▸ ϩʔΧϧڥɺεςʔδϯάڥɺຊ൪ڥͷࠩҟΛѲ͍ͯ͠Δ͔ʁ ▸ ۃྗࠩҟগͳ͘͠Α͏ɻ ▸ εέʔϥϏϦςΟ ▸ αʔόͷ૿ݮ؆୯ʹͰ͖Δ͔ʁ to be immutable.
Twitter: #ISAOcorp ΞδΣϯμ ▸ ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DevOpsͷ৺ಘ ʹ͍ͭͯ ▸ DevOpsΛࢧ͑Δपลπʔϧʹ͍ͭͯ ▸ OpsWorksͷ֓ཁʹ͍ͭͯ
▸ OpsWorksΛ࣮ۀʹ׆༻͢ΔͨΊͷTips ▸ ࠓ·Ͱىͬͨ͜ͱղܾํ๏ ▸ ·ͱΊ
Twitter: #ISAOcorp DEVOPSΛࢧ͑Δपลπʔϧʹ͍ͭͯ Version Control System ▸ ͯ͢ͷߟ͑ํ͜͜ʹؼ݁͢Δɻ ▸ ڥυΩϡϝϯτͯ͢όʔδϣϯཧ͞Ε͍ͯΔ͖ɻ
▸ ݴ͏·Ͱແ͍͕GitҰʂϦʔφε͞ΜʹܟҙΛɻ ▸ GitHub͕σϕϩούͷίϛϡχςΟΛരൃతʹՃͤͨ͞ʂ
Twitter: #ISAOcorp DEVOPSΛࢧ͑Δपลπʔϧʹ͍ͭͯ CI Tool ▸ “ܧଓతΠϯςάϨʔγϣϯɺCIʢӳ: continuous integrationʣ ▸
ϏϧυɺςετΛܧଓతʹ࣮ߦ͢Δɻ ▸ gitͷcommitʹ࿈ಈͯ͠commit୯ҐͰςετͨ͠Γɻ ▸ ݸਓతʹJenkins͖͡Όͳ͍ɻଐਓԽ͢Δ(ଏʹݴ͏ Jenkins͓͡͞ΜʹͳΔ)͠ɺͳΜͰΞϦʹͳͬͯ͠·͏ɻ
Twitter: #ISAOcorp DEVOPSΛࢧ͑Δपลπʔϧʹ͍ͭͯ CI Tool 2016.08.22࣌ ग़యݩ:stackshare http://stackshare.io/continuous-integration
Twitter: #ISAOcorp DEVOPSΛࢧ͑Δपลπʔϧʹ͍ͭͯ Provisioning Tools ▸ ChefϑϧελοΫ&ઌൃɻ ▸ ߏཧπʔϧͷதͰݱࡏਓؾ͕͋ΔͷAnsibleɻ 2016.08.22࣌
ग़యݩ:stackshare http://stackshare.io/server-configuration-and- automation
Twitter: #ISAOcorp DEVOPSΛࢧ͑Δपลπʔϧʹ͍ͭͯ Other ▸ docker ▸ Vagrant
Twitter: #ISAOcorp ΞδΣϯμ ▸ ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DevOpsͷ৺ಘ ʹ͍ͭͯ ▸ DevOpsΛࢧ͑Δपลπʔϧʹ͍ͭͯ ▸ OpsWorksͷ֓ཁʹ͍ͭͯ
▸ OpsWorksΛ࣮ۀʹ׆༻͢ΔͨΊͷTips ▸ ࠓ·Ͱىͬͨ͜ͱղܾํ๏ ▸ ·ͱΊ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ OpsWorks ▸ OpsWorksͬͯԿʁ ▸ AWSαʔϏεͷҰͭͰελοΫΛ·ͱΊͯཧ͢ΔҝͷΈɻ ▸ ChefΛͬͯϓϩϏδϣχϯά͢Δɻ
▸ ͲΜͳγνϡΤʔγϣϯͰ༗ޮ׆༻Ͱ͖Δͷʁ ▸ Α͋͘ΔελοΫͰELBʹΞϓϦέʔγϣϯαʔόΛͿΒԼ͛ͯɺDBRDSͬͯΔ ߹ͳͲΛͬͯΔ߹ͳͲɻ ▸ ΞϓϦέʔγϣϯͷσϓϩΠɺߏཧΛू͍ͨ͠߹ͳͲɻ ▸ OpsWorksͷৄ͍֓͠ཁͪ͜Β ▸ AWS https://docs.aws.amazon.com/ja_jp/opsworks/latest/userguide/welcome.html
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ શମ૾
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ શମ૾ ▸ ࠷্Ґͷ֓೦͕stack ▸ ͦͷԼ͕Layerͱ͍͏֓೦ ▸ ͜͜ॏཁʂ
▸ ΞϓϦέʔγϣϯαʔόͷ͋ΒΏΔͷΛཧ͢Δɻద༻͢ΔϨγϐͱ͔ɻ ▸ Πϯελϯε୯ମͰͳ͘LayerΛҙࣝ͢ΔΑ͏ʹ͢Δɻ ▸ CookbookͷϦϙδτϦΛඥ͚Δ ▸ ΞϓϦέʔγϣϯͷϦϙδτϦΛඥ͚Δ ▸ ELBΛඥ͚Δ ▸ RDSΛඥ͚Δ ▸ ৄ͘͠ɺҎԼͷϋϯζΦϯࢿྉΛ http://www.slideshare.net/AmazonWebServicesJapan/aws-opsworks
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ OpsWorksͷಛ(1) ▸ ελοΫΛؙ͝ͱཧͰ͖Δɻ ▸ Πϯελϯεͷछྨ ▸ 24/7
: ͍ͭͰखಈͰ্͛Լ͛Ͱ͖Δɻ ▸ Time-based : ىಈΛεέδϡʔϦϯάͰ͖Δɻ ▸ ෛՙ͕͔͔Δ࣌ؒଳ༵Λࢦఆͯ͠ىಈΛࢦఆՄೳɻ ▸ Load-based : CPUɺϝϞϦ༻ʹΑͬͯΦʔτεέʔϦϯάͰ͖Δɻ ▸ ͜ͷΦʔτεέʔϧ࣮༻͍͠ɻɻChefΛ࣮ߦ͢ΔͨΊΠϯε λϯεͷىಈ͕࣌ؒͲ͏͔͔ͯͬͯ͠͠·͏ɻ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ OpsWorksͷಛ(2) ▸ ϥΠϑαΠΫϧΠϕϯτͱ͍͏֓೦ͰɺΠϯελϯεىಈ࣌ɺ deploy࣌ͳͲͦΕͧΕͰద༻͢ΔϨγϐΛࢦఆͰ͖Δɻ ▸ deployͷϩʔϧόοΫͰ͖Δɻ ▸
ελοΫΛΫϩʔϯͰ͖Δɻ ▸ ઃఆΛͯ͢Ҿ͖ܧ͛Δɻ ▸ ຊ൪ڥ͔ΒΫϩʔϯͯ͠εςʔδϯάڥΛߏங͢Δͱ ͔ɻ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ Lifecycle Event(Α͘͏ͭ) ▸ Setup ▸ Πϯελϯεىಈ࣌ʹ࣮ߦ͞ΕΔɻ ▸
ΊͪΌͪ͘Ό͏ͱ͜Ζɻ ▸ Deploy ▸ σϓϩΠͷࢦࣔΛͨ࣌͠ʹൃੜ͢Δɻ ▸ ΊͪΌͪ͘Ό͏ͱ͜Ζɻ ▸ Configure ▸ Πϯελϯε͕ىಈɺఀࢭͨ͠ࡍʹε λοΫͷͯ͢ͷΠϯελϯεͰൃ ੜ͢ΔɻΠϯελϯεͷIPΛશΠϯε λϯεͰཧ͍ͯ͠Δ࣌ͱ͔͑Δɻ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ Lifecycle Event(͋·ΓΘͳ͍ͭ) ▸ Undeploy ▸ ΞϓϦέʔγϣϯΛআ ͨ࣌͠ʹൃੜɻ
▸ Shutdown ▸ ΠϯελϯεΛఀࢭ͢Δ ࣌ʹൃੜ͢Δ ▸ ޙॲཧతͳͷɻԿ͔͠ ΒͷଓͬͨΓɻ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ OpsWorksͷΠέͯΔͱ͜Ζ ▸ ChefͷݟΛ׆͔ͤΔ ▸ AWSͷطଘϦιʔεΛར༻Ͱ͖Δ ▸ AMIΛར༻Ͱ͖Δ
▸ ϦιʔεΛϨΠϠ୯ҐͰϞχλͰ͖Δ ▸ ϦιʔεΛεέδϡʔϦϯάͰ͖Δ ▸ ELBͷඥ͚Λࣗಈతʹͬͯ͘ΕΔ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ OpsWorksͷΠέͯͳ͍ͱ͜Ζ(ͯ͠ཉ͍ͦ͠ͷ̍) ▸ Πϯελϯεͷىಈ͕͍ ▸ LayerͱAppͷඥ͚͕ͳ͍(ͳͥͳͷ͔ٙ͘͢͝)ͷͰෳ LayerͰͦΕͧΕผAppΛdeploy͢Δͷ͕໘ɻશͯͷ Layerʹdeployࢦ͕ࣔඈΜͰ͠·͏ɻ
▸ Ͱ͖ͳ͍Θ͚Ͱͳ͍ɻσϓϩΠϑοΫΛར༻ͯ͠ΞϓϦ έʔγϣϯ໊Ͱஅ͢ΕՄೳɻ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ OpsWorksͷΠέͯͳ͍ͱ͜Ζ(ͯ͠ཉ͍ͦ͠ͷ̎) ▸ instance storeΛར༻ͨ͠߹ͷAMIͷΦϖϨʔγϣϯ͕ ࡶɻ ▸ ࣮ߦ͢ΔϨγϐΛมߋͨ͠߹ɺىಈ࣌ʹ࣮ߦϨγϐͷϦε
τΛࣗಈͰߋ৽ͯ͘͠Εͳ͍ɻ ▸ ىಈͨ͠ޙʹupdate_custom_CookbookΛ࣮ߦͯ͠ɺ࠶ setupΛ͠ͳ͍ͱ͍͚ͳ͍ɻ ▸ Chef11ܥ->12ܥͷΞοϓάϨʔυෆՄɻstackΛ࡞Γ ͔͢͠ͳ͍ɻɻ
Twitter: #ISAOcorp OPSWORKSͷ֓ཁʹ͍ͭͯ Chef12ʹ͍ͭͯ ▸ Chef12ͰมΘͬͨࣄ ▸ ໊લۭؒ ▸ build-inΫοΫϒοΫͷΓ͠
▸ BerkshelfͷαϙʔτΊͨ ▸ ίϛϡχςΟΫοΫϒοΫΛΨϯΨϯ׆༻Ͱ͖ΔΑ͏ʹͳͬͨ ▸ ৄ͘͠ެࣜϦϑΝϨϯεͰ http://docs.aws.amazon.com/ja_jp/opsworks/latest/userguide/ chef-12-linux.html
Twitter: #ISAOcorp ΞδΣϯμ ▸ ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DevOpsͷ৺ಘ ʹ͍ͭͯ ▸ DevOpsΛࢧ͑Δपลπʔϧʹ͍ͭͯ ▸ OpsWorksͷ֓ཁʹ͍ͭͯ
▸ OpsWorksΛ࣮ۀʹ׆༻͢ΔͨΊͷTips ▸ ࠓ·Ͱىͬͨ͜ͱղܾํ๏ ▸ ·ͱΊ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS ͜ͷTipsҎԼ͕લఏͰ͢ ▸ ΞϓϦέʔγϣϯͷڥ ▸ OSubuntu ▸ ݴޠPHP
▸ ։ൃڥ ▸ mac ▸ OpsWorks ▸ Chef11.10ར༻ ▸ ※ฐࣾͷϓϩδΣΫτGoalousͰશͯͷTipsΛ࠾༻͓ͯ͠Γ·͢ɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS VagrantͱOpsWorksͰར༻͢ΔCookbooksΛڞ༗͢Δ ▸ VagrantͰϩʔΧϧ։ൃڥΛߏங ▸ ChefͷϨγϐݶΓͳ͘ڞ௨Խ͢Δ ▸ ϩʔΧϧڥͰಈ͍͚ͨͲεςʔδϯάͰಈ͔ͳ͍ɻ
ͱ͔ճආͰ͖Δɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS VagrantͱOpsWorksͰར༻͢ΔCookbooksΛڞ༗͢Δ ▸ Version ▸ Chef Development Kit
Version: 0.17.17 ▸ Vagrant 1.8.4 ▸ virtual box: Version 5.0.20
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS VagrantͱOpsWorksͰར༻͢ΔCookbooksΛڞ༗͢Δ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS VagrantͱOpsWorksͰར༻͢ΔCookbooksΛڞ༗͢Δ ▸ OpsWorks͔Βར༻͢ΔCookbook ͷϦϙδτϦʹҎԼΛؚΊΔ ▸ ެ։ڥͷΈʹద༻͢Δ Cookbook
▸ ϩʔΧϧ։ൃڥͷΈʹద༻͢Δ Cookbook ▸ ͜ͷϦϙδτϦɺୈҰ֊ʹ CookbookΛฒΔඞཁ͋Γɻ ▸ ChefͷϦϙδτϦͱσΟϨΫ τϦߏ͕ҧ͏ʹҙɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS VagrantͱOpsWorksͰར༻͢ΔCookbooksΛڞ༗͢Δ ▸ CookbooksͷϦϙδτϦΛΞϓ ϦέʔγϣϯͷϦϙδτϦʹ submoduleͱͯ͠ΈࠐΉ ▸ ͜ΕͰVagrant͔ΒࢀরͰ͖ΔΑ
͏ʹͳΔɻ ▸ git clone —recursive
[email protected]
:hoge/fuga ▸ Vagrant up ▸ Ҏ্ʂʂ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS BerkshelfΛར༻͢Δ ▸ BerkshelfChefͷCookbookΛύοέʔδཧతʹ ཧͯ͘͠ΕΔͭɻRubyͰ͍͏gemΈ͍ͨͳͷɻ ▸ Berksfileͱ͍͏ϑΝΠϧͰґଘΛཧ͢Δɻ ▸
OpsWorksͰChef11.10Λબͨ͠߹ʹར༻Մೳɻ ▸ VagrantͰɺChefDKͷΠϯετʔϧ͕ඞཁɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS OpsWorksͰͷBerkshelfͷઃఆ ▸ stackͷsettingͰҎԼΛઃఆ ▸ Chef version: 11.10
▸ Manage Berkshelf: yes
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS VagrantͰͷBerkshelfͷઃఆ(1) ▸ ChefDKΛΠϯετʔϧ ▸ pathͷઃఆ ▸ export
PATH=/opt/Chefdk/bin:$PATH ▸ Vagrant-BerkshelfΛΠϯετʔϧ ▸ Vagrant plugin install Vagrant-Berkshelf ▸ VagrantfileͰBerkshelfͷઃఆ(࣍ͷεϥΠυ)
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS VagrantͰͷBerkshelfͷઃఆ(2)
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS ChefͷCookbooksͷϦϙδτϦʹberksfileΛஔ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS Berkshelfͷҙ(1) ▸ VagrantͱOpsWorksͰ BerkshelfΛར༻͢Δ߹ͷ ҙͰ͢ɻ ▸ build-essentialͱaptόʔ
δϣϯࢦఆ(͠ͳ͍ͱChef12 ༷ʹͳͬͯ͠·͍ίέΔ) ▸ metadataࢦఆ͠ͳ͍
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS Berkshelfͷҙ(2) ▸ ࣗલͷCookbookͯ͢ pathࢦఆͰهࡌ ▸ VagrantͰBerkshelfར༻ ࣌ʹCookbook_pathΛ্
ॻ͖ͯ͠͠·͏ҝ ▸ ࣗલͷCookbookʹ metadata.rbΛஔ͢Δ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS travisʹdeployͤ͞Δ ▸ travisΛར༻ͯ͠ςετྃޙ ʹOpsWorksʹσϓϩΠࢦࣔ Λग़͢Α͏ʹ͢Δɻ ▸ gitͷϒϥϯνΛ֤ڥʹඥ
͚Δɻ ▸ GitHubͷϓϧϦΫͷϚʔδΛ ܖػʹϫϯετοϓͰσϓϩ ΠՄೳɻ<-- ૉఢʂ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS travisʹdeployͤ͞Δ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS travisʹdeployͤ͞Δ ▸ .travis.ymlϑΝΠϧʹσϓϩΠ ઌΛࢦఆ ▸ app-idOpsWorksͷAppͷ OpsWorks
ID ▸ දهͷҧ͍ʹҙʂ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS OpsWorks.phpΛ͏·͘ར༻͢͠ ▸ OpsWorks.php setup, deploy࣌ʹग़ྗ͞ΕΔϑΝΠ ϧɻ
▸ ΞϓϦέʔγϣϯίʔυ͕ஔ͔ Ε͍ͯΔσΟϨΫτϦͷϧʔτ ʹஔ͞ΕΔɻ ▸ stackͷ͋ΒΏΔϦιʔεͷ ଓใ͕هࡌɻ ▸ ΞϓϦέʔγϣϯ͔Β༰қʹ ଓͰ͖Δɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS OpsWorks.phpΛ͏·͘ར༻͢͠ ▸ frameworkͷdatabaseઃ ఆͰઃఆΛஔ͖͑Δɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS खಈΠϯετʔϧɺઃఆޚ๏ʂ ▸ ΠϯελϯεʹSSHͯ͠ύοέʔδΠϯε τʔϧͨ͠Γɺઃఆมߋͨ͠Γ͢Δͷμ ϝʂઈରʂ ▸ ඞͣChefͷrecipeͰద༻͢ΔΑ͏ʹ͢Δɻ
▸ test kitchenͰVagrant্ͰrecipeΛςετ ͢Δͱͳ͓Α͠ʂ ▸ ΠϯελϯεͰͳ͘LayerʹΛ͚Δɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS OpsWorksͷcustome jsonʹڥݻ༗ͷใΛ࣋ͨͤΔ ▸ stackͷsettingͷAdvanced optionsͷCustom JSONʹڥ ݻ༗ͷΛkey
valueͰهࡌɻ ▸ CookbookͰ͜ΕΒͷkey valueΛΞϓϦέʔγϣϯͷม ʹల։ɻ ▸ ͜ΕͰCustom JsonͷΈͰڥ ผͷઃఆ͕Մೳɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS ىಈ࣌ؒΛॖ͢Δ߹AMIͷར༻Λݕ౼ ▸ Πϯελϯεͷ৽نՃ࣌15Ҏ্͔͔Δέʔ ε͋Δɻ ▸ ىಈ࣌ؒͷॖΛ͍ͨ͠߹AMIΛར༻͢Δɻ ▸
OpsWorksͰͷAMIར༻ʹؔͯ͠ҎԼΛࢀর http://docs.aws.amazon.com/ja_jp/opsworks/ latest/userguide/workinginstances-custom- ami.html ▸ ࠷৽ͷϓϩϏδϣχϯάࡁΈͷΠϯελϯεͰ AMIΛͱΔɻ ▸ ΠϯελϯεՃ࣌ʹcustom AMIΛࢦఆ(ӈਤ) ▸ ͜ΕͰىಈ͕࣌ؒ5ͱ͔ʹॖՄೳɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS AMIར༻࣌ͷҙ ▸ ႈੑ͕ࣦΘΕͳ͍Α͏ʹؾΛ͚ͭΔɻ ▸ ΠϯελϯεՃ࣌ͷΦϖϨʔγϣϯ͕૿ ͑Δɻ ▸
͍ͭ࣌ͷAMIͳͷ͔ཧ͕ඞཁʹͳΔɻ ▸ ※ͦͦԿͷҝʹChefΛར༻͍ͯ͠Δ ͔ʁOpsWorksΛར༻͍ͯ͠Δ͔Α͘ߟ͑ ΔɻAMIΛར༻͢ΕͦͷίετͱϦεΫ ͕ൃੜ͢ΔࣄΛ೦಄ʹஔ͘ඞཁ͋Γɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS instance storeͷར༻ ▸ OpsWorksͰͷΠϯελϯεͷϘϦϡʔϜEBSΑΓinstance store ͷํ͕͍͍ͯΔɻ ▸
instance storeΠϯελϯεఀࢭ࣌ʹഁغ͞ΕΔɻ ▸ ΑΓImmutable ʹͳΔɻ ▸ instance store͕͔͔ۚΒͳ͍ɻEBSͷ߹ఀࢭ͍͓ͯͯ͠ ͕͔͔ۚΔɻେྔͷΠϯελϯεΛѻ͏߹ݕ౼ͯ͠ྑ͍͔ɻ ▸ ͨͩ͠ɺAMIΛར༻͢Δ߹ͷΦϖϨʔγϣϯ͕ΊΜͲ͘͞ ͍ɻɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS σϓϩΠϑοΫΛར༻͢͠(ͦͷ̍) ▸ deploy࣌ʹՃॲཧΛߦ͍͍ͨ߹ίʔϧόοΫΛར༻͢Δɻ ▸ ΞϓϦέʔγϣϯίʔυʹdeployσΟϨΫτϦΛ༻ҙ͠ɺҎԼͷϑΝΠϧΛஔ ▸ before_migrate.rb
– νΣοΫΞτεςʔδͷྃޙɺҠߦεςʔδͷલʹ ࣮ߦ͠·͢ɻ ▸ before_symlink.rb – ҠߦεςʔδͷྃޙɺγϯϘϦοΫϦϯΫεςʔδͷ લʹ࣮ߦ͠·͢ɻ ▸ before_restart.rb – γϯϘϦοΫϦϯΫεςʔδͷྃޙɺ࠶ىಈεςʔδͷ લʹ࣮ߦ͠·͢ɻ ▸ after_restart.rb – ࠶ىಈεςʔδͷྃޙʹ࣮ߦ͠·͢ɻ ▸ ͜ΕͰΞϓϦέʔγϣϯݻ༗ͷॲཧΛՃͰ͖Δɻ
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS σϓϩΠϑοΫΛར༻͢͠(ͦͷ̎) ▸ ҙͱͯ͠ɺCookbookͱΞϓϦέʔγϣϯ͕ͳ Δ͘૬ޓʹґଘ͠ͳ͍Α͏ʹ͢Δɻ ▸ setupͰ࣮ߦ͞ΕΔϨγϐͱσϓϩΠϑοΫ͕ґଘ͠ ߹ͬͯͨΓ͢Δͱdeploy࣌ʹsetupΛ࣮ߦ͠ͳ͍ͱ
͍͚ͳ͘ͳΔɻ ▸ ৄ͘͠ެࣜϦϑΝϨϯεʹͯ https://docs.aws.amazon.com/ja_jp/opsworks/latest/ userguide/workingcookbook-extend-hooks.html
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS ΫοΫϒοΫͷ্ॻ͖(Chef11ܥ) ▸ OpsWorksͷΫοΫϒοΫɺΈࠐΈΫοΫϒοΫɺ BerkshelfΫοΫϒοΫɺΧελϜΫοΫϒοΫͱ̏छྨ͋Δɻ ▸ ্هΫοΫϒοΫಉ໊͡લͷϨγϐ͕ଘࡏ͢Δ߹ɺϚʔδ ͞ΕΔɻ<-
͜͜ΊͪΌͪ͘ΌϋϚΔɻɻɻ ▸ ՄೳͰ͋ΕChef12ਪɻ ▸ ৄ͘͠ެࣜϦϑΝϨϯεͰ https://docs.aws.amazon.com/ja_jp/opsworks/latest/ userguide/workingcookbook-chef11-10.html
Twitter: #ISAOcorp OPSWORKSΛ࣮ۀʹ׆༻͢ΔͨΊͷTIPS ChefͷόʔδϣϯΞοϓͷҙ ▸ update_custom_CookbookΛߦͬͯChef versionߋ ৽͞Εͳ͍ɻ ▸ ΦϖϨʔγϣϯ
▸ OpsWorksͷstackઃఆͰChefͷόʔδϣϯΛΓସ͑ ▸ ৽نͰ1ϨΠϠʹՃ ▸ ৽نՃͨ͠Πϯελϯε͕ىಈͨ͠ΒɺଞΛͯ͢ আ͠ɺ࠶Ճ͢Δɻ
Twitter: #ISAOcorp ΞδΣϯμ ▸ ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DevOpsͷ৺ಘ ʹ͍ͭͯ ▸ DevOpsΛࢧ͑Δपลπʔϧʹ͍ͭͯ ▸ OpsWorksͷ֓ཁʹ͍ͭͯ
▸ OpsWorksΛ࣮ۀʹ׆༻͢ΔͨΊͷTips ▸ ࠓ·Ͱىͬͨ͜ͱղܾํ๏ ▸ ·ͱΊ
Twitter: #ISAOcorp ࠓ·Ͱىͬͨ͜ͱղܾํ๏ inodeރׇ ▸ ݱ ▸ deploy͕Կࣦഊ͢Δ͕ɺChefͷϩάݟͯຖճΤϥʔ͕ҧ͏ɻɻ ▸ ݪҼ
▸ node_modulesԼͷϑΝΠϧ͕7ສΛ͍͑ͯͨʂ ▸ ࣦഊͨ͠ੈΛอ͓࣋ͯ͠Γɺinode͕ރׇʂ ▸ inode֬ೝํ๏: df -i ▸ ରԠ ▸ ཧ͢ΔੈΛσϑΥϧτͷ̑ੈ͔Β̎ੈʹมߋͨ͠ɻ ▸ custom jsonͰཧ͢ΔੈΛࢦఆՄೳ(ӈਤ)
Twitter: #ISAOcorp ࠓ·Ͱىͬͨ͜ͱղܾํ๏ Chef11.04 ▸ ݱ ▸ OpsWorksͰChef11.04Λར༻͍ͯ͠ΔͱcloneͰ͖ͳ͍ɻadd instanceͰ͖ͳ͍(க໋తʂʂ) ▸
ຖճɺύϥϝʔλ͕ෆਖ਼ͱ͍͏ෆͳΤϥʔදࣔɻ ▸ ݪҼ ▸ Α͘Θ͔ΒΜɻOpsWorksଆͷ༷มߋʹΑΔͷɻ ▸ ରԠ ▸ Chef11.10ʹΞοϓάϨʔυͨ͠Βղফɻ
Twitter: #ISAOcorp ࠓ·Ͱىͬͨ͜ͱղܾํ๏ stack setting͕อଘͰ͖ͳ͍ ▸ ݱ ▸ OpsWorksͰstack settingΛอଘ͠Α͏ͱ͢ΔͱOpsWorks
id͕ݟ͔ͭΒͳ͍ɻͱ͔༁ͷΘ͔Βͳ͍Τϥʔ͕ɻ ▸ ݪҼ ▸ Α͘Θ͔ΒΜɻOpsWorksͷόάɻଟɻ ▸ ରԠ ▸ twittterͰAWSαϙʔτʹͭ͘͜͠ݴ͍ଓ͚ͨΒ࣍ͷղ ফ͞Ε͍ͯͨɻ
Twitter: #ISAOcorp ΞδΣϯμ ▸ ৽͍͠ϓϩδΣΫτΛ։࢝͢Δࡍʹ͓͖͑ͯ͘DevOpsͷ৺ಘ ʹ͍ͭͯ ▸ DevOpsΛࢧ͑Δपลπʔϧʹ͍ͭͯ ▸ OpsWorksͷ֓ཁʹ͍ͭͯ
▸ OpsWorksΛ࣮ۀʹ׆༻͢ΔͨΊͷTips ▸ ࠓ·Ͱىͬͨ͜ͱղܾํ๏ ▸ ·ͱΊ
Twitter: #ISAOcorp ·ͱΊ ▸ ϓϩδΣΫτΛ։࢝͢ΔࡍɺεέʔϥϏϦςΟΛߟྀͯ͠ڥߏஙɺσ ϓϩΠखॱΛ໌֬ʹ͠Α͏ɻΦϖϨʔγϣϯΛγϯϓϧʹɺଐਓԽͤ͞ͳ ͍Α͏ʹ͢Δํ๏Λݕ౼͠Α͏ɻ ▸ immutable Ͱ͋Εʂ࠷ͰԿ͔͋Ε0͔Β࡞Γͳ͓͠Ό͍͍͡Ό
Μɻͱݴ͑Δঢ়ଶʹ͠Α͏ɻ ▸ Chef৭ʑݴΘΕ͍ͯΔ͚ͲϓϩϏδϣχϯάπʔϧͷσϑΝΫτͩ͠ɺ ·ͣ৮ͬͯΈΑ͏ʂ ▸ ༷ʑͳΫϥυͷπʔϧΛར༻͠Α͏ɻ ▸ Ϛωʔδ͞Ε͍ͯͯεέʔϥϒϧͳπʔϧ͕٢ɻ ▸ ΘΘͤΔࣄͰϋοϐʔʹͳΕ·͢ʂ ▸ OpsWorksΑ͍Α( ´ ˜ ` )ů
ISAOΤϯδχΞ ΛઈࢍืूதͰ͢ʂ
͝ਗ਼ௌ ͋Γ͕ͱ͏ ͍͟͝·ͨ͠ʂ