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
Opening - Itamae Meetup#1
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ryota Arai
December 09, 2015
Programming
3.2k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Opening - Itamae Meetup#1
http://itamae.connpass.com/event/22857/
Ryota Arai
December 09, 2015
More Decks by Ryota Arai
See All by Ryota Arai
Spot Instances in Cookpad #CookpadTechConf 2017
ryotarai
7
9k
Itamae - Infra as Code 現状確認会
ryotarai
55
20k
Introducing Infrataster
ryotarai
9
13k
Infrataster - Infra Behavior Testing Framework #oedo04
ryotarai
17
6.8k
グリーにおけるChef導入事例 ~既存の資産を活かし新しい技術を導入する~
ryotarai
27
7.1k
Other Decks in Programming
See All in Programming
AI時代のUIはどこへ行く?その2!
yusukebe
21
7k
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
780
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
340
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
320
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
260
TAKTでAI駆動開発の品質を設計する
j5ik2o
6
1.2k
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
220
AIで効率化できた業務・日常
ochtum
0
120
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
540
技術記事、 専門家としてのプログラマ、 言語化
mizchi
5
3.1k
Lessons from Spec-Driven Development
simas
PRO
0
170
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
390
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1.1k
Writing Fast Ruby
sferik
630
63k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
220
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Designing Experiences People Love
moore
143
24k
Designing for Performance
lara
611
70k
Ethics towards AI in product and experience design
skipperchong
2
310
Code Reviewing Like a Champion
maltzj
528
40k
The Spectacular Lies of Maps
axbom
PRO
1
800
Transcript
Itamae Meetup #1 Ryota Arai
ߥҪ ྑଠ • ΫοΫύουͷΤϯδχΞ • Πϯϑϥ෦ॴଐ DevدΓͷOps • ItamaeInfratasterͷ࡞ऀ •
@ryotarai (GitHub), @ryot_a_rai (Twi>er)
Itamae • CFEngine • Puppet • Chef • Ansible •
Itamae
Itamae • Chefʹ͔ͭΕͨਓͷͨΊͷߏཧπʔϧ • ChefʹࣅͨRuby DSL • Chefʹൺγϯϓϧ • SSHܦ༝Ͱͷ࣮ߦΛαϙʔτ
• ࣮ߦରʹItamaeΛΠϯετʔϧ͠ͳ͍Ͱ࣮ߦͰ͖Δ
Chef vs Itamae • ֶ͍शίετ • ֮͑Δࣄฑ͕গͳ͍ • খͯ͘͞ϋϚΓͲ͜Ζ͕গͳ͍ •
͍͟ͱͳͬͨΒίʔυΛ͙͢ಡΊΔେ͖͞ • ChefDKͱ͔ͭΒ͍
Chef • Recipes • Cookbooks • Roles • Environments •
Berkshelf
Itamae • Recipes • Cookbooks -> Recipe • Roles ->
Recipe • Environments -> Recipe • Berkshelf -> Gem, Bundler
Itamae # recipe.rb package "nginx" service "nginx" template "/etc/nginx/nginx.conf" do
notifies :restart, "service[nginx]" end $ itamae local recipe.rb $ itamae ssh -h your-server recipe.rb
Itamaeͷݱঢ় • 513 stars • 802 commits • 38 plugin
gems • 35 contributors • ?? users
ͱ͜ΖͰ
Α͍͘ΘΕΔ͜ͱ ʮItamaeͷϩΰͳ͍ΜͰ͔͢ʙʯ
None
·ͱͳͭͰ͖·ͨ͠
None
ࣗ͝༝ʹ͓͍͍ͩ͘͞ github.com/itamae-kitchen/itamae-logos
ؓٳ
࣮ݧతػೳͷհ
Itamaeͷ࣮ݧతػೳ • ࣮ݧతػೳ: ͻΐͬͱͨ͠Βফ͑ͨΓ༷͕มΘͬͨΓ͢Δ͔ • --recipe-graphΦϓγϣϯ • --profileΦϓγϣϯ • Handler
--recipe-graphΦϓγϣϯ
--recipe-graphΦϓγϣϯ • ϨγϐͷґଘؔΛdotܗࣜͰग़ྗͰ͖Δ • include_recipeͨ͠Ϩγϐ • Ϩγϐ܊͕େ͖͘ͳͬͯ͘Δͱศར͔͠Εͳ͍
None
--recipe-graphΦϓγϣϯ Itamae v1.9.0Ҏ߱ʢv1.9.0Ҏલ--dotΦϓγϣϯʣ $ itamae local --recipe-graph /path/to/itamae-graph.dot recipe.rb $
dot -Tpng -o /path/to/itamae-graph.{png,dot}
--profileΦϓγϣϯ
--profileΦϓγϣϯ • ࣮ߦͨ͠ίϚϯυ͝ͱʹ͔͔͕ͬͨ࣌ؒऔಘͰ͖Δ • ݫີʹSpecinfraͷrun_commandʹ͔͔ͬͨ࣌ؒ • JSONͰग़ྗ͞ΕΔ • ϘτϧωοΫͷௐࠪʹ༗ޮ͔͠Εͳ͍
--profileΦϓγϣϯ $ itamae local --profile /path/to/profile.json recipe.rb $ cat /path/to/profile.json
| jq . | head [ { "command": "mkdir -p /tmp/itamae_tmp", "duration": 0.0037856101989746094 }, { "command": "chmod 777 /tmp/itamae_tmp", "duration": 0.0025980472564697266 }, {
--profileΦϓγϣϯ
Handler
Handler • ࣮ߦ࣌ͷΠϕϯτΛड͚औͬͯҙͷॲཧΛߦ͏ • action_started, attribute_updatedͳͲ • ChefͷHandlerʹࣅ͍ͯΔ • ಠࣗͷHandlerॻ͚Δ
• ࣮ݧతػೳͱ͍͏Ґஔ͚ͮɻͻΐͬͱ͢Δͱ༷͕มߋ͞ΕΔ ͔
$ cat config.yml handlers: - type: json path: /path/to/itamae-log.json $
itamae local -c config.yml recipe.rb $ cat /tmp/itamae-log.json | head {"time":"2015-12-08T15:47:55+09:00","event":"recipe_started", "payload":{"path":"/Users/ryota-arai/src/github.com/ryotarai/itamae/tmp/recipe.rb"}} {"time":"2015-12-08T15:47:55+09:00","event":"resource_started", "payload":{"resource_type":"execute","resource_name":"echo included"}} {"time":"2015-12-08T15:47:55+09:00","event":"action_started", "payload":{"action":"run"}} {"time":"2015-12-08T15:47:55+09:00","event":"attribute_changed", "payload":{"from":{"executed":false}, "to":{"action":"run","command":"echo included","executed":true}}}
Handler • debug handler • ϩάग़ྗ • json handler •
JSON per lineͰϑΝΠϧग़ྗ • fluentd handler • fluent-loggerͰFluentdʹग़ྗ
Handler Gem • lib/itamae/handler/<handler type>.rb͕ࣗಈతʹ require͞ΕΔ • itamae-handler-<type> gemΛͭͬͯ͘Gemfileʹॻ͍͓ͯ ͚ͩ͘ͰOK
Handler Gem # lib/itamae/handler/mail.rb module Itamae module Handler class Mail
< Base def event(type, payload = {}) super send_mail(subject: type.to_s, body: payload.inspect) end end end end
Handler Gem • ৄ͘͠ h$ps:/ /github.com/itamae-kitchen/itamae/tree/ master/lib/itamae/handler Λ
CookpadͱItamae
CookpadͰͷϫʔΫϑϩʔ • Jenkins͕Git্ͷϨγϐΛtar.gzʹ͔ͨΊͯS3ʹΞοϓϩʔυ • ֤ϗετͰS3͔Βμϯϩʔυ͠ItamaeΛ࣮ߦ͢Δckpd- itamaeίϚϯυΛ༻ҙ͍ͯ͠Δ • itamae sshւΛ͑Δͱॏ͍ͷͰϩʔΧϧ࣮ߦΛ͍ͬͯ Δ
• omnibus-itamaeͷdebύοέʔδΛར༻͍ͯ͠Δ
omnibus-itamae • Chef͕ࣾ։ൃ͍ͯ͠ΔOmnibusͱ͍͏ύοέʔδϯάπʔϧΛ ͬͯdeb, rpmύοέʔδΛ࡞ • /opt/itamaeҎԼʹRubyຊମؚΊͯΠϯετʔϧ͞ΕΔ • fat͚ͩͲɺsystem rubyͷόʔδϣϯʹࠨӈ͞Εͳ͍
• Fluentdʹ͓͚Δtd-agentͷΑ͏ͳͷ
omnibus-itamae • ϏϧυࡁΈύοέʔδˏBintray • Ubuntu 14.04, CentOS 7༻ • खݩͰϏϧυՄೳ
$ echo 'deb https://dl.bintray.com/itamae/itamae trusty contrib' | sudo tee /etc/apt/sources.list.d/itamae.list $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv D401AB61 $ sudo apt-get update $ sudo apt-get install itamae
՝ • ϨγϐΛมߋͨ͠ࡍʹશʹө͢ΔΘ͚Ͱͳ͍ • Ϩγϐͱϗετͷݱঢ়͕Εͯɺ͕ࠩେ͖͘ͳΔ • applyͨ͠ΒࢥΘ͵มߋͰোʹͳͬͨΓ • ಛఆͷϗετ͚ͩઃఆ͕ҟͳ͍ͬͯͯো͕ىͬͨ͜Γ •
ϦεΫ͕େ͖͘ͳΔ
Itamae Server • ݱࡏ։ൃதʢҰԠΦʔϓϯιʔεʹͳ͍ͬͯΔʣ • Itamaeͷ࣮ߦͱϩάͷӾཡ͕Ͱ͖Δαʔό • Itamae࣮ߦ෦ʢBackendʣࠩ͠ସ͑Մೳ • HandlerΛ͔ͭͬͯϩάૹ৴
• itamae-handler-itamae_server
None
ߏྫ
Itamae Server • ItamaeΛ࣮ߦ͢ΔBackendࠩ͠ସ͑Մೳ • ྫ͑ɺConsulɺSSHɺStretcherͳͲ • ඇಉظͰitamae-handler-itamae_server͕ϩάΛItamae Serverʹ ૹ৴͢Δ
Itamaeͷࠓޙ • όάϑΟοΫεɺػೳՃ • ֶशίετΛ্͛ͣεϞʔϧελʔτͰ͖ΔΑ͏ʹҡ࣋ • Itamae v2ʢ༧ఆʣ • ϦϑΝΫλɺॻ͖͠ʢಛʹResource::BaseΛࣺ͍ͯͨʣ
• ϨγϐɺϓϥάΠϯͷޙํޓੑҡ࣋ • όοΫΤϯυΛinfra_operatorҠߦ͢Δ͔
ϑΟʔυόοΫΛٻΊ͍ͯ·͢ • Twi%erͰ@ryot_a_rai • Slack: h%ps:/ /itamae-slackin.herokuapp.com/ • Issue: h%ps:/
/github.com/itamae-kitchen/itamae/issues • PR: h%ps:/ /github.com/itamae-kitchen/itamae/pulls