On Thursday, September 27, 2012 11:56:28 AM UTC-5, Jeremy wrote:
>
> I've got a puppet module I've written to support deploying a custom PHP 
> web application that a client has developed. The actual application and the 
> fact that it's deployed within AWS is not the problem or important to the 
> issue. I'm looking to see if I someone else can think of a better way to 
> implement what I have done that is more efficient and improve the catalog 
> rendering time.
>
> I've placed the module into a GitHub repository at (
> https://github.com/jbouse/puppet-app1). The app is deployed based on the 
> contents of a YAML file that is retrieved by the class. Initially deploying 
> the sites defined was not an issue and was actually very fast. The problems 
> got introduced in handling the dependent components as defined in the YAML 
> file. I wrote several parser functions in an effort to identify only the 
> unique components and versions needed and generate titles that would not 
> conflict. I fully admit and consider what I've done a hack and I'm really 
> open to hearing some suggestions on how to make it less of one.
>


I have been looking over your module, and so far I don't see any smoking 
gun that would clearly explain why catalog compilation takes so long, but I 
do have a guess (see below).  The code seems generally clean, 
well-organized, and nicely documented, but perhaps I have a few comments 
that perhaps you will find helpful.  In no particular order:

   - You use a lot of constructs of this form: "$somedir = inline_template("<%= 
   File.join('${parent}', 'foo') %>")".  That's a lot uglier and heavier 
   than "$somedir = "${parent}/foo", and it gains you nothing: the template is 
   always going to be evaluated on the master, which cannot run on Windows, so 
   the file separator is always going to be '/'.
   - It is harmless, but unnecessary, for a File to explicitly 'require' 
   other File resources representing its parent or other ancestor directory.  
   Puppet will generate these relationships automatically if you do not 
   specify them explicitly.
   - You evidently have a separate module "common" containing a definition 
   named "common::archive::tar-gz".  Names in your Puppet manifests should 
   not contain the hyphen (-) -- it works in some places, in some versions, 
   but not in others.  You would be wise to avoid it altogether, perhaps by 
   replacing it with an underscore (_).
   - If there is one thing to be most suspicious of, it would be your 
   app1_deployment function's use of "YAML.load(open(args[0]))".  Some of 
   the other code in your module leads me to suspect that the file it's 
   opening may not be local.  (And if it were local, then you would probably 
   just put the data in the hiera store you are using for other data.)  If you 
   are indeed retrieving that file over the network then the time to do so 
   could easily dominate your compilation times, and network slowness or 
   outage could make your compilations timeout or simply fail.
   

Good luck,

John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/qNcvib6HNMUJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to