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
41
What Python Can Learn From Other Languages (with notes)
coderanger
0
130
Swiss Army Django: Small Footprint ETL (with notes) - DjangoCon US
coderanger
0
190
Swiss Army Django: Small Footprint ETL - DjangoCon US
coderanger
0
45
How to look at space: PyCon AU
coderanger
0
87
Swiss Army Django: Small Footprint ETL
coderanger
0
73
Swiss Army Django: Small Footprint ETL (with notes)
coderanger
0
67
Minimum Viable Kubernetes
coderanger
0
31
Minimum Viable Kubernetes (with notes)
coderanger
0
390
Other Decks in Programming
See All in Programming
5分で理解する SOLID 原則 #phpcon_nagoya
shogogg
1
390
Amazon Bedrockマルチエージェントコラボレーションを諦めてLangGraphに入門してみた
akihisaikeda
1
150
Datadog DBMでなにができる? JDDUG Meetup#7
nealle
0
150
From the Wild into the Clouds - Laravel Meetup Talk
neverything
0
170
ソフトウェアエンジニアの成長
masuda220
PRO
12
2.1k
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
270
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
1.2k
PRレビューのお供にDanger
stoticdev
1
240
もう少しテストを書きたいんじゃ〜 #phpstudy
o0h
PRO
19
4.1k
はじめての Go * WASM *OCR
sgash708
1
110
iOSでQRコード生成奮闘記
ktcryomm
2
110
Better Code Design in PHP
afilina
0
180
Featured
See All Featured
Six Lessons from altMBA
skipperchong
27
3.6k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
BBQ
matthewcrist
87
9.5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Product Roadmaps are Hard
iamctodd
PRO
51
11k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
580
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
134
33k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
10
520
Speed Design
sergeychernyshev
27
810
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