server_maint 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/.gitmodules +3 -0
  2. data/lib/cookbooks/postgresql/.gitignore +7 -0
  3. data/lib/cookbooks/postgresql/.ruby-version +1 -0
  4. data/lib/cookbooks/postgresql/LICENSE.txt +20 -0
  5. data/lib/cookbooks/postgresql/README.md +588 -0
  6. data/lib/cookbooks/postgresql/Rakefile +35 -0
  7. data/lib/cookbooks/postgresql/attributes/default.rb +365 -0
  8. data/lib/cookbooks/postgresql/definitions/pg_database.rb +61 -0
  9. data/lib/cookbooks/postgresql/definitions/pg_database_extensions.rb +67 -0
  10. data/lib/cookbooks/postgresql/definitions/pg_user.rb +45 -0
  11. data/lib/cookbooks/postgresql/files/default/pgdg.pref +3 -0
  12. data/lib/cookbooks/postgresql/metadata.rb +22 -0
  13. data/lib/cookbooks/postgresql/recipes/client.rb +8 -0
  14. data/lib/cookbooks/postgresql/recipes/contrib.rb +8 -0
  15. data/lib/cookbooks/postgresql/recipes/dbg.rb +8 -0
  16. data/lib/cookbooks/postgresql/recipes/default.rb +50 -0
  17. data/lib/cookbooks/postgresql/recipes/doc.rb +8 -0
  18. data/lib/cookbooks/postgresql/recipes/libpq.rb +9 -0
  19. data/lib/cookbooks/postgresql/recipes/postgis.rb +8 -0
  20. data/lib/cookbooks/postgresql/recipes/server.rb +118 -0
  21. data/lib/cookbooks/postgresql/templates/default/environment.erb +11 -0
  22. data/lib/cookbooks/postgresql/templates/default/pg_ctl.conf.erb +5 -0
  23. data/lib/cookbooks/postgresql/templates/default/pg_hba.conf.erb +100 -0
  24. data/lib/cookbooks/postgresql/templates/default/pg_ident.conf.erb +46 -0
  25. data/lib/cookbooks/postgresql/templates/default/postgresql.conf.custom.erb +10 -0
  26. data/lib/cookbooks/postgresql/templates/default/postgresql.conf.standard.erb +558 -0
  27. data/lib/cookbooks/postgresql/templates/default/start.conf.erb +9 -0
  28. data/lib/cookbooks/postgresql/test/.chef/knife.rb +2 -0
  29. data/lib/cookbooks/postgresql/test/support/Gemfile +5 -0
  30. data/lib/server_maint/version.rb +1 -1
  31. metadata +32 -4
data/.gitmodules CHANGED
@@ -46,3 +46,6 @@
46
46
  [submodule "lib/cookbooks/openssl"]
47
47
  path = lib/cookbooks/openssl
48
48
  url = git://github.com/opscode-cookbooks/openssl.git
49
+ [submodule "lib/cookbooks/postgresql"]
50
+ path = lib/cookbooks/postgresql
51
+ url = git://github.com/phlipper/chef-postgresql.git
@@ -0,0 +1,7 @@
1
+ *.tgz
2
+ *.tar.gz
3
+ vendor/bundle
4
+ .bundle
5
+ .DS_Store
6
+ build/*
7
+ tmp/
@@ -0,0 +1 @@
1
+ 1.9.3@chef-postgresql
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright © 2012-2013 Phil Cohen <github@phlippers.net>
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the “Software”), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
@@ -0,0 +1,588 @@
1
+ # chef-postgresql
2
+
3
+ ## Description
4
+
5
+ Installs [PostgreSQL](http://www.postgresql.org), The world's most advanced open source database.
6
+
7
+ This installs postgres 9.x from the [PostgreSQL backports for stable Ubuntu releases](https://launchpad.net/~pitti/+archive/postgresql).
8
+
9
+ Currently supported versions:
10
+
11
+ * `9.0`
12
+ * `9.1`
13
+ * `9.2`
14
+
15
+ The default version is `9.2`.
16
+
17
+ ## Requirements
18
+
19
+ ### Supported Platforms
20
+
21
+ The following platforms are supported by this cookbook, meaning that the recipes run on these platforms without error:
22
+
23
+ * Ubuntu
24
+ * Debian 6
25
+
26
+
27
+ ## Recipes
28
+
29
+ * `postgresql` - Set up the apt repository and install dependent packages
30
+ * `postgresql::client` - Front-end programs for PostgreSQL 9.x
31
+ * `postgresql::server` - Object-relational SQL database, version 9.x server
32
+ * `postgresql::contrib` - Additional facilities for PostgreSQL
33
+ * `postgresql::dbg` - Debug symbols for the server daemon
34
+ * `postgresql::doc` - Documentation for the PostgreSQL database management system
35
+ * `postgresql::libpq` - PostgreSQL C client library and header files for libpq5 (PostgreSQL library)
36
+ * `postgresql::postgis` - Geographic objects support for PostgreSQL 9.x
37
+
38
+
39
+ ## Usage
40
+
41
+ This cookbook installs the postgresql components if not present, and pulls updates if they are installed on the system.
42
+
43
+ This cookbook provides three definitions to create, alter, and delete users as well as create and drop databases, or setup extensions. Usage is as follows:
44
+
45
+
46
+ ### Users
47
+
48
+ ```ruby
49
+ # create a user
50
+ pg_user "myuser" do
51
+ privileges :superuser => false, :createdb => false, :login => true
52
+ password "mypassword"
53
+ end
54
+
55
+ # create a user with an MD5-encrypted password
56
+ pg_user "myuser" do
57
+ privileges :superuser => false, :createdb => false, :login => true
58
+ encrypted_password "667ff118ef6d196c96313aeaee7da519"
59
+ end
60
+
61
+ # drop a user
62
+ pg_user "myuser" do
63
+ action :drop
64
+ end
65
+ ```
66
+
67
+ Or add users via attributes:
68
+
69
+ ```json
70
+ "postgresql": {
71
+ "users": [
72
+ {
73
+ "username": "dickeyxxx",
74
+ "password": "password",
75
+ "superuser": true,
76
+ "createdb": true,
77
+ "login": true
78
+ }
79
+ ]
80
+ }
81
+ ```
82
+
83
+ ### Databases and Extensions
84
+
85
+ ```ruby
86
+ # create a database
87
+ pg_database "mydb" do
88
+ owner "myuser"
89
+ encoding "utf8"
90
+ template "template0"
91
+ locale "en_US.UTF8"
92
+ end
93
+
94
+ # install extensions to database
95
+ pg_database_extensions "mydb" do
96
+ languages "plpgsql" # install `plpgsql` language - single value may be passed without array
97
+ extensions ["hstore", "dblink"] # install `hstore` and `dblink` extensions - multiple values in array
98
+ postgis true # install `postgis` support
99
+ end
100
+
101
+ # drop dblink extension
102
+ pg_database_extensions "mydb" do
103
+ action :drop
104
+ extensions "dblink"
105
+ end
106
+
107
+ # drop a database
108
+ pg_database "mydb" do
109
+ action :drop
110
+ end
111
+ ```
112
+
113
+ Or add the database via attributes:
114
+
115
+ ```json
116
+ "postgresql": {
117
+ "databases": [
118
+ {
119
+ "name": "my_db",
120
+ "owner": "dickeyxxx",
121
+ "template": "template0",
122
+ "encoding": "utf8",
123
+ "locale": "en_US.UTF8",
124
+ "extensions": "hstore"
125
+ }
126
+ ]
127
+ }
128
+ ```
129
+
130
+ ### Configuration
131
+
132
+ The `postgresql.conf` configuration may be set one of two ways:
133
+
134
+ * set individual node attributes to be interpolated into the default template
135
+ * create a custom configuration hash to write a custom file
136
+
137
+ To create a custom configuration, set the `node["postgresql"]["conf"]` hash with your custom settings:
138
+
139
+ ```json
140
+ "postgresql": {
141
+ "conf": {
142
+ "data_directory": "/dev/null",
143
+ // ... all options explicitly set here
144
+ }
145
+ }
146
+ ```
147
+
148
+ You may also set the contents of `pg_hba.conf` via attributes:
149
+
150
+ ```json
151
+ "postgresql": {
152
+ "pg_hba": [
153
+ { "type": "local", "db": "all", "user": "postgres", "addr": "", "method": "ident" },
154
+ { "type": "local", "db": "all", "user": "all", "addr": "", "method": "trust" },
155
+ { "type": "host", "db": "all", "user": "all", "addr": "127.0.0.1/32", "method": "trust" },
156
+ { "type": "host", "db": "all", "user": "all", "addr": "::1/128", "method": "trust" },
157
+ { "type": "host", "db": "all", "user": "postgres", "addr": "127.0.0.1/32", "method": "trust" },
158
+ { "type": "host", "db": "all", "user": "username", "addr": "127.0.0.1/32", "method": "trust" }
159
+ ]
160
+ }
161
+ ```
162
+
163
+
164
+ ## Attributes
165
+
166
+ ```ruby
167
+ # WARNING: If this version number is changed in your own recipes, the
168
+ # FILE LOCATIONS (see below) attributes *must* also be overridden in
169
+ # order to re-compute the paths with the correct version number.
170
+ default["postgresql"]["version"] = "9.2"
171
+
172
+ default["postgresql"]["environment_variables"] = {}
173
+ default["postgresql"]["pg_ctl_options"] = ""
174
+ default["postgresql"]["pg_hba"] = []
175
+ default["postgresql"]["pg_hba_defaults"] = true # Whether to populate the pg_hba.conf with defaults
176
+ default["postgresql"]["pg_ident"] = []
177
+ default["postgresql"]["start"] = "auto" # auto, manual, disabled
178
+
179
+ default["postgresql"]["conf"] = {}
180
+ default["postgresql"]["initdb_options"] = "--locale=en_US.UTF-8"
181
+
182
+ #------------------------------------------------------------------------------
183
+ # POSTGIS
184
+ #------------------------------------------------------------------------------
185
+ default["postgis"]["version"] = "1.5"
186
+
187
+ #------------------------------------------------------------------------------
188
+ # FILE LOCATIONS
189
+ #------------------------------------------------------------------------------
190
+ default["postgresql"]["data_directory"] = "/var/lib/postgresql/#{node["postgresql"]["version"]}/main"
191
+ default["postgresql"]["hba_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_hba.conf"
192
+ default["postgresql"]["ident_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_ident.conf"
193
+ default["postgresql"]["external_pid_file"] = "/var/run/postgresql/#{node["postgresql"]["version"]}-main.pid"
194
+
195
+
196
+ #------------------------------------------------------------------------------
197
+ # CONNECTIONS AND AUTHENTICATION
198
+ #------------------------------------------------------------------------------
199
+
200
+ # connection settings
201
+ default["postgresql"]["listen_addresses"] = "localhost"
202
+ default["postgresql"]["port"] = 5432
203
+ default["postgresql"]["max_connections"] = 100
204
+ default["postgresql"]["superuser_reserved_connections"] = 3
205
+ default["postgresql"]["unix_socket_directory"] = "/var/run/postgresql"
206
+ default["postgresql"]["unix_socket_group"] = ""
207
+ default["postgresql"]["unix_socket_permissions"] = "0777"
208
+ default["postgresql"]["bonjour"] = "off"
209
+ default["postgresql"]["bonjour_name"] = ""
210
+
211
+ # security and authentication
212
+ default["postgresql"]["authentication_timeout"] = "1min"
213
+ default["postgresql"]["ssl"] = true
214
+ default["postgresql"]["ssl_ciphers"] = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"
215
+ default["postgresql"]["ssl_renegotiation_limit"] = "512MB"
216
+ default["postgresql"]["ssl_ca_file"] = ""
217
+ default["postgresql"]["ssl_cert_file"] = "/etc/ssl/certs/ssl-cert-snakeoil.pem"
218
+ default["postgresql"]["ssl_crl_file"] = ""
219
+ default["postgresql"]["ssl_key_file"] = "/etc/ssl/private/ssl-cert-snakeoil.key"
220
+ default["postgresql"]["password_encryption"] = "on"
221
+ default["postgresql"]["db_user_namespace"] = "off"
222
+
223
+ # kerberos and gssapi
224
+ default["postgresql"]["db_user_namespace"] = "off"
225
+ default["postgresql"]["krb_server_keyfile"] = ""
226
+ default["postgresql"]["krb_srvname"] = "postgres"
227
+ default["postgresql"]["krb_caseins_users"] = "off"
228
+
229
+ # tcp keepalives
230
+ default["postgresql"]["tcp_keepalives_idle"] = 0
231
+ default["postgresql"]["tcp_keepalives_interval"] = 0
232
+ default["postgresql"]["tcp_keepalives_count"] = 0
233
+
234
+
235
+ #------------------------------------------------------------------------------
236
+ # RESOURCE USAGE (except WAL)
237
+ #------------------------------------------------------------------------------
238
+
239
+ # memory
240
+ default["postgresql"]["shared_buffers"] = "24MB"
241
+ default["postgresql"]["temp_buffers"] = "8MB"
242
+ default["postgresql"]["max_prepared_transactions"] = 0
243
+ default["postgresql"]["work_mem"] = "1MB"
244
+ default["postgresql"]["maintenance_work_mem"] = "16MB"
245
+ default["postgresql"]["max_stack_depth"] = "2MB"
246
+
247
+ # kernel resource usage
248
+ default["postgresql"]["max_files_per_process"] = 1000
249
+ default["postgresql"]["shared_preload_libraries"] = ""
250
+
251
+ # cost-based vacuum delay
252
+ default["postgresql"]["vacuum_cost_delay"] = "0ms"
253
+ default["postgresql"]["vacuum_cost_page_hit"] = 1
254
+ default["postgresql"]["vacuum_cost_page_miss"] = 10
255
+ default["postgresql"]["vacuum_cost_page_dirty"] = 20
256
+ default["postgresql"]["vacuum_cost_limit"] = 200
257
+
258
+ # background writer
259
+ default["postgresql"]["bgwriter_delay"] = "200ms"
260
+ default["postgresql"]["bgwriter_lru_maxpages"] = 100
261
+ default["postgresql"]["bgwriter_lru_multiplier"] = 2.0
262
+
263
+ # asynchronous behavior
264
+ default["postgresql"]["effective_io_concurrency"] = 1
265
+
266
+
267
+ #------------------------------------------------------------------------------
268
+ # WRITE AHEAD LOG
269
+ #------------------------------------------------------------------------------
270
+
271
+ # settings
272
+ default["postgresql"]["wal_level"] = "minimal"
273
+ default["postgresql"]["fsync"] = "on"
274
+ default["postgresql"]["synchronous_commit"] = "on"
275
+ default["postgresql"]["wal_sync_method"] = "fsync"
276
+ default["postgresql"]["full_page_writes"] = "on"
277
+ default["postgresql"]["wal_buffers"] = -1
278
+ default["postgresql"]["wal_writer_delay"] = "200ms"
279
+ default["postgresql"]["commit_delay"] = 0
280
+ default["postgresql"]["commit_siblings"] = 5
281
+
282
+ # checkpoints
283
+ default["postgresql"]["checkpoint_segments"] = 3
284
+ default["postgresql"]["checkpoint_timeout"] = "5min"
285
+ default["postgresql"]["checkpoint_completion_target"] = 0.5
286
+ default["postgresql"]["checkpoint_warning"] = "30s"
287
+
288
+ # archiving
289
+ default["postgresql"]["archive_mode"] = "off"
290
+ default["postgresql"]["archive_command"] = ""
291
+ default["postgresql"]["archive_timeout"] = 0
292
+
293
+
294
+ #------------------------------------------------------------------------------
295
+ # REPLICATION
296
+ #------------------------------------------------------------------------------
297
+
298
+ # master server
299
+ default["postgresql"]["max_wal_senders"] = 0
300
+ default["postgresql"]["wal_sender_delay"] = "1s"
301
+ default["postgresql"]["wal_keep_segments"] = 0
302
+ default["postgresql"]["vacuum_defer_cleanup_age"] = 0
303
+ default["postgresql"]["replication_timeout"] = "60s"
304
+ default["postgresql"]["synchronous_standby_names"] = ""
305
+
306
+ # standby servers
307
+ default["postgresql"]["hot_standby"] = "off"
308
+ default["postgresql"]["max_standby_archive_delay"] = "30s"
309
+ default["postgresql"]["max_standby_streaming_delay"] = "30s"
310
+ default["postgresql"]["wal_receiver_status_interval"] = "10s"
311
+ default["postgresql"]["hot_standby_feedback"] = "off"
312
+
313
+
314
+ #------------------------------------------------------------------------------
315
+ # QUERY TUNING
316
+ #------------------------------------------------------------------------------
317
+
318
+ # planner method configuration
319
+ default["postgresql"]["enable_bitmapscan"] = "on"
320
+ default["postgresql"]["enable_hashagg"] = "on"
321
+ default["postgresql"]["enable_hashjoin"] = "on"
322
+ default["postgresql"]["enable_indexscan"] = "on"
323
+ default["postgresql"]["enable_material"] = "on"
324
+ default["postgresql"]["enable_mergejoin"] = "on"
325
+ default["postgresql"]["enable_nestloop"] = "on"
326
+ default["postgresql"]["enable_seqscan"] = "on"
327
+ default["postgresql"]["enable_sort"] = "on"
328
+ default["postgresql"]["enable_tidscan"] = "on"
329
+
330
+ # planner cost constants
331
+ default["postgresql"]["seq_page_cost"] = 1.0
332
+ default["postgresql"]["random_page_cost"] = 4.0
333
+ default["postgresql"]["cpu_tuple_cost"] = 0.01
334
+ default["postgresql"]["cpu_index_tuple_cost"] = 0.005
335
+ default["postgresql"]["cpu_operator_cost"] = 0.0025
336
+ default["postgresql"]["effective_cache_size"] = "128MB"
337
+
338
+ # genetic query optimizer
339
+ default["postgresql"]["geqo"] = "on"
340
+ default["postgresql"]["geqo_threshold"] = 12
341
+ default["postgresql"]["geqo_effort"] = 5
342
+ default["postgresql"]["geqo_pool_size"] = 0
343
+ default["postgresql"]["geqo_generations"] = 0
344
+ default["postgresql"]["geqo_selection_bias"] = 2.0
345
+ default["postgresql"]["geqo_seed"] = 0.0
346
+
347
+ # other planner options
348
+ default["postgresql"]["default_statistics_target"] = 100
349
+ default["postgresql"]["constraint_exclusion"] = "partition"
350
+ default["postgresql"]["cursor_tuple_fraction"] = 0.1
351
+ default["postgresql"]["from_collapse_limit"] = 8
352
+ default["postgresql"]["join_collapse_limit"] = 8
353
+
354
+
355
+ #------------------------------------------------------------------------------
356
+ # ERROR REPORTING AND LOGGING
357
+ #------------------------------------------------------------------------------
358
+
359
+ # where to log
360
+ default["postgresql"]["log_destination"] = "stderr"
361
+ default["postgresql"]["logging_collector"] = "off"
362
+ default["postgresql"]["log_directory"] = "pg_log"
363
+ default["postgresql"]["log_filename"] = "postgresql-%Y-%m-%d_%H%M%S.log"
364
+ default["postgresql"]["log_file_mode"] = 0600
365
+ default["postgresql"]["log_truncate_on_rotation"] = "off"
366
+ default["postgresql"]["log_rotation_age"] = "1d"
367
+ default["postgresql"]["log_rotation_size"] = "10MB"
368
+
369
+ # These are relevant when logging to syslog:
370
+ default["postgresql"]["syslog_facility"] = "LOCAL0"
371
+ default["postgresql"]["syslog_ident"] = "postgres"
372
+ default["postgresql"]["silent_mode"] = "off"
373
+
374
+ # when to log
375
+ default["postgresql"]["client_min_messages"] = "notice"
376
+ default["postgresql"]["log_min_messages"] = "warning"
377
+ default["postgresql"]["log_min_error_statement"] = "error"
378
+ default["postgresql"]["log_min_duration_statement"] = -1
379
+
380
+ # what to log
381
+ default["postgresql"]["debug_print_parse"] = "off"
382
+ default["postgresql"]["debug_print_rewritten"] = "off"
383
+ default["postgresql"]["debug_print_plan"] = "off"
384
+ default["postgresql"]["debug_pretty_print"] = "on"
385
+ default["postgresql"]["log_checkpoints"] = "off"
386
+ default["postgresql"]["log_connections"] = "off"
387
+ default["postgresql"]["log_disconnections"] = "off"
388
+ default["postgresql"]["log_duration"] = "off"
389
+ default["postgresql"]["log_error_verbosity"] = "default"
390
+ default["postgresql"]["log_hostname"] = "off"
391
+ default["postgresql"]["log_line_prefix"] = "%t "
392
+ default["postgresql"]["log_lock_waits"] = "off"
393
+ default["postgresql"]["log_statement"] = "none"
394
+ default["postgresql"]["log_temp_files"] = -1
395
+ default["postgresql"]["log_timezone"] = "(defaults to server environment setting)"
396
+
397
+
398
+ #------------------------------------------------------------------------------
399
+ # RUNTIME STATISTICS
400
+ #------------------------------------------------------------------------------
401
+
402
+ # query/index statistics collector
403
+ default["postgresql"]["track_activities"] = "on"
404
+ default["postgresql"]["track_counts"] = "on"
405
+ default["postgresql"]["track_functions"] = "none"
406
+ default["postgresql"]["track_activity_query_size"] = 1024
407
+ default["postgresql"]["update_process_title"] = "on"
408
+ default["postgresql"]["stats_temp_directory"] = 'pg_stat_tmp'
409
+
410
+ # statistics monitoring
411
+ default["postgresql"]["log_parser_stats"] = "off"
412
+ default["postgresql"]["log_planner_stats"] = "off"
413
+ default["postgresql"]["log_executor_stats"] = "off"
414
+ default["postgresql"]["log_statement_stats"] = "off"
415
+
416
+
417
+ #------------------------------------------------------------------------------
418
+ # AUTOVACUUM PARAMETERS
419
+ #------------------------------------------------------------------------------
420
+
421
+ default["postgresql"]["autovacuum"] = "on"
422
+ default["postgresql"]["log_autovacuum_min_duration"] = -1
423
+ default["postgresql"]["autovacuum_max_workers"] = 3
424
+ default["postgresql"]["autovacuum_naptime"] = "1min"
425
+ default["postgresql"]["autovacuum_vacuum_threshold"] = 50
426
+ default["postgresql"]["autovacuum_analyze_threshold"] = 50
427
+ default["postgresql"]["autovacuum_vacuum_scale_factor"] = 0.2
428
+ default["postgresql"]["autovacuum_analyze_scale_factor"] = 0.1
429
+ default["postgresql"]["autovacuum_freeze_max_age"] = 200000000
430
+ default["postgresql"]["autovacuum_vacuum_cost_delay"] = "20ms"
431
+ default["postgresql"]["autovacuum_vacuum_cost_limit"] = -1
432
+
433
+
434
+ #------------------------------------------------------------------------------
435
+ # CLIENT CONNECTION DEFAULTS
436
+ #------------------------------------------------------------------------------
437
+
438
+ # statement behavior
439
+ default["postgresql"]["search_path"] = '"$user",public'
440
+ default["postgresql"]["default_tablespace"] = ""
441
+ default["postgresql"]["temp_tablespaces"] = ""
442
+ default["postgresql"]["check_function_bodies"] = "on"
443
+ default["postgresql"]["default_transaction_isolation"] = "read committed"
444
+ default["postgresql"]["default_transaction_read_only"] = "off"
445
+ default["postgresql"]["default_transaction_deferrable"] = "off"
446
+ default["postgresql"]["session_replication_role"] = "origin"
447
+ default["postgresql"]["statement_timeout"] = 0
448
+ default["postgresql"]["vacuum_freeze_min_age"] = 50000000
449
+ default["postgresql"]["vacuum_freeze_table_age"] = 150000000
450
+ default["postgresql"]["bytea_output"] = "hex"
451
+ default["postgresql"]["xmlbinary"] = "base64"
452
+ default["postgresql"]["xmloption"] = "content"
453
+
454
+ # locale and formatting
455
+ default["postgresql"]["datestyle"] = "iso, mdy"
456
+ default["postgresql"]["intervalstyle"] = "postgres"
457
+ default["postgresql"]["timezone"] = "(defaults to server environment setting)"
458
+ default["postgresql"]["timezone_abbreviations"] = "Default"
459
+ default["postgresql"]["extra_float_digits"] = 0
460
+ default["postgresql"]["client_encoding"] = "sql_ascii"
461
+
462
+ # These settings are initialized by initdb, but they can be changed.
463
+ default["postgresql"]["lc_messages"] = "en_US.UTF-8"
464
+ default["postgresql"]["lc_monetary"] = "en_US.UTF-8"
465
+ default["postgresql"]["lc_numeric"] = "en_US.UTF-8"
466
+ default["postgresql"]["lc_time"] = "en_US.UTF-8"
467
+
468
+ # default configuration for text search
469
+ default["postgresql"]["default_text_search_config"] = "pg_catalog.english"
470
+
471
+ # other defaults
472
+ default["postgresql"]["dynamic_library_path"] = "$libdir"
473
+ default["postgresql"]["local_preload_libraries"] = ""
474
+
475
+
476
+ #------------------------------------------------------------------------------
477
+ # LOCK MANAGEMENT
478
+ #------------------------------------------------------------------------------
479
+
480
+ default["postgresql"]["deadlock_timeout"] = "1s"
481
+ default["postgresql"]["max_locks_per_transaction"] = 64
482
+ default["postgresql"]["max_pred_locks_per_transaction"] = 64
483
+
484
+
485
+ #------------------------------------------------------------------------------
486
+ # VERSION/PLATFORM COMPATIBILITY
487
+ #------------------------------------------------------------------------------
488
+
489
+ # previous postgresql versions
490
+ default["postgresql"]["array_nulls"] = "on"
491
+ default["postgresql"]["backslash_quote"] = "safe_encoding"
492
+ default["postgresql"]["default_with_oids"] = "off"
493
+ default["postgresql"]["escape_string_warning"] = "on"
494
+ default["postgresql"]["lo_compat_privileges"] = "off"
495
+ default["postgresql"]["quote_all_identifiers"] = "off"
496
+ default["postgresql"]["sql_inheritance"] = "on"
497
+ default["postgresql"]["standard_conforming_strings"] = "on"
498
+ default["postgresql"]["synchronize_seqscans"] = "on"
499
+
500
+ # other platforms and clients
501
+ default["postgresql"]["transform_null_equals"] = "off"
502
+
503
+
504
+ #------------------------------------------------------------------------------
505
+ # ERROR HANDLING
506
+ #------------------------------------------------------------------------------
507
+
508
+ default["postgresql"]["exit_on_error"] = "off"
509
+ default["postgresql"]["restart_after_crash"] = "on"
510
+
511
+
512
+ #------------------------------------------------------------------------------
513
+ # USERS AND DATABASES
514
+ #------------------------------------------------------------------------------
515
+
516
+ default["postgresql"]["users"] = []
517
+ default["postgresql"]["databases"] = []
518
+
519
+
520
+ #------------------------------------------------------------------------------
521
+ # CUSTOMIZED OPTIONS
522
+ #------------------------------------------------------------------------------
523
+
524
+ default["postgresql"]["custom_variable_classes"] = ""
525
+ ```
526
+
527
+
528
+ ## TODO
529
+
530
+ * Add support for replication setup
531
+ * Add installation and configuration for the following packages:
532
+
533
+ ```
534
+ postgresql-{version}-debversion
535
+ postgresql-{version}-ip4r
536
+ postgresql-{version}-pljava-gcj
537
+ postgresql-plperl-{version}
538
+ postgresql-{version}-pllua
539
+ postgresql-{version}-plproxy
540
+ postgresql-plpython-{version}
541
+ postgresql-{version}-plr
542
+ postgresql-{version}-plsh
543
+ postgresql-pltcl-{version}
544
+ postgresql-server-dev-{version}
545
+ ```
546
+
547
+
548
+ ## Contributing
549
+
550
+ 1. Fork it
551
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
552
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
553
+ 4. Push to the branch (`git push origin my-new-feature`)
554
+ 5. Create new Pull Request
555
+
556
+
557
+ ## Contributors
558
+
559
+ Many thanks go to the following who have contributed to making this cookbook even better:
560
+
561
+ * **[@flashingpumpkin](https://github.com/flashingpumpkin)**
562
+ * recipe bugfixes
563
+ * add `pg_user` and `pg_database` definitions
564
+ * **[@cmer](https://github.com/cmer)**
565
+ * add `encrypted_password` param for `pg_user` definition
566
+ * **[@dickeyxxx](https://github.com/dickeyxxx)**
567
+ * speed up recipe loading and execution
568
+ * add support for specifying database locale
569
+ * add support for adding users and databases via attributes
570
+ * **[@alno](https://github.com/alno)**
571
+ * add support to install additional languages/extensions/postgis to existing databases
572
+ * add `pg_database_extensions` definition
573
+ * **[@ermolaev](https://github.com/ermolaev)**
574
+ * improve platform check for source repo
575
+ * **[@escobera](https://github.com/escobera)**
576
+ * fix for missing ssl directives in `postgresql.conf`
577
+ * **[@cdoughty77](https://github.com/cdoughty77)**
578
+ * allow finer tuning inside pg_hba.conf file
579
+
580
+
581
+
582
+ ## License
583
+
584
+ **chef-postgresql**
585
+
586
+ * Freely distributable and licensed under the [MIT license](http://phlipper.mit-license.org/2012-2013/license.html).
587
+ * Copyright (c) 2012-2013 Phil Cohen (github@phlippers.net) [![endorse](http://api.coderwall.com/phlipper/endorsecount.png)](http://coderwall.com/phlipper)
588
+ * http://phlippers.net/