David Golden reported:
Current progress
Three of the eight deliverables are complete:
- Publish a Chef cookbook for Perl interpreter deployment
- Publish a Chef cookbook for CPAN module deployment
- Publish a Chef cookbook for Plack application deployment
These have been uploaded to the Opscode Community Cookbooks site in two separate cookbook distributions:
perlbrew
The perlbrew cookbook satisfies deliverables #1 and #2. It provides several "lightweight resource providers" (LWRPs -- a Chef term) that use perlbrew to deliver various automation capabilities:
- perlbrew_perl -- installs a perl from source to a user-configurable directory (by default, "/opt/perlbrew/perls/")
- perlbrew_lib -- establishes a local::lib style directory for use with a particular perlbrew perl
- perlbrew_cpanm -- installs CPAN modules into a perlbrew perl or local::lib
- perlbrew_run -- runs arbitrary bash commands in the context of a particular perlbrew perl or local::lib
For example, this snippet of ruby could be used in a recipe to install a perl, configure a library, install some CPAN modules to the library, and then run a perl command using that perl and library:
include_recipe 'perlbrew'perlbrew_lib 'perl-5.8.9@xdg'
perlbrew_cpanm "Stuff we need" do perlbrew 'perl-5.8.9@xdg' modules ['Data::UUID::MT', 'Data::GUID::Any'] end
perlbrewrun "print a UUID" do perlbrew 'perl-5.8.9@xdg' command "perl -MData::GUID::Any -le 'print Data::GUID::Any::guidas_
string'" end carton
The carton cookbook satisfies deliverable #3. It provides an LWRP called 'carton_app' that uses carton to install application-specific dependencies into a application-local directory and then sets up the application as a system service using runit.
For example, this snippet of ruby could be used in a recipe to launch a carton-based application from a deployment directory. Note that most of the application-specific attributes are parameterized using Chef's 'node' data structure for each deployment node, making it easy to change how the application is deployed to different servers:
include_recipe 'carton'cartonapp "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 :start end
Current work and next steps
I have started refactoring the initial draft of pantry to make it easier to configure nodes without requiring users to edit JSON directly (deliverable #4). This will let me streamline the tutorials and help users following the tutorial to avoid introducing JSON errors and getting stuck.
Next month I expect to finish and publish the hello-world tutorial (deliverable #5) and have a (rough) draft of the "real world" tutorial (deliverable #6).
I was pleased to hear that my OSCON proposal was accepted and my Cooking Perl with Chef talk will be on Thursday, July 19. That presentation will satisfy deliverable #7 (though I may deliver a draft early as a test run). If I find out that my OSCON session will be videotaped, I'll use that as the video tutorial (deliverable #8). If not, I'll prepare a separate screen cast. (I may do both and use the short screencast as part of the talk to avoid the risk of a live demo.)


Leave a comment