cookbook 'pgbouncer', '~> 1.0.0'
pgbouncer (1) Versions 1.0.0 Follow2
Installs/Configures pgbouncer
cookbook 'pgbouncer', '~> 1.0.0', :supermarket
knife supermarket install pgbouncer
knife supermarket download pgbouncer
PGBouncer Cookbook
This cookbook provides a Chef LWRP that sets up
a basic PGBouncer connection pool that
fronts a Postgresql database. It has example configuration for integration on client machines,
exposing a local *nix socket that routes to a downstream database on another host.
Requirements
Chef 0.7+
Platform
Tested:
* Ubuntu
Untested:
* Debian (should work)
* RHEL, Centos, etc
Dependencies
'apt' cookbook
Resources/Providers
This cookbook exposes a single resource/provider pair, referred as pgbouncer_connection
. A basic
example of its use can be found in recipes/example.rb
, and is outlined below.
pgbouncer_connection
Sets up an Upstart service for pgbouncer against a single database alias, then starts the service.
Multiple aliases may be supported on a single host.
Actions
- :setup: configure a pgbouncer service for the specified database alias (default action)
- :start: start the configured pgbouncer service
- :stop: stop the configured pgbouncer service
- :teardown: delete the configuration (FIXME: may not be comprehensive)
Examples
# setup and start a read-only connection pool
pgbouncer_connection "database_example_com_ro" do
db_host "database.example.com"
db_port "6432"
db_name "test_database"
userlist "readonly_user" => "md500000000000000000000000000000000"
max_client_conn 100
default_pool_size 20
action [:setup, :start]
end
# setup and start a read-write connection pool
pgbouncer_connection "database_example_com_rw" do
db_host "database.example.com"
db_port "6432"
db_name "test_database"
userlist "readwrite_user" => "md500000000000000000000000000000000", "readonly_user" => "md500000000000000000000000000000000"
max_client_conn 100
default_pool_size 20
action [:setup, :start]
end
# stop a connection pool
pgbouncer_connection "database_example_com_ro" do
action :stop
end
# TODO: include more examples
Recipes
default
Empty: this is a resource-only cookbook
example
Example of how to use the resource; also exercised in the spec/ tests
Testing
This cookbook has been "Tested in Production"™, but also has some basic RSpec tests.
NOTE: because Chef 10 has cookbook naming expectations, the root repo expects to be in a folder
named 'pgbouncer'.
bundle install
bundle exec rake spec
The cookbook is clean under FoodCritic.
bundle install
bundle exec rake foodcritic
To see the installation end to end, we've also got a rake task that spins up a chef-zero
local instance, uploads the cookbooks via berkshelf, and spins up a vagrant instance that pulls the data down. This is using a new
Vagrant plugin, created here at Whitepages, called vagrant-chefzero.
vagrant plugin install vagrant-chefzero
bundle install
bundle exec rake vagrant_startup
License and Author(s)
- Author:: Owyn Richen (orichen@whitepages.com)
- Author:: Jack Foy (jfoy@whitepages.com)
- Author:: Paul Kohan (pkohan@whitepages.com)
- Author:: Brian Engelman (bengelman@whitepages.com)
Copyright 2010-2013, Whitepages Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
1.0.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.0.0 failed this metric
FC064: Ensure issues_url is set in metadata: pgbouncer/metadata.rb:1
FC065: Ensure source_url is set in metadata: pgbouncer/metadata.rb:1
FC066: Ensure chef_version is set in metadata: pgbouncer/metadata.rb:1
FC069: Ensure standardized license defined in metadata: pgbouncer/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: pgbouncer/providers/connection.rb:128
FC085: Resource using new_resource.updated_by_last_action to converge resource: pgbouncer/providers/connection.rb:143
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.0 failed this metric
Failure: Cookbook should not contain binaries. Found:
pgbouncer/test/Berksfile
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.0 failed this metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.0.0 failed this metric
FC064: Ensure issues_url is set in metadata: pgbouncer/metadata.rb:1
FC065: Ensure source_url is set in metadata: pgbouncer/metadata.rb:1
FC066: Ensure chef_version is set in metadata: pgbouncer/metadata.rb:1
FC069: Ensure standardized license defined in metadata: pgbouncer/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: pgbouncer/providers/connection.rb:128
FC085: Resource using new_resource.updated_by_last_action to converge resource: pgbouncer/providers/connection.rb:143
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.0.0 failed this metric
Failure: Cookbook should not contain binaries. Found:
pgbouncer/test/Berksfile
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.0 failed this metric
FC065: Ensure source_url is set in metadata: pgbouncer/metadata.rb:1
FC066: Ensure chef_version is set in metadata: pgbouncer/metadata.rb:1
FC069: Ensure standardized license defined in metadata: pgbouncer/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: pgbouncer/providers/connection.rb:128
FC085: Resource using new_resource.updated_by_last_action to converge resource: pgbouncer/providers/connection.rb:143
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
1.0.0 failed this metric
Failure: Cookbook should not contain binaries. Found:
pgbouncer/test/Berksfile
Testing File Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.0.0 failed this metric
1.0.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number