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
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
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
340
自作OSでスライド発表する
uyuki234
1
3.6k
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
820
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
130
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
0
140
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
280
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
120
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
1k
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
460
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
190
Contextとはなにか
chiroruxx
1
390
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
Featured
See All Featured
A better future with KSS
kneath
240
18k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
The Language of Interfaces
destraynor
162
27k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Paper Plane
katiecoart
PRO
1
52k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
400
GraphQLとの向き合い方2022年版
quramy
50
15k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
400
Automating Front-end Workflow
addyosmani
1370
210k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
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