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
初めてのChefの教室
Search
Yusuke Ando
February 22, 2013
Programming
19
28k
初めてのChefの教室
2/22に株式会社Engine Yardで開催した非インフラエンジニア向けChef入門講座です。
Yusuke Ando
February 22, 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
200
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
Other Decks in Programming
See All in Programming
CSC509 Lecture 09
javiergs
PRO
0
140
RubyLSPのマルチバイト文字対応
notfounds
0
120
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
240
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Click-free releases & the making of a CLI app
oheyadam
2
120
Remix on Hono on Cloudflare Workers
yusukebe
1
300
Arm移行タイムアタック
qnighy
0
330
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Teambox: Starting and Learning
jrom
133
8.8k
The Cult of Friendly URLs
andyhume
78
6k
For a Future-Friendly Web
brad_frost
175
9.4k
We Have a Design System, Now What?
morganepeng
50
7.2k
Speed Design
sergeychernyshev
25
620
A designer walks into a library…
pauljervisheath
204
24k
4 Signs Your Business is Dying
shpigford
180
21k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Ruby is Unlike a Banana
tanoku
97
11k
Transcript
ॳΊͯͷ$IFGͷڭࣨ &OHJOF:BSE.FFUVQ ඇΠϯϑϥΤϯδχΞͰग़དྷͨ
ZBOEP
"84 $IFG αϙʔτ
&OHJOF:BSE-PDBM ͋ͳͨͷPC Engine Yard Local Engine Yard Cloud Your App
Your App PC্Ͱ։ൃ͕ແྉ Ϋϥυͱಉ͡ڥ (VagrantΛแ) γʔϜϨεʹΞϓϦΛσ ϓϩΠʂ
"HFOEB $IFGͱ ηοτΞοϓ Ϩγϐͷهड़ ใͷ୳͠ํ
$IFGͱ
$IFG 3VCZͷγεςϜཧπʔϧ ઃఆϑΝΠϧΛݩʹαʔόΛࣗಈઃఆ 6OJY-JOVY.BD8JOEPXTରԠ ແঈ൛Ͱར༻Մೳ ࠃ֎Ͱٸʹελϯμʔυʹ
*OGSBTUSVDUVSFBT$PEF 2011/2 ΠϯϑϥΛίʔυͰهड़͢Δ ͕࣌౸དྷͨ͠
None
DPPLCPPLΛݩʹઃఆ recipe cookbook 3VCZͰॻ͔ΕͨϨγϐͷू·Γ͕ΫοΫϒοΫ $IFGϨγϐΛݩʹϗετΛࣗಈͰઃఆ͢Δ
$IFGͷߏ తͷϊʔυ܈ ཧ༻αʔό
όϦΤʔγϣϯ )PTUFE$IFG 0QT$PEF͕ϗεςΟϯά͢Δ ϊʔυʹԠͨ͡՝ۚ 1SJWBUF$IFG 'JSFXBMMͰՔಇ͢Δ ༗ঈ൛αϙʔτ͋Γ
1SJDF
8FC6* ࣮ɺͬͨࣄͳ͍Ͱ͢ʜ
DIFGTPMP αʔόʔෆཁͷDIFG ϩʔΧϧ্ͷΫοΫϒοΫΛ࣮ߦՄೳ (6*͑ͳ͍ DIFGTPMPΛΩοΫ͢Δπʔϧଟ͍ FY 7BHSBOU &OHJOF:BSE
·ͣ$IFG4PMPͰ ϨγϐΛͬͨߏஙʹ ׳ΕΔͷ͕٢
ηοτΞοϓ
ηοτΞοϓ 3VCZ 3VCZHFNT TPMPSC OPEFKTPO
3VCZSVCZHFNT $ sudo apt-get install ruby1.8 $ sudo apt-get install
rubygems $ sudo gem install chef $ chef-solo -v Chef: 11.4.0 DIFGTPMPDIFGʹಉࠝ DIFGࣗମBQUHFUͰಋೖՄ
3VCZͷཧҙ
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
ςετ࣮ߦ
͜͜·Ͱͷ·ͱΊ TVEPBQUHFUVQEBUF TVEPBQUHFUSVCZSVCZHFNT TVEPHFNJOTUBMMDIFG TVEPLOJGFDPPLCPPLDSFBUFIPHF TVEPDIFGTPMPPIPHF
Ϩγϐͷهड़
Ϩγϐͷهड़ LOJGFίϚϯυ σΟϨΫτϦߏ 3FTPVSDF ެ։͞Ε͍ͯΔΫοΫϒοΫ
LOJGFίϚϯυ DIFGαʔόͱͷ௨৴֤छ࡞ۀΛߦ͏ ΫϥΠΞϯτ DIFGTPMPͰར༻͢Δ߹ΫοΫϒο ΫͷॳظԽ࡞ۀʹ͏ ϓϥάΠϯͰαϒίϚϯυΛ֦ுՄ
αϒίϚϯυ ߦ͋Δϔϧϓ ʢ֮͑ΒΕͳ͍ʣ
ΫοΫϒοΫ࡞ 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Λ࣮ݱ
ใͷ୳͠ํ
ެ։͞Ε͍ͯΔϨγϐ ͞·͟·ͳํ๏Ͱ͞·͟·ͳஂମ͕ ΫοΫϒοΫΛެ։͍ͯ͠Δ ϨγϐΛ࠶ར༻͢Δ߹શମͷΞʔ ΩςΫνϟʹେ͖ͳӨڹ
DPNNVOJUZPQTDPEFDPN
(JU)VC্ͷϦιʔε opscode-cookbooks ެࣜΫοΫϒοΫ rightscale/cookbooks_public engineyard/ey-cloud-recipes aws/opsworks-cookbooks ֤ϓϥοτϑΥʔϜ͚ jsierles/chef_cookbooks ͔ͭͯ 37signalsͷϦϙδτϦͩͬͨͷ
4PVSDFΠϯετʔϧΛ࣮
None
3PMF͕࣮͞Ε͍ͯΔ
None
None
ͪΐͬͱมΘͬͨ pivotal/pivotal_workstation Pivotalͷ։ൃऀͷPCΛηοτΞοϓ͢Δ
$ISPNF
.BDͷนࢴΛઃఆ
ڭ܇ ެࣜϨγϐϚϧνϓϥοτϑΥʔϜ 1BB4ܥ͕࣮͞Ε͍ͯΔ ಠࣗʹॻ͘ͳΒܾΊଧͪՄೳ ʮखॱॻʯΛࣗಈԽ͢Δهड़ྗ
࣭ʁ