GithubHelp home page GithubHelp logo

isabella232 / chef-pgbouncer-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kigster/cookbook-pgbouncer-service

0.0 0.0 0.0 32 KB

Installs pgBouncer from either sources or packages, configures the connections, and sets up a service.

Ruby 54.94% HTML 45.06%

chef-pgbouncer-service's Introduction

Description

This cookbook installs and configures pgbouncer on a ubuntu/debian system.

Requirements

Cookbooks:

This cookbook doesn't have direct dependencies on other cookbooks. Depending on your OS configuration and security policy, you may need additional recipes or cookbooks for this cookbook's recipes to converge on the node. In particular, the following Operating System nuances may affect the behavior:

  • apt cache outdated

On Ubuntu/Debian, use Opscode's apt cookbook to ensure the package cache is updated so Chef can install packages, or consider putting apt-get in your bootstrap process or knife bootstrap template.

Platforms:

Tested on Ubuntu 10.04. Uses the pgbouncer init script.

  • Debian
  • Ubuntu

Attributes

This cookbook uses many attributes, broken up into a few different kinds.

  • node['pgbouncer']['databases'] - dictionary consisting of database names with connection info, default {}
  • node['pgbouncer']['userlist'] - dictionary consisting of usernames with passwords, used in the userlist.txt file, default {}

Administrative settings

  • node['pgbouncer']['logfile'] - location of pgbouncer logfile, default "/var/log/postgresql/pgbouncer.log"
  • node['pgbouncer']['pidfile'] - location of pgbouncer pidfile, default "/var/run/postgresql/pgbouncer.pid"

Where to wait for clients

  • node['pgbouncer']['listen_addr'] - ip address or * which means all ip-s, default "127.0.0.1"
  • node['pgbouncer']['listen_port'] - accept connections on the specified port, default "6432"
  • node['pgbouncer']['unix_socket_dir'] - dir for the unix socket that will be used to listen for incoming connections, default "/var/run/postgresql"

Authentication settings

  • node['pgbouncer']['auth_type'] - authentication type, default => "trust"
  • node['pgbouncer']['auth_file'] - location of pgbouncer userlist.txt file, default "/etc/pgbouncer/userlist.txt"

Users allowed into database 'pgbouncer'

  • node['pgbouncer']['admin_users'] - comma-separated list of users, who are allowed to change settings, default ""
  • node['pgbouncer']['stats_users'] - comma-separated list of users who are just allowed to use SHOW command, default ""

Pooler personality questions

  • node['pgbouncer']['pool_mode'] - when server connection is released back to pool, default "session"
  • node['pgbouncer']['server_reset_query'] - query for cleaning connection immediately after releasing from client, default ""
  • node['pgbouncer']['server_check_query'] - when taking idle server into use, this query is ran first, default "select 1"
  • node['pgbouncer']['server_check_delay'] - if server was used more recently that this many seconds ago, skip the check query. Value 0 may or may not run in immediately, default "10"

Connection limits

  • node['pgbouncer']['max_client_conn'] - total number of clients that can connect, default "100"
  • node['pgbouncer']['default_pool_size'] - default pool size, default "20"
  • node['pgbouncer']['log_connections'] - log connections, default "1"
  • node['pgbouncer']['log_disconnections'] - log disconnections, default "1"
  • node['pgbouncer']['log_pooler_errors'] - log error messages pooler sends to clients, default "1"

Usage

Using this cookbook is pretty straightforward. Add the desired recipes to the run list of a node, or create a role. Adjust any attributes as desired. For example, to create a basic connection pooler role for PostgreSQL databases:

% cat roles/connection_pooler.rb
name "connection pooler"
description "Lightweight connection pooler for PostgreSQL."
run_list("recipe[pgbouncer]")
override_attributes(
  "pgbouncer" => {
    "databases" => {
      "pgbouncer_db_name1" => "host=127.0.0.1 port=5432 dbname=postgres_db_name1",
      "pgbouncer_db_name2" => "host=127.0.0.1 port=5432 dbname=postgres_db_name2"
    },
    "userlist" => {
      "username1" => "secret_password1",
      "username2" => "secret_password2"
    }
  }
)

Maintainer

Konstantin Gredeskoul is the current maintainer of this cookbook.

Find me on Twitter as @kig and my blog.

Acknowledgements

chef-pgbouncer-service's People

Contributors

dud225 avatar kigster avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.