Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

postgresql_lwrp (21) Versions 1.1.7

Installs and configures postgresql for clients or servers

Policyfile
Berkshelf
Knife
cookbook 'postgresql_lwrp', '= 1.1.7', :supermarket
cookbook 'postgresql_lwrp', '= 1.1.7'
knife supermarket install postgresql_lwrp
knife supermarket download postgresql_lwrp
README
Dependencies
Changelog
Quality 100%

[Cookbook Version]('http://img.shields.io/cookbook/v/postgresql\_lwrp.svg)
Build Status

Description

This cookbook includes recipes and providers to install and configure postgresql database. This cookbook was tested with Postgresql 9.0, 9.1, 9.2, 9.3. Version 9.0 is supported with limitations: creating users and databases are not working.
Supported platforms: Debian Squeeze/Wheezy and Ubuntu 12.04/14.04.

Changelog

See CHANGELOG.md

Requirements

Postgresql cookbook depends on apt cookbook

Attributes

This cookbook have server and client attribute files.

With client attributes(["postgresql"]["client"]) you can set only postgresql client and library version.

TODO
Server attributes are starting from ["postgresql"]["defaults"] and used as default attributes for postgresql provider. You should not override this defaults, you can pass your settings to provider instead.

Resources/Providers

Resource: default

Actions

  • :create: creates postgresql cluster

Resource parameters

  • cluster_name: name attribute. Cluster name (e.g. main).
  • cluster_version: TODO
  • cookbook: cookbook for templates. Skip this for default templates.
  • cluster_create_options: options for pg_createcluster (only locale related options)
  • configuration: Hash with configuration options for postgresql, see examples.
  • hba_configuration: Array with hba configuration, see examples.
  • ident_configuration: Array with ident configuration, see examples.
  • replication: Hash with replication configuration. See replication example.
  • replication_initial_copy: Boolean. If true pg_basebackup will be exec to make initial replication copy. Default is false.
  • replication_start_slave: Boolean. If true slave cluster will be started after creation. Should be used with replication_initial_copy option. Default false.
  • allow_restart_cluster: Can be first, always or none. Specifies when cluster must restart instead of reload. first – only first time after installation. always – always restart, even if changes doesn't require restart. none - never, use reload every time. Default is none.

Examples

Example master database setup:

postgresql 'main' do
  cluster_version '9.3'
  cluster_create_options( locale: 'ru_RU.UTF-8' )
  configuration(
      listen_addresses:           '192.168.0.2',
      max_connections             300,
      ssl_renegotiation_limit:    0,
      shared_buffers:             '512MB',
      maintenance_work_mem:       '64MB',
      work_mem:                   '8MB',
      log_min_duration_statement: 200
  )
  hba_configuration(
    [
      { type: 'host', database: 'all', user: 'all', address: '192.168.0.0/24', method: 'md5' },
      { type: 'host', database: 'replication', user: 'postgres', address: '192.168.0.3/32', method: 'trust' }
    ]
  )
end

Example slave database setup:

postgresql 'main' do
   cluster_version '9.3'
  cluster_create_options( locale: 'ru_RU.UTF-8' )
  configuration(
      listen_addresses:           '192.168.0.3',
      max_connections             300,
      ssl_renegotiation_limit:    0,
      shared_buffers:             '512MB',
      maintenance_work_mem:       '64MB',
      work_mem:                   '8MB',
      log_min_duration_statement: 200
  )
  hba_configuration(
    [
      { type: 'host', database: 'all', user: 'all', address: '192.168.0.0/24', method: 'md5' },
      { type: 'host', database: 'replication', user: 'postgres', address: '192.168.0.2/32', method: 'trust' }
    ]
  )
  replication(
    standby_mode: 'on',
    primary_conninfo: 'host=192.168.0.1',
    trigger_file: '/tmp/pgtrigger'
  )
  replication_initial_copy true
  replication_start_slave true
end

Example users and databases setup

postgresql_user 'user01' do
  in_version '9.3'
  in_cluster 'main'
  unencrypted_password 'user01password'
end

postgresql_database 'database01' do
  in_version '9.3'
  in_cluster 'main'
  owner 'user01'
end

License and Author

Author:: Nikita Borzykh (nikita@express42.com)

Copyright (C) 2012-2014 LLC Express 42

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.1.7 (Jan 22, 2014)

  • (Fix) Remove wal-e pip attribute
  • (New) Add serverspec tests for cloud backup

1.1.6 (Jan 21, 2014)

  • (New) Use virtualenv for wal-e
  • (New) Add test recipe for cloud backup

1.1.5 (Dec 28, 2014)

  • (Fix) Fix cloud_backup cron script name

1.1.4 (Dec 22, 2014)

  • (Fix) Fix pg version checks

1.1.3 (Dec 22, 2014)

  • (New) ssl key and cert linkage for pg < 9.2

1.1.2 (Dec 22, 2014)

  • (Fix) Fix full_backup_time param

1.1.1 (Dec 18, 2014)

  • (Fix) Fix Test Kitchen boxes
  • (Fix) Fix postgresql start after reboot

1.1.0 (Dec 10, 2014)

  • (New) Add cloud backup lwrp, using wal-e for cloud backup

1.0.1 (Oct 31, 2014)

  • (Fix) Fix broken allow_restart_cluster option

1.0.0 (Aug 25, 2014)

  • (New) Flat configuration file
  • (New) Initial replicaton can be started automatically
  • (New) Option allow_restart_cluster allows do restart instead reload (Only first time or always)
  • (New) Resources/providers for database and user creation
  • (New) Recipe apt_official_repository with official postgresql repository
  • (New) Severspec tests added
  • (Removed) Removed databags for users and databases. You should use appropriate providers
  • (Fix) pg_ident template fixed

0.2.3 (Jun 18, 2013)

Minor fixes

  • Cluster create options were defined as Hash and accessed as Mash.
  • pg_hba.conf became faulty on long db/user names or other line fields.
  • Examples in readme was badly formatted and contained small syntax issues.
  • ssl was hardcoded to postgresql.conf.

0.2.2 (May 8, 2013)

Minor fixes

  • Check cluster_create_options hash for key before accessing it.

0.2.1 (Apr 14, 2013)

Minor fixes

  • Style fixes to satisfy foodcritic wishes

0.2.0 (Apr 14, 2013)

Improvements

  • Set LANG from cluster_create for postgresql package install(used in pg_clustercreate in debian scripts)

Foodcritic Metric
            

1.1.7 passed this metric