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
Poise: Reusable Cookbook Patterns
Search
Noah Kantrowitz
April 16, 2014
Programming
1
670
Poise: Reusable Cookbook Patterns
Noah Kantrowitz
April 16, 2014
Tweet
Share
More Decks by Noah Kantrowitz
See All by Noah Kantrowitz
Swiss Army Django: Small Footprint ETL (with notes) - DjangoCon US
coderanger
0
96
Swiss Army Django: Small Footprint ETL - DjangoCon US
coderanger
0
17
How to look at space: PyCon AU
coderanger
0
55
Swiss Army Django: Small Footprint ETL
coderanger
0
40
Swiss Army Django: Small Footprint ETL (with notes)
coderanger
0
39
Minimum Viable Kubernetes
coderanger
0
16
Minimum Viable Kubernetes (with notes)
coderanger
0
280
Applied Science Fiction: Operating a Research-Led Product (with notes)
coderanger
0
21
Applied Science Fiction: Operating a Research-Led Product
coderanger
0
43
Other Decks in Programming
See All in Programming
導入から5年が経って見えた Datadog APM 運用の課題
bgpat
2
540
Open Source Swift Workshop - Foundation and first party libraries
ikesyo
0
180
ONE WEDGE_Company_Information
1wedge
0
170
【KMC春合宿2024】実装視点で見るNeural Radiance Fields
runningoutrate
0
150
両面どころかインフラもTSでできるよ ~ 全方位TypeScriptによるプロダクト開発 ~
myfinder
8
2.2k
[スクリプト] Swiftの型推論を学ぼう
omochi
0
110
RubyVM を PHP で実装する 〜Hello World を出力するまで〜
memory1994
PRO
1
490
デザインシステムで Tailwind CSSとCSS in JSに分散投資をしたら良かった話
fsubal
14
3.2k
document.write再考
brn
5
2.5k
App Router への移行は「改善」となり得るのか?/ Can migration to App Router be an improvement
takefumiyoshii
1
120
Deno に Web 標準 API を実装する / Implementing Web Standard API to Deno
petamoriken
0
350
CSRF対策のやり方、そろそろアップデートしませんか / Update your knowledge of CSRF protection
hiro_y
25
14k
Featured
See All Featured
The Cult of Friendly URLs
andyhume
73
5.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
657
120k
Building Your Own Lightsaber
phodgson
97
5.6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.3k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
101
6.6k
Thoughts on Productivity
jonyablonski
57
3.8k
GraphQLとの向き合い方2022年版
quramy
28
12k
Fireside Chat
paigeccino
19
2.6k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.4k
Making the Leap to Tech Lead
cromwellryan
123
8.4k
Making Projects Easy
brettharned
106
5.4k
GitHub's CSS Performance
jonrohan
1023
450k
Transcript
Cookbook Patterns Poise Noah Kantrowitz
Me •PSF + PyCon •Balanced •Chef •Making things
•What? •Why? •How?
None
None
None
cook·book A description of a piece of infrastructure
Role Cookbook Recipe Resource
None
leak·y ab·strac·tion Incomplete hiding of internal details
None
•Fork (and patch) •Wrapper •Rewind
Inheritance
None
10x
Poise
•Helpers •DSL extensions •Patterns
None
•jenkins •jenkins_job •jenkins_credential •jenkins_plugin
•ci_job •ci_pipeline •name_ci_pipeline
Using Poise
class Chef class ... ... end end
Resource::Foo < Resource Provider::Foo < Provider
•Foo => foo •FooBar => foo_bar •FOO => f_o_o
class ... include Poise ... end
action(:one, :two) attribute(:name, kind_of: String)
attribute(:opts, option_collector: true ) opts do foo 'bar' end
attribute(:path, default: lazy { ... })
attribute(:config, template: true) attribute('', template: true)
foo ... do source 'cfg.erb' end foo ... do content
'x=1' end
file ... do content nr.content end
class Provider... def action_one ... end end
notifying_block do ... end
include_recipe ...
Putting It Together
class Res::Foo < Res include Poise action(:one) attribute(:pkg) attribute(:ver) end
def action_one notifying_block do install_pkg write_config end end
def install_pkg package nr.pkg do version nr.ver end end
def install_pkg r = super r.package_name( 'my-thing') r end
Next Steps
Subresources
Cookbook Tiers
•poise-proxy •poise-appenv •poise-service?
•attribute(node: ...) •group do ... end •after(:one)
None
Thank You