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
Engine Yardで使われる Chefの活用レシピ
Search
Yusuke Ando
April 05, 2013
8
1.4k
Engine Yardで使われる Chefの活用レシピ
Yusuke Ando
April 05, 2013
Tweet
Share
More Decks by Yusuke Ando
See All by Yusuke Ando
CakePHP3でアプリ開発
yandod
1
340
Shimokita.Unity パーティクルでエフェクト
yandod
0
760
CakePHP3の明るい未来
yandod
1
210
Testing your app with Selenium on Travis CI
yandod
8
3.1k
Testing your app with Selenium on Travis CI
yandod
0
130
Inputで入力を扱う
yandod
0
660
Detonatorで爆発させる勉強会をした報告
yandod
0
2.4k
Mecanimでアニメーション - Shimokita.Unity
yandod
0
720
パリの街をUnityで駆ける
yandod
1
3.4k
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
243
12k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Thoughts on Productivity
jonyablonski
67
4.4k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Cost Of JavaScript in 2023
addyosmani
45
7k
We Have a Design System, Now What?
morganepeng
51
7.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
GraphQLとの向き合い方2022年版
quramy
44
13k
Transcript
$IFGͷ׆༻Ϩγϐ &OHJOF:BSEͰΘΕ͍ͯΔ
ZBOEP $BOEZ$BOFQIQ ʮ࠙ձϐβൃΞϓϦʯ
Copyright © 2013 Engine Yard. All Rights Reserved. 3 2006ɿ
Engine Yard ઃཱ (Ruby࣮ߦڥͷఏڙ։࢝) 2008ɿ Amazon༷͕Engine Yardʹग़ࢿΛൃද 2009ɿ AWSج൫ͷPaaSΛఏڙ։࢝ ࠷େڃͷAWSϦηʔϥʔʹ 2011ɿ PHP࣮ߦڥͷఏڙ։࢝ 2012ɿ Engine Yard ຊ๏ਓઃཱ Node.js࣮ߦڥͷఏڙ։࢝ എܠ: Engine Yard, Inc.ͷϏϧ(ӈख)͕ݐͭ1929ͷαϯϑϥϯγεί Engine YardͷาΈ
&OHJOF:BSE$MPVE 1MBUGPSNBTB4FSWJDF ઃఆෆཁͰࣗಈͰΞϓϦΛσϓϩΠ ӡ༻ɾࢹΛαϙʔτରԠ Πϯϑϥؔ࿈ͷਓ݅අΛθϩʹ ສ୯ҐͷΠϯελϯεΛҰׅӡ༻
&OHJOF:BSE$MPVE
"84 $IFG αϙʔτ
"HFOEB $IFGͱ $IFG4PMPͷར༻ ΑΓ࣮ફతͳར༻ྫ
$IFGͱ
$IFG 3VCZͷγεςϜཧπʔϧ ઃఆϑΝΠϧΛݩʹαʔόΛࣗಈઃఆ 6OJY-JOVY.BD8JOEPXTରԠ ແঈ൛Ͱར༻Մೳ ࠃ֎Ͱٸʹελϯμʔυʹ
DPPLCPPLΛݩʹઃఆ recipe cookbook 3VCZͰॻ͔ΕͨϨγϐͷू·Γ͕ΫοΫϒοΫ $IFGϨγϐΛݩʹϗετΛࣗಈͰઃఆ͢Δ
SFDJQJFTͷྫ log "Hello Chef" package "apache2" do action :install end
service "apache2" do action :start end
*OGSBTUSVDUVSFBT$PEF 2011/2 ΠϯϑϥΛίʔυͰهड़͢Δ ͕࣌౸དྷͨ͠
ʮγΣϧεΫϦϓτͰͳ͍ʯ ႈੑ͋Δ͔ʁ
ႈੑ ͋Δૢ࡞Λճߦͬͯෳճ ߦͬͯ݁Ռ͕ಉ͡Ͱ͋Δ͜ͱ Λ͍͏֓೦
ΠϯετʔϧεΫϦϓτ ߏஙޙͷঢ়ଶ͔͠อূͰ͖ͳ͍ $IFGԿͰ࣮ߦՄೳͰ γεςϜΛఆٛ͞Εͨঢ়ଶʹͰ͖Δ
$IFGͷߏ తͷϊʔυ܈ ཧ༻αʔό
όϦΤʔγϣϯ )PTUFE$IFG 0QT$PEF͕ϗεςΟϯά͢Δ ϊʔυʹԠͨ͡՝ۚ 1SJWBUF$IFG 'JSFXBMMͰՔಇ͢Δ ༗ঈ൛αϙʔτ͋Γ
)PTUFE$IFG
1SJDF
$IFG4FSWFS 044 ࣮ɺͬͨࣄͳ͍Ͱ͢ʜ
DIFGTPMP αʔόʔෆཁͷDIFG ϩʔΧϧ্ͷΫοΫϒοΫΛ࣮ߦՄೳ (6*͑ͳ͍ DIFGTPMPΛΩοΫ͢Δπʔϧଟ͍ FY 7BHSBOU &OHJOF:BSE
͜Μͳ
Chef Server $IFG$MJFOU ։ൃऀͷPC Workstation Node Cookbook Node DIFGDMJFOU DIFGDMJFOU
"1* Cookbook LOJGF
։ൃऀͷPC Workstation Node $IFG4PMP,OJGF4PMP Node DIFGTPMP Cookbook LOJGF Cookbook DIFGTPMP
Cookbook TTI TTI
DIFGTPMPେਓؾ
·ͣ$IFG4PMPͰ ϨγϐΛͬͨߏஙʹ ׳ΕΔͷ͕٢
$IFG4PMPͷར༻
ηοτΞοϓ $ curl -L https://www.opscode.com/chef/install.sh | sudo bash $IFGͷ࣮ߦʹඞཁͳ3VCZ3VCZHFNTΛ γεςϜͱಠཱͯ͠Πϯετʔϧ
TPMPSC Ұ࣍σΟϨΫτϦͷॴͷઃఆ ΫοΫϒοΫͷύεͷઃఆ FUDDIFGTPMPSC ࣮ߦ࣌ʹଘࡏ͠ͳ͍߹ܯࠂ
TPMPSC file_cache_path "/var/chef-solo" cookbook_path ["/var/chef-solo/cookbooks"] file_cache_path "/var/chef-solo" cookbook_path ["/var/chef-solo/cookbooks", "/var/chef-solo/site-cookbooks"]
ෳࢦఆՄ
OPEFKTPO $IFGαʔό͔Βͷσʔλͷସ ΫοΫϒοΫ͢มΛઃఆ ࣮ߦ͢ΔϨγϐΛࢦఆ͢Δ
OPEFKTPO { "resolver": { "nameservers": [ "10.0.0.1" ], "search":"int.example.com" },
"run_list": [ "recipe[resolver]" ] } { "run_list": [ "recipe[resolver]" ] } ࣮ߦ͍ͨ͠Ϩγϐ
DIFGTPMP
ͭ·Γ ະઃఆͷঢ়ଶ͔ΒͰҙͷΫοΫ ϒοΫΛ࣮ߦग़དྷΔ WBSDIFGDPPLCPPLTIPHF ͷΫοΫϒοΫΛ࣮ߦ͢ΔͳΒ $ sudo chef-solo -o hoge
ςετ࣮ߦ
Ϩγϐͷهड़ LOJGFίϚϯυ σΟϨΫτϦߏ 3FTPVSDF ެ։͞Ε͍ͯΔΫοΫϒοΫ
ΫοΫϒοΫ࡞ LOJGFDPPLCPPLDSFBUF\OBNF^ WBSDIFGDPPLCPPLTҎԼʹ࡞ $IFGαʔόΛΘͳ͍ͷͰΑ͠ͳʹ (JU)VC4Ͱཧ
σΟϨΫτϦߏ CHANGELOG.md attributes/ files/ metadata.rb recipes/ templates/ README.md definitions/ libraries/
providers/ resources/ ϨγϐΛஔ͘ QMBUGPSNຖʹग़དྷΔ ઃఆϑΝΠϧͷͻͳܗ ϨγϐͰར༻͍ͨ͠มͳͲ
SFDJQFTEFGBVMUSC log “Hello Chef” QMBUGPSNΛؾʹ͠ͳ͍߹
Ϩγϐ 3VCZͰॻ͔ΕͨεΫϦϓτ ෦%4-Λͬͯهड़ 3FTPVSDFͱݺΕΔจ๏ ΈࠐΈͷ3FTPVSDF04ʹґଘ͠ͳ͍ ઃఆ࡞ۀΛఏڙ
SFDJQJFTEFGBVMUSC log "Hello Chef" package "apache2" do action :install end
service "apache2" do action :start end ֤ڥͷύοέʔδཧΛ࣮ߦ
BQBDIFೖͬͨ
BQUHFUͰྑ͘Ͷʁ ୯७ͳύοέʔδಋೖҎ্ͷॲཧ͕ग़ དྷΔͷ͕$IFGͷڧΈ ݻ༗ͷઃఆϑΝΠϧͷઃஔ ύοέʔδؒɺϊʔυؒͷ࿈ಈઃఆ ࣮ߦ࣌ʹใΛऔಘ͢Δػೳ
UFNQMBUFϦιʔε &3#ΛͬͯಈతͳΛૠೖ "QBDIFQIQOHJOYͳͲͷઃఆʹ ϓϥοτϑΥʔϜຖʹࠩ͠ସ͑Մೳ
UFNQMBUFTEFGBVMUUFTUUYUFSC This is Sample File.<br/> <%= node[:platform] %><br/> <%= node[:platform_version]
%> SFDJQFTEFGBVMUSC ଓ template "/var/www/test.txt" do source "test.txt.erb" mode 0644 end
ಈతʹϑΝΠϧΛ࡞
JODMVEF ผͷΫοΫϒοΫΛಡΈࠐΉ طଘͷࣝͷ࠶ར༻ ґଘؔͷఆٛ include_recipe “fuga”
ͦͯ͠ ࣗྗͰهड़ͨ͠ϨγϐΛஷΊ͍ͯ͘ ωοτ্ͷϨγϐΛखͯ͠͠ར༻ *OGSBTUSVDUVSFBTDPEFΛ࣮ݱ
ΑΓ࣮ફతͳར༻ྫ
໘͢Δ՝ తͷڥΛߏங͢ΔϨγϐͷ࣮ ॻ͔ΕͨϨγϐͷӡ༻อक Ϩγϐͷํ๏ ϨγϐͷөλΠϛϯάͷ੍ޚ
Ϩγϐͷ࣮ 3VCZͰͷ࣮ʹෆ׳Ε ˠ(JU)VC্ͷϨγϐΛࢀরɾར༻ Ϩγϐͷςετ༻ͷڥ͕େྔʹ͏ ˠ7BHSBOUΛ͏
None
7BHSBOU 7JSUVBM#PYͷϑϩϯτΤϯυ ΠϝʔδϑΝΠϧͷཧɺDIFG QVQQFUͷىಈ·ͰΛશࣗಈͰ࣮ߦ $IFGϢʔβͷඞܞπʔϧ ϓϥάΠϯͰΫϥυར༻Մೳ
Ϩγϐͷӡ༻อक Ϩγϐͷ (JU)VC ,OJGFTPMP /'4 $IFG4FSWFS #FSLTIFMG ϨγϐͷөλΠϛϯά $BQJTUSBOP DSPO
DIFGDMJFOUͷEBFNPO
Node Node GitHub engineyard.com Node &OHJOF:BSEͷ߹ DIFGTPMP Cookbook BQQMZ &OHJOF:BSE͕࣮ͨ͠Ϩγϐ
Λ8FCͷૢ࡞Ͱඞཁͳ࣌ʹө ΧελϜϨγϐ
GitHub ։ൃऀͷPC &OHJOF:BSE-PDBM Cookbook &OHJOF:BSE-PDBM Ϋϥυ্ͱಉҰͷϨγϐͰϩʔΧϧʹ ։ൃڥΛ࡞Δπʔϧ VM DIFGTPMP BQQMZ
7BHSBOU Node DIFGTPMP BQQMZ
ར ར༻ऀվྑ͞Ε͚ͭͮΔϨγϐΛ Կॻ͔ͣʹར༻Ͱ͖Δ ར༻ऀͷڥͷ෦ߏ͕౷Ұ͞Ε ޮతͳαϙʔτ͕Մೳ ϨγϐΛՃͯ͠ҙͷߏՄೳ
ڭ܇ Ϩγϐͷ࣮ͱద༻ࣗಈԽ͕ඞཁ πʔϧͷಋೖ݁ہඞཁ $IFGͦͷͷΛӡ༻͢Δ࿑ྗ ࣗྗPS֎෦αʔϏε &OHJOF:BSE
࣭ʁ IUUQCJUMZFZDIFG ຊͷεϥΠυͳͲͷใɺ ϊϕϦςΟͷϓϨθϯτใʂ