opscode-cookbooks/postgresql — pull request #32 by davidc-donorschoose (2013-01-07 06:41:06+00:00)
Title: [COOK-2051] Improve PostgreSQL 9.x install, better support redhat platform family and restore postgresql.conf commentary

A few improvements to the existing cookbook. There should be no change in functionality with these changes, but there are some very nice-to-have additions:

(1) Careful about Debian minor version numbers. The current Debian stable version is 6.0.6, so testing "when node['platform_version'].to_f == 6.0" is probably incorrect. I believe it is safer to use tests such as "when node['platform_version'].to_f < 7.0" in a chain of debian version tests.

(2) Restored helpful commentary to the postgresql.conf template, still using the key in node['postgresql']['config'] attributes as before. This will be very helpful with supporting the postgresql-9.X releases from the same unified templates. Note that I also added <% if node['postgresql']['version'].to_f < 8.4 -%> blocks to wrap new/old/modified postgresql.conf parameter changes. This file is fairly stable between releases, but it's not static. There are some bigger changes coming with 9.X.

(3) Optional postgresql::config recipe to install useful administration tools to support postgresql::server. This is the contrib directory of the PostgreSQL distribution, and it is maintained by the same development team as the PostgreSQL server. These include porting tools, analysis utilities, and plug-in features that are not part of the core PostgreSQL system, but that database engineers often require. Some (like pgbench) are executable. Others (like pg_buffercache) are installed into the database. The recipe is almost trivial, and I left it purely optional to include along with postgresql::server if desired.

(4) README.md documentation for optional postgresql::contrib recipe, for how to generate a suitable "encrypted password" for the node['postgresql']['password']['postgres'] attribute, etc. I also cleaned us some of my new code for (1)-(3) above.

(5) Removed obsolete code for installing server_redhat packages with explicit names. I suspect this resulted from a merge accident. This code was originally removed in the 2012-08-06 commit for "[COOK-1532] - specify packages with attributes", but it reappeared in the 2012-11-05 commit for "Support for postgresql 9.0.x on opensuse 11.4". Clearly, the old code badly breaks the redhat family for postgresql-9.X, and since it probably has no effect in opensuse, I just decided to remove it.

(6) PostgreSQL 9.0, 9.1 and 9.2 changes to add/remove/modify parameter commentary. I continued this in the unified postgresql.conf.erb file using <% if ... %> conditionals.

(7) Optional recipe to enable the PGDG yum repo for newer versions of PostgreSQL. This is the same approach used for the PostgreSQL backport PPA repository. (Note yum_pgdg_postgresql.rb is to redhat as ppa_pitti_postgresql.rb is to debian.)

(8) Implemented optional postgresql::default recipe to validates attributes related to installing recent PostgreSQL versions and log chef WARN messages about probable mistakes and fixes. I attempted to present the redhat family (yum_pgdg_postgresql.rb) and the debian family (ppa_pitti_postgresql.rb) correctly, since they use different naming conventions.