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
700
Poise: Reusable Cookbook Patterns
Noah Kantrowitz
April 16, 2014
Tweet
Share
More Decks by Noah Kantrowitz
See All by Noah Kantrowitz
What Python Can Learn From Other Languages
coderanger
0
26
What Python Can Learn From Other Languages (with notes)
coderanger
0
100
Swiss Army Django: Small Footprint ETL (with notes) - DjangoCon US
coderanger
0
160
Swiss Army Django: Small Footprint ETL - DjangoCon US
coderanger
0
43
How to look at space: PyCon AU
coderanger
0
79
Swiss Army Django: Small Footprint ETL
coderanger
0
62
Swiss Army Django: Small Footprint ETL (with notes)
coderanger
0
62
Minimum Viable Kubernetes
coderanger
0
24
Minimum Viable Kubernetes (with notes)
coderanger
0
350
Other Decks in Programming
See All in Programming
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.2k
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
280
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
350
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
受け取る人から提供する人になるということ
little_rubyist
0
250
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
CSC509 Lecture 11
javiergs
PRO
0
180
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
20
1.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Optimizing for Happiness
mojombo
376
70k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
The Invisible Side of Design
smashingmag
298
50k
GraphQLとの向き合い方2022年版
quramy
43
13k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
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