Permalink
Browse files

added support for postgres 9.1 extensions

  • Loading branch information...
1 parent 74cc5ee commit 7571c4b94b21384b1b88212145bb7dc751dc7803 Ines Sombra committed Feb 2, 2012
Showing with 185 additions and 76 deletions.
  1. +7 −6 cookbooks/main/recipes/default.rb
  2. +0 −2 cookbooks/postgresql9_contrib/attributes/recipe.rb
  3. +0 −8 cookbooks/postgresql9_contrib/definitions/load_shared_library.rb
  4. +0 −8 cookbooks/postgresql9_contrib/definitions/load_sql_file.rb
  5. +0 −20 cookbooks/postgresql9_contrib/definitions/postgis.rb
  6. +49 −4 cookbooks/{postgresql9_contrib → postgresql9_extensions}/README.md
  7. +8 −0 cookbooks/postgresql9_extensions/attributes/recipe.rb
  8. +2 −2 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/auto_explain.rb
  9. +11 −0 cookbooks/postgresql9_extensions/definitions/btree_gin.rb
  10. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/chkpass.rb
  11. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/citext.rb
  12. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/cube.rb
  13. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/dblink.rb
  14. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/earthdistance.rb
  15. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/fuzzystrmatch.rb
  16. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/hstore.rb
  17. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/intagg.rb
  18. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/isn.rb
  19. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/lo.rb
  20. +19 −0 cookbooks/postgresql9_extensions/definitions/load_shared_library.rb
  21. +17 −0 cookbooks/postgresql9_extensions/definitions/load_sql_file.rb
  22. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/ltree.rb
  23. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/pg_buffercache.rb
  24. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/pg_freespacemap.rb
  25. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/pg_trgm.rb
  26. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/pgcrypto.rb
  27. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/pgrowlocks.rb
  28. +23 −0 cookbooks/postgresql9_extensions/definitions/postgis.rb
  29. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/seg.rb
  30. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/tablefunc.rb
  31. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/unaccent.rb
  32. +2 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/definitions/uuid-ossp.rb
  33. +8 −5 cookbooks/{postgresql9_contrib → postgresql9_extensions}/recipes/ext_autoexplain.rb
  34. 0 cookbooks/{postgresql9_contrib → postgresql9_extensions}/recipes/ext_postgis_install.rb
  35. 0 cookbooks/{postgresql9_contrib → postgresql9_extensions}/templates/default/custom.erb
  36. +1 −1 cookbooks/{postgresql9_contrib → postgresql9_extensions}/templates/default/custom_autoexplain.erb
@@ -38,10 +38,10 @@
#require_recipe "mongodb"
#uncomment to run the resque recipe
-require_recipe "resque"
+# require_recipe "resque"
#uncomment to run the resque-scheduler recipe
-require_recipe "resque-scheduler"
+# require_recipe "resque-scheduler"
#uncomment to run the redis recipe
#require_recipe "redis"
@@ -79,10 +79,11 @@
#uncomment to include the newrelic_server_monitoring recipe
#require_recipe "newrelic_server_monitoring"
-#enable contrib modules for a given Postgresql9 database
-#if ['solo','db_master', 'db_slave'].include?(node[:instance_role])
+#enable contrib modules for a given Postgresql database
+if ['solo','db_master', 'db_slave'].include?(node[:instance_role])
# postgresql9_autoexplain "dbname"
- # postgresql9_chkpass "dbname"
+ # postgresql9_btree_gin "todosinatra"
+ postgresql9_chkpass "todosinatra"
# postgresql9_citext "dbname"
# postgresql9_cube "dbname"
# postgresql9_dblink "dbname"
@@ -107,4 +108,4 @@
# postgresql9_pg_buffercache "postgres"
# postgresql9_pg_freespacemap "postgres"
-#end
+end
@@ -1,2 +0,0 @@
-postgres_version("9.0")
-postgres_root("/db/postgresql/")
@@ -1,8 +0,0 @@
-define :load_shared_library, :db_name => nil, :library_name => nil do
- library_name = params[:library_name]
- db_name = params[:db_name]
-
- execute "Postgresql loading library #{library_name}" do
- command "psql -U postgres -d #{db_name} -c \"LOAD \'#{library_name}\'\";"
- end
-end
@@ -1,8 +0,0 @@
-define :load_sql_file, :db_name => nil, :filename => nil do
- db_name = params[:db_name]
- filename = params[:filename]
-
- execute "Postgresql loading file #{filename} on database #{db_name}" do
- command "psql -U postgres -d #{db_name} -f #{filename}"
- end
-end
@@ -1,20 +0,0 @@
-define :postgresql9_postgis do
- include_recipe "postgresql9_contrib::ext_postgis_install"
- dbname_to_use = params[:name]
-
- load_sql_file do
- db_name dbname_to_use
- filename "/usr/share/postgresql-9.0/contrib/postgis-1.5/postgis.sql"
- end
-
- load_sql_file do
- db_name dbname_to_use
- filename "/usr/share/postgresql-9.0/contrib/postgis-1.5/spatial_ref_sys.sql"
- end
-
- load_sql_file do
- db_name dbname_to_use
- filename"/usr/share/postgresql-9.0/contrib/postgis-1.5/postgis_comments.sql"
- end
-
-end
@@ -1,20 +1,21 @@
-ey-cloud-recipes/postgresql9_contrib
+ey-cloud-recipes/postgresql9_extensions
------------------------------------------------------------------------------
-A chef recipe for enabling Postgres contrib packages on Engine Yard AppCloud. This recipe defines multiple methods that
+A chef recipe for enabling Postgres extensions (contribs on Postgres 9.0) packages on Engine Yard AppCloud. This recipe defines multiple methods that
can be called from main/recipes/default.rb to enable extensions for a given database.
Dependencies
--------------------------
-You need to have a running Postgres 9 instance to apply these recipes.
+You need to have a running Postgres 9.0.x or Postgres 9.1.x instance to apply these recipes.
Available Extensions
--------------------------
-At the moment the following extensions are available. See http://www.postgresql.org/docs/9.0/static/contrib.html for more information.
+At the moment the following extensions are available.
##auto_explain
+###supported versions: 9.0, 9.1
This extension provides a means for logging execution plans of slow statements automatically, without having to run EXPLAIN by hand.
This is especially helpful for tracking down un-optimized queries in large applications.
WARNING: Enabling this extension will restart your Postgres service.
@@ -26,8 +27,33 @@ extension applied to.
``postgresql9_autoexplain "dbname""``
+##btree_gin
+###supported versions: 9.0, 9.1
+This extension provides support for indexing common datatypes in GIN
+
+Enabling this extension:
+
+* Edit main/recipes/default.rb and comment out the line shown below. Replace dbname with the name of the database you want this
+extension applied to.
+
+``postgresql9_btree_gin "dbname""``
+
+
+##btree_gist
+###supported versions: 9.1
+support for indexing common datatypes in GiST
+
+
+Enabling this extension:
+
+* Edit main/recipes/default.rb and comment out the line shown below. Replace dbname with the name of the database you want this
+extension applied to.
+
+``postgresql9_chkpass "dbname""``
+
##chkpass
+###supported versions: 9.0
This extension implements a data type chkpass that is designed for storing encrypted passwords. Each password is automatically converted
to encrypted form upon entry, and is always stored encrypted.
@@ -40,6 +66,7 @@ extension applied to.
##citext
+###supported versions: 9.0
The citext module provides a case-insensitive character string type, citext. Essentially, it internally calls lower when comparing values.
Otherwise, it behaves almost exactly like text. (This is great for MySQL compatibility which does text comparisons case-insensitive, by default)
@@ -52,6 +79,7 @@ extension applied to.
##cube
+###supported versions: 9.0
This module implements a data type cube for representing multidimensional cubes.
Enabling this extension:
@@ -63,6 +91,7 @@ extension applied to.
##dblink
+###supported versions: 9.0
dblink is a module which supports connections to other PostgreSQL databases from within a database session.
Enabling this extension:
@@ -74,6 +103,7 @@ extension applied to.
##earthdistance
+###supported versions: 9.0
The earthdistance module provides two different approaches to calculating great circle distances on the surface of the Earth.
Enabling this extension:
@@ -85,6 +115,7 @@ extension applied to.
##fuzzystrmatch
+###supported versions: 9.0
The fuzzystrmatch module provides several functions to determine similarities and distance between strings.
Enabling this extension:
@@ -96,6 +127,7 @@ extension applied to.
##hstore
+###supported versions: 9.0
This module implements the hstore data type for storing sets of key/value pairs within a single PostgreSQL value. This can be useful
in various scenarios, such as rows with many attributes that are rarely examined, or semi-structured data. Keys and values are simply
text strings.
@@ -109,6 +141,7 @@ extension applied to.
##intagg
+###supported versions: 9.0
The intarray module provides a number of useful functions and operators for manipulating one-dimensional arrays of integers. There is
also support for indexed searches using some of the operators.
@@ -121,6 +154,7 @@ extension applied to.
##isn
+###supported versions: 9.0
The isn module provides data types for the following international product numbering standards: EAN13, UPC, ISBN (books), ISMN (music),
and ISSN (serials). Numbers are validated on input, and correctly hyphenated on output.
@@ -133,6 +167,7 @@ extension applied to.
##lo
+###supported versions: 9.0
The lo module provides support for managing Large Objects (also called LOs or BLOBs). This includes a data type lo and a trigger lo_manage.
Enabling this extension:
@@ -144,6 +179,7 @@ extension applied to.
##ltree
+###supported versions: 9.0
This module implements a data type ltree for representing labels of data stored in a hierarchical tree-like structure. Extensive facilities
for searching through label trees are provided.
@@ -156,6 +192,7 @@ extension applied to.
##pgcrypto
+###supported versions: 9.0
The pgcrypto module provides cryptographic functions for PostgreSQL.
Enabling this extension:
@@ -167,6 +204,7 @@ extension applied to.
##pgrowlocks
+###supported versions: 9.0
The pgrowlocks module provides a function to show row locking information for a specified table.
Enabling this extension:
@@ -178,6 +216,7 @@ extension applied to.
##PostGIS
+###supported versions: 9.0
This extension adds support for geographic objects. PostGIS "spatially enables" the PostgreSQL server, allowing it to be used as a backend
spatial database for geographic information systems (GIS).
@@ -190,6 +229,7 @@ extension applied to.
##seg
+###supported versions: 9.0
This module implements a data type seg for representing line segments, or floating point intervals. seg can represent uncertainty in the
interval endpoints, making it especially useful for representing laboratory measurements.
@@ -202,6 +242,7 @@ extension applied to.
##tablefunc
+###supported versions: 9.0
The tablefunc module includes various functions that return tables (that is, multiple rows). These functions are useful both in their own
right and as examples of how to write C functions that return multiple rows.
@@ -214,6 +255,7 @@ extension applied to.
##unaccent
+###supported versions: 9.0
unaccent is a text search dictionary that removes accents (diacritic signs) from lexemes. It's a filtering dictionary, which means its output
is always passed to the next dictionary (if any), unlike the normal behavior of dictionaries. This allows accent-insensitive processing for
full text search.
@@ -227,6 +269,7 @@ extension applied to.
##uuid-ossp
+###supported versions: 9.0
The uuid-ossp module provides functions to generate universally unique identifiers (UUIDs) using one of several standard algorithms. There are
also functions to produce certain special UUID constants. (This also requires a separate USE flag when building the postgres binaries that pulls
in another package.)
@@ -244,6 +287,7 @@ Admin-level Contrib packages
Notes: This module requires a privileged user. Please log in as the postgres user to use the extension
##pg_buffercache
+###supported versions: 9.0
The pg_buffercache module provides a means for examining what's happening in the shared buffer cache in real time.
Enabling this Module:
@@ -254,6 +298,7 @@ Enabling this Module:
##pg_freespacemap
+###supported versions: 9.0
The pg_freespacemap module provides a means for examining the free space map (FSM). It provides a function called pg_freespace,
or two overloaded functions, to be precise. The functions show the value recorded in the free space map for a given page, or for all
pages in the relation.
@@ -0,0 +1,8 @@
+# Chef::Log.info "stack chosen: #{@attribute['engineyard']['environment']['db_stack_name']}"
+db_stack(@attribute['engineyard']['environment']['db_stack_name'])
+if db_stack == "postgres9"
+ postgres_version("9.0")
+elsif db_stack == "postgres9_1"
+ postgres_version("9.1")
+end
+postgres_root("/db/postgresql/")
@@ -1,13 +1,13 @@
define :postgresql9_autoexplain do
dbname_to_use = params[:name]
- Chef::Log.info "db: #{dbname_to_use}"
load_shared_library do
db_name dbname_to_use
library_name "auto_explain"
+ supported_versions %w[9.0 9.1]
end
- include_recipe "postgresql9_contrib::ext_autoexplain"
+ include_recipe "postgresql9_extensions::ext_autoexplain"
end
@@ -0,0 +1,11 @@
+define :postgresql9_btree_gin do
+ dbname_to_use = params[:name]
+
+ load_sql_file do
+ db_name dbname_to_use
+ username "postgres"
+ extname "btree_gin"
+ supported_versions %w[9.0 9.1]
+ end
+
+end
@@ -4,7 +4,8 @@
load_sql_file do
db_name dbname_to_use
username "postgres"
- filename "/usr/share/postgresql-9.0/contrib/chkpass.sql"
+ extname "chkpass"
+ supported_versions %w[9.0 9.1]
end
end
@@ -3,7 +3,8 @@
load_sql_file do
db_name dbname_to_use
- filename "/usr/share/postgresql-9.0/contrib/citext.sql"
+ extname "citext"
+ supported_versions %w[9.0]
end
end
@@ -3,7 +3,8 @@
load_sql_file do
db_name dbname_to_use
- filename "/usr/share/postgresql-9.0/contrib/cube.sql"
+ extname "cube"
+ supported_versions %w[9.0]
end
end
@@ -3,7 +3,8 @@
load_sql_file do
db_name dbname_to_use
- filename "/usr/share/postgresql-9.0/contrib/dblink.sql"
+ extname "dblink"
+ supported_versions %w[9.0]
end
end
@@ -3,7 +3,8 @@
load_sql_file do
db_name dbname_to_use
- filename "/usr/share/postgresql-9.0/contrib/earthdistance.sql"
+ extname "earthdistance"
+ supported_versions %w[9.0]
end
end
@@ -3,7 +3,8 @@
load_sql_file do
db_name dbname_to_use
- filename "/usr/share/postgresql-9.0/contrib/fuzzystrmatch.sql"
+ extname "fuzzystrmatch"
+ supported_versions %w[9.0]
end
end
Oops, something went wrong.

0 comments on commit 7571c4b

Please sign in to comment.