103
Cooking Perl with Chef David Golden @xdg

Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Cooking Perl with Chef

David Golden@xdg

Page 2: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

[cliff]

Page 3: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

A metaphoric cliff

Page 4: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

From cozy job ... to entrepreneur

Page 5: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2
Page 6: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Fear...

Page 7: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Fear... am I crazy?

Page 8: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Fear... am I too old for this?

Page 9: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Startups are for college kids, right?

Page 10: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

[hoodie picture]

Page 11: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Startup culture is a grind

Page 12: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

All night hackathons? WTF?

Page 13: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

[hackathon sleep pic(s)]

Page 14: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

I will never beat 20 year-olds on hours

Page 15: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

I don't want to for two big reasons

Page 16: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

I don't want to for two big reasonslittle

Page 17: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2
Page 18: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2
Page 19: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

I'm not afraid of running a business

Page 20: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

I'm not afraid of programming

Page 21: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

I'm afraid of operations

Page 22: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

I'm afraid of things going horribly wrong

Page 23: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Fear... is motivating

Page 24: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Memorial Day Weekend, 2012

Page 25: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Got lucky!

Page 26: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Side projects take time, too

Page 27: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Work smarter, not harder

Page 28: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Doing things by hand (more than once) sucks

Page 29: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Infrastructure as code

Page 30: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Automate deploying the whole stack

Page 31: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Configuration management(Chef, Puppet, etc....)

Page 32: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

WAIT!What's wrong with this idea?

Page 33: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Dependency hell

Page 34: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Perl applications are complex

Page 35: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = perl + CPAN + your code

Page 36: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = perl + CPAN + your code

CHIDateTimeDBIJSONMoosePlackPOETry::Tiny...

Page 37: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = perl + CPAN + your code

CHIDateTimeDBIJSONMoosePlackPOETry::Tiny...

v1.0.0

Page 38: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = Perl + CPAN + your code

CHIDateTimeDBIJSONMoosePlackPOETry::Tiny...

v1.0.0 v5.14.2

Page 39: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = Perl + CPAN + your code

0.550.761.6222.532.06030.99891.3540.11...

v1.0.0 v5.14.2

Page 40: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = Perl + CPAN + your code

0.550.761.6222.532.06030.99891.3540.11...

v1.0.0 v5.14.2 v1.0

Page 41: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = Perl + CPAN + your code

0.550.761.6222.532.06030.99891.3540.11...

v1.0.0 v5.14.2 v1.0

Page 42: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = Perl + CPAN + your code

0.550.761.6222.532.06030.99891.3540.11...

v1.0.0 v5.16.0 v1.0

Page 43: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

App = Perl + CPAN + your code

0.550.761.6222.532.06030.99891.3540.11...

v1.0.1 v5.16.0 v1.0

Page 44: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment

Page 45: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment

... the same Perl

Page 46: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment

... the same Perl

... the same modules

Page 47: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment

... the same Perl

... the same modules

... the same code

Page 48: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment

... the same Perl

... the same modules

... the same code

... on demand

Page 49: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Easy...

Page 50: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

If we have the right tools

Page 51: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Distro packages (?!)

(how much do you like your system perl?!)

Page 52: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

We need something better

Page 53: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Let's be inspired by Larry

Page 54: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

[larry hat pic]

Page 55: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2
Page 56: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

YARRR!

Page 57: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Great hackers steal!

Page 58: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Great hackers steal ideas

Page 59: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

python has virtualenv + pipruby has rvm + Bundler

Page 60: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

We have Miyagawa

Page 61: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

We have Kang-min Liu

Page 62: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

We have Matt Trout

Page 63: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

We have a community helping them

Page 64: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment in five parts

Page 65: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment in five parts

application-specific Perl

application-specific @INC path

versioned application code

versioned module dependencies

automate the previous four

Page 66: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment in five parts

perlbrew

application-specific @INC path

versioned application code

versioned module dependencies

automate the previous four

Page 67: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment in five parts

perlbrew

local::lib

versioned application code

versioned module dependencies

automate the previous four

Page 68: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment in five parts

perlbrew

local::lib

git

versioned module dependencies

automate the previous four

Page 69: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment in five parts

perlbrew

local::lib

git

carton

automate the previous four

Page 70: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Repeatable deployment in five parts

perlbrew

local::lib

git

carton

@&$%!

Page 71: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

@&$%!

Page 72: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

[swedish chef FAIL pic]

Page 73: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

So I implemented it

Page 74: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

In Ruby

Page 75: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

After I learned some Ruby

Page 76: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Time for a demonstration

Page 77: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Our goal: deploy a “Hello World” Plack app

Page 78: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

$ tree.├── Changes├── Makefile.PL├── app.psgi├── carton.lock├── cookbook│ └── hello-world│ ├── README.md│ ├── attributes│ │ └── default.rb│ ├── metadata.rb│ └── recipes│ └── default.rb└── lib └── ZZZ └── Hello └── World.pm

Page 79: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

$ tree.├── Changes├── Makefile.PL├── app.psgi├── carton.lock├── cookbook│ └── hello-world│ ├── README.md│ ├── attributes│ │ └── default.rb│ ├── metadata.rb│ └── recipes│ └── default.rb└── lib └── ZZZ └── Hello └── World.pm

Page 80: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

$ tree.├── Changes├── Makefile.PL├── app.psgi├── carton.lock├── cookbook│ └── hello-world│ ├── README.md│ ├── attributes│ │ └── default.rb│ ├── metadata.rb│ └── recipes│ └── default.rb└── lib └── ZZZ └── Hello └── World.pm

Page 81: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

$ tree.├── Changes├── Makefile.PL├── app.psgi├── carton.lock├── cookbook│ └── hello-world│ ├── README.md│ ├── attributes│ │ └── default.rb│ ├── metadata.rb│ └── recipes│ └── default.rb└── lib └── ZZZ └── Hello └── World.pm

Page 82: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

$ tree.├── Changes├── Makefile.PL├── app.psgi├── carton.lock├── cookbook│ └── hello-world│ ├── README.md│ ├── attributes│ │ └── default.rb│ ├── metadata.rb│ └── recipes│ └── default.rb└── lib └── ZZZ └── Hello └── World.pm

Page 83: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

include_recipe 'carton'

package 'git-core'

git node['hello-world']['deploy_dir'] do repository node['hello-world']['deploy_repo'] reference node['hello-world']['deploy_tag'] notifies :restart, "carton_app[hello-world]"end

carton_app "hello-world" do perlbrew node['hello-world']['perl_version'] command "starman -p #{node['hello-world']['port']} app.psgi" cwd node['hello-world']['deploy_dir'] user node['hello-world']['user'] group node['hello-world']['group']end

carton_app "hello-world" do action :startend

Page 84: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

include_recipe 'carton'

package 'git-core'

git node['hello-world']['deploy_dir'] do repository node['hello-world']['deploy_repo'] reference node['hello-world']['deploy_tag'] notifies :restart, "carton_app[hello-world]"end

carton_app "hello-world" do perlbrew node['hello-world']['perl_version'] command "starman -p #{node['hello-world']['port']} app.psgi" cwd node['hello-world']['deploy_dir'] user node['hello-world']['user'] group node['hello-world']['group']end

carton_app "hello-world" do action :startend

Page 85: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

include_recipe 'carton'

package 'git-core'

git node['hello-world']['deploy_dir'] do repository node['hello-world']['deploy_repo'] reference node['hello-world']['deploy_tag'] notifies :restart, "carton_app[hello-world]"end

carton_app "hello-world" do perlbrew node['hello-world']['perl_version'] command "starman -p #{node['hello-world']['port']} app.psgi" cwd node['hello-world']['deploy_dir'] user node['hello-world']['user'] group node['hello-world']['group']end

carton_app "hello-world" do action :startend

Page 86: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

include_recipe 'carton'

package 'git-core'

git node['hello-world']['deploy_dir'] do repository node['hello-world']['deploy_repo'] reference node['hello-world']['deploy_tag'] notifies :restart, "carton_app[hello-world]"end

carton_app "hello-world" do perlbrew node['hello-world']['perl_version'] command "starman -p #{node['hello-world']['port']} app.psgi" cwd node['hello-world']['deploy_dir'] user node['hello-world']['user'] group node['hello-world']['group']end

carton_app "hello-world" do action :startend

Page 87: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

include_recipe 'carton'

package 'git-core'

git node['hello-world']['deploy_dir'] do repository node['hello-world']['deploy_repo'] reference node['hello-world']['deploy_tag'] notifies :restart, "carton_app[hello-world]"end

carton_app "hello-world" do perlbrew node['hello-world']['perl_version'] command "starman -p #{node['hello-world']['port']} app.psgi" cwd node['hello-world']['deploy_dir'] user node['hello-world']['user'] group node['hello-world']['group']end

carton_app "hello-world" do action :startend

Page 88: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Enough code... let's make it work

Page 89: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

1. Set up a Vagrant virtual machine

2. Prepare Pantry

3. Get Hello World cookbook anddependencies

4. Configure Chef for Hello World

5. Deploy

Page 90: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

1. Set up a Vagrant virtual machine

2. Prepare Pantry

3. Get Hello World cookbook anddependencies

4. Configure Chef for Hello World

5. Deploy

Page 91: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Vagrant is a tool for managing virtual machines

Page 92: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Vagrant is a tool for managing virtual machines

“Can I have a VirtualBox now, please?”

Page 93: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Vagrant is a tool for managing virtual machines

$ vagrant box add base \ http://files.vagrantup.com/lucid32.box

$ vagrant init

$ vagrant up

Page 94: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Chef brings a machine to a target state

Page 95: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Chef does pull

Chef Solo does push

Page 96: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2
Page 97: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Pantry is a tool for driving Chef Solo

Page 98: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Pantry is a tool for driving Chef Solo

$ pantry create node server.example.com

$ pantry apply node server.example.com \ --role web --recipe myapp

$ pantry sync node server.example.com

Page 99: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Finally, the demonstration...

http://goo.gl/LH4Hh

(Recorded live)

Page 100: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

You can do this, too

Page 101: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Don't be afraid. Try it out. Get involved.

Page 102: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

New!

[email protected]

Page 103: Cooking Perl with Chef - David Golden · 2018. 7. 20. · App = Perl + CPAN + your code CHI DateTime DBI JSON Moose Plack POE Try::Tiny... v1.0.0 v5.14.2

Thank you

www.bunchmail.com