elzar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data/.chef/knife.rb +3 -0
  2. data/.gitignore +1 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +11 -0
  5. data/Gemfile.lock +96 -0
  6. data/README.md +42 -0
  7. data/Rakefile +1 -0
  8. data/Vagrantfile +16 -0
  9. data/cookbooks/.gitkeep +0 -0
  10. data/cookbooks/apt/README.md +122 -0
  11. data/cookbooks/apt/files/default/apt-cacher +9 -0
  12. data/cookbooks/apt/files/default/apt-cacher.conf +144 -0
  13. data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  14. data/cookbooks/apt/metadata.rb +13 -0
  15. data/cookbooks/apt/providers/repository.rb +73 -0
  16. data/cookbooks/apt/recipes/cacher-client.rb +44 -0
  17. data/cookbooks/apt/recipes/cacher.rb +45 -0
  18. data/cookbooks/apt/recipes/default.rb +50 -0
  19. data/cookbooks/apt/resources/repository.rb +30 -0
  20. data/cookbooks/build-essential/README.md +24 -0
  21. data/cookbooks/build-essential/metadata.rb +10 -0
  22. data/cookbooks/build-essential/recipes/default.rb +45 -0
  23. data/cookbooks/database/README.md +403 -0
  24. data/cookbooks/database/libraries/provider_database_mysql.rb +97 -0
  25. data/cookbooks/database/libraries/provider_database_mysql_user.rb +76 -0
  26. data/cookbooks/database/libraries/provider_database_postgresql.rb +126 -0
  27. data/cookbooks/database/libraries/provider_database_postgresql_user.rb +78 -0
  28. data/cookbooks/database/libraries/provider_database_sql_server.rb +109 -0
  29. data/cookbooks/database/libraries/provider_database_sql_server_user.rb +106 -0
  30. data/cookbooks/database/libraries/resource_database.rb +111 -0
  31. data/cookbooks/database/libraries/resource_database_user.rb +90 -0
  32. data/cookbooks/database/libraries/resource_mysql_database.rb +34 -0
  33. data/cookbooks/database/libraries/resource_mysql_database_user.rb +34 -0
  34. data/cookbooks/database/libraries/resource_postgresql_database.rb +35 -0
  35. data/cookbooks/database/libraries/resource_postgresql_database_user.rb +35 -0
  36. data/cookbooks/database/libraries/resource_sql_server_database.rb +34 -0
  37. data/cookbooks/database/libraries/resource_sql_server_database_user.rb +34 -0
  38. data/cookbooks/database/metadata.rb +21 -0
  39. data/cookbooks/database/recipes/default.rb +20 -0
  40. data/cookbooks/database/recipes/ebs_backup.rb +89 -0
  41. data/cookbooks/database/recipes/ebs_volume.rb +196 -0
  42. data/cookbooks/database/recipes/master.rb +78 -0
  43. data/cookbooks/database/recipes/snapshot.rb +62 -0
  44. data/cookbooks/database/templates/default/app_grants.sql.erb +8 -0
  45. data/cookbooks/database/templates/default/aws_config.erb +3 -0
  46. data/cookbooks/database/templates/default/chef-solo-database-snapshot.cron.erb +10 -0
  47. data/cookbooks/database/templates/default/chef-solo-database-snapshot.json.erb +1 -0
  48. data/cookbooks/database/templates/default/chef-solo-database-snapshot.rb.erb +6 -0
  49. data/cookbooks/database/templates/default/ebs-backup-cron.erb +2 -0
  50. data/cookbooks/database/templates/default/ebs-db-backup.sh.erb +8 -0
  51. data/cookbooks/database/templates/default/ebs-db-restore.sh.erb +10 -0
  52. data/cookbooks/database/templates/default/s3cfg.erb +27 -0
  53. data/cookbooks/mysql/README.md +148 -0
  54. data/cookbooks/mysql/attributes/server.rb +68 -0
  55. data/cookbooks/mysql/libraries/database.rb +19 -0
  56. data/cookbooks/mysql/libraries/helpers.rb +33 -0
  57. data/cookbooks/mysql/metadata.rb +90 -0
  58. data/cookbooks/mysql/recipes/client.rb +51 -0
  59. data/cookbooks/mysql/recipes/default.rb +20 -0
  60. data/cookbooks/mysql/recipes/server.rb +133 -0
  61. data/cookbooks/mysql/recipes/server_ec2.rb +49 -0
  62. data/cookbooks/mysql/templates/default/debian.cnf.erb +12 -0
  63. data/cookbooks/mysql/templates/default/grants.sql.erb +15 -0
  64. data/cookbooks/mysql/templates/default/my.cnf.erb +176 -0
  65. data/cookbooks/mysql/templates/default/mysql-server.seed.erb +10 -0
  66. data/cookbooks/mysql/templates/default/port_mysql.erb +3 -0
  67. data/cookbooks/openssl/README.md +37 -0
  68. data/cookbooks/openssl/libraries/secure_password.rb +37 -0
  69. data/cookbooks/openssl/metadata.rb +8 -0
  70. data/cookbooks/openssl/recipes/default.rb +19 -0
  71. data/cookbooks/passenger_enterprise/README.rdoc +8 -0
  72. data/cookbooks/passenger_enterprise/attributes/default.rb +28 -0
  73. data/cookbooks/passenger_enterprise/cc.gemspec +36 -0
  74. data/cookbooks/passenger_enterprise/metadata.json +44 -0
  75. data/cookbooks/passenger_enterprise/metadata.rb +16 -0
  76. data/cookbooks/passenger_enterprise/recipes/apache2.rb +54 -0
  77. data/cookbooks/passenger_enterprise/recipes/default.rb +30 -0
  78. data/cookbooks/passenger_enterprise/recipes/nginx.rb +50 -0
  79. data/cookbooks/passenger_enterprise/templates/default/passenger.conf.erb +2 -0
  80. data/cookbooks/passenger_enterprise/templates/default/passenger.load.erb +1 -0
  81. data/cookbooks/passenger_enterprise/templates/default/passenger_nginx.conf.erb +2 -0
  82. data/cookbooks/ruby_enterprise/README.rdoc +55 -0
  83. data/cookbooks/ruby_enterprise/attributes/default.rb +33 -0
  84. data/cookbooks/ruby_enterprise/cc.gemspec +36 -0
  85. data/cookbooks/ruby_enterprise/definitions/ree_gem.rb +28 -0
  86. data/cookbooks/ruby_enterprise/metadata.json +45 -0
  87. data/cookbooks/ruby_enterprise/metadata.rb +13 -0
  88. data/cookbooks/ruby_enterprise/recipes/default.rb +67 -0
  89. data/data_bags/deploy/authorized_keys.json +9 -0
  90. data/dna.json +25 -0
  91. data/elzar.gemspec +22 -0
  92. data/lib/elzar.rb +21 -0
  93. data/lib/elzar/assistant.rb +77 -0
  94. data/lib/elzar/chef_dna.rb +48 -0
  95. data/lib/elzar/template.rb +24 -0
  96. data/lib/elzar/templates/Gemfile +11 -0
  97. data/lib/elzar/templates/Vagrantfile.erb +16 -0
  98. data/lib/elzar/templates/dna.json +25 -0
  99. data/lib/elzar/templates/solo.rb.erb +6 -0
  100. data/lib/elzar/version.rb +3 -0
  101. data/roles/enterprise_appstack.rb +4 -0
  102. data/roles/plumbing.rb +11 -0
  103. data/roles/postgres_database.rb +4 -0
  104. data/roles/ruby_appstack.rb +4 -0
  105. data/script/install_cookbook +6 -0
  106. data/script/new_cookbook +5 -0
  107. data/site-cookbooks/.gitkeep +0 -0
  108. data/site-cookbooks/curl/README.md +17 -0
  109. data/site-cookbooks/curl/metadata.rb +6 -0
  110. data/site-cookbooks/curl/recipes/default.rb +11 -0
  111. data/site-cookbooks/nginx/CHANGELOG.md +11 -0
  112. data/site-cookbooks/nginx/CONTRIBUTING +29 -0
  113. data/site-cookbooks/nginx/LICENSE +201 -0
  114. data/site-cookbooks/nginx/README.md +76 -0
  115. data/site-cookbooks/nginx/attributes/default.rb +65 -0
  116. data/site-cookbooks/nginx/definitions/nginx_site.rb +35 -0
  117. data/site-cookbooks/nginx/files/default/mime.types +73 -0
  118. data/site-cookbooks/nginx/metadata.rb +89 -0
  119. data/site-cookbooks/nginx/recipes/default.rb +57 -0
  120. data/site-cookbooks/nginx/recipes/source.rb +126 -0
  121. data/site-cookbooks/nginx/templates/default/default-site.erb +11 -0
  122. data/site-cookbooks/nginx/templates/default/nginx.conf.erb +42 -0
  123. data/site-cookbooks/nginx/templates/default/nginx.init.erb +91 -0
  124. data/site-cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  125. data/site-cookbooks/nginx/templates/default/nxensite.erb +38 -0
  126. data/site-cookbooks/passenger/README.md +12 -0
  127. data/site-cookbooks/passenger/attributes/default.rb +3 -0
  128. data/site-cookbooks/passenger/metadata.rb +6 -0
  129. data/site-cookbooks/passenger/recipes/default.rb +39 -0
  130. data/site-cookbooks/passenger/templates/default/passenger_nginx.conf.erb +2 -0
  131. data/site-cookbooks/postgresql/README.md +150 -0
  132. data/site-cookbooks/postgresql/attributes/default.rb +72 -0
  133. data/site-cookbooks/postgresql/metadata.rb +21 -0
  134. data/site-cookbooks/postgresql/recipes/client.rb +40 -0
  135. data/site-cookbooks/postgresql/recipes/default.rb +20 -0
  136. data/site-cookbooks/postgresql/recipes/server.rb +74 -0
  137. data/site-cookbooks/postgresql/recipes/server_debian.rb +62 -0
  138. data/site-cookbooks/postgresql/recipes/server_redhat.rb +82 -0
  139. data/site-cookbooks/postgresql/templates/default/debian.postgresql.conf.erb +499 -0
  140. data/site-cookbooks/postgresql/templates/default/pg_hba.conf.erb +83 -0
  141. data/site-cookbooks/postgresql/templates/default/redhat.postgresql.conf.erb +501 -0
  142. data/site-cookbooks/rails_app/README.md +15 -0
  143. data/site-cookbooks/rails_app/attributes/default.rb +2 -0
  144. data/site-cookbooks/rails_app/files/default/sudoers +26 -0
  145. data/site-cookbooks/rails_app/metadata.rb +6 -0
  146. data/site-cookbooks/rails_app/recipes/default.rb +143 -0
  147. data/site-cookbooks/rails_app/recipes/system_libraries.rb +12 -0
  148. data/site-cookbooks/rails_app/templates/default/pg_hba.conf.erb +84 -0
  149. data/site-cookbooks/rails_app/templates/default/rails_app_nginx.erb +10 -0
  150. data/site-cookbooks/ruby/README.md +12 -0
  151. data/site-cookbooks/ruby/attributes/default.rb +6 -0
  152. data/site-cookbooks/ruby/metadata.rb +6 -0
  153. data/site-cookbooks/ruby/recipes/default.rb +54 -0
  154. data/solo.rb +7 -0
  155. data/upgrade-chef.sh +8 -0
  156. metadata +272 -0
@@ -0,0 +1,21 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs and configures postgresql for clients or servers"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6
+ version "0.99.2"
7
+ recipe "postgresql", "Includes postgresql::client"
8
+ recipe "postgresql::client", "Installs postgresql client package(s)"
9
+ recipe "postgresql::server", "Installs postgresql server packages, templates"
10
+ recipe "postgresql::server_redhat", "Installs postgresql server packages, redhat family style"
11
+ recipe "postgresql::server_debian", "Installs postgresql server packages, debian family style"
12
+
13
+ %w{ ubuntu debian fedora suse }.each do |os|
14
+ supports os
15
+ end
16
+
17
+ %w{redhat centos scientific}.each do |el|
18
+ supports el, ">= 6.0"
19
+ end
20
+
21
+ depends "openssl"
@@ -0,0 +1,40 @@
1
+ #
2
+ # Cookbook Name:: postgresql
3
+ # Recipe:: client
4
+ #
5
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
6
+ # Author:: Lamont Granquist (<lamont@opscode.com>)
7
+ # Copyright 2009-2011 Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ pg_packages = case node['platform']
23
+ when "ubuntu","debian"
24
+ %w{postgresql-client libpq-dev make}
25
+ when "fedora","suse","amazon"
26
+ %w{postgresql-devel}
27
+ when "redhat","centos","scientific"
28
+ case
29
+ when node['platform_version'].to_f >= 6.0
30
+ %w{postgresql-devel}
31
+ else
32
+ [ "postgresql#{node['postgresql']['version'].split('.').join}-devel" ]
33
+ end
34
+ end
35
+
36
+ pg_packages.each do |pg_pack|
37
+ package pg_pack
38
+ end
39
+
40
+ gem_package "pg"
@@ -0,0 +1,20 @@
1
+ #
2
+ # Cookbook Name:: postgresql
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ include_recipe "postgresql::client"
@@ -0,0 +1,74 @@
1
+ #/postgresql.conf.
2
+ # Cookbook Name:: postgresql
3
+ # Recipe:: server
4
+ #
5
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
6
+ # Author:: Lamont Granquist (<lamont@opscode.com>)
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ ::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
23
+
24
+ include_recipe "postgresql::client"
25
+
26
+ # randomly generate postgres password
27
+ node.set_unless[:postgresql][:password][:postgres] = secure_password
28
+ node.save unless Chef::Config[:solo]
29
+
30
+ case node[:postgresql][:version]
31
+ when "8.3"
32
+ node.default[:postgresql][:ssl] = "off"
33
+ when "8.4"
34
+ node.default[:postgresql][:ssl] = "true"
35
+ end
36
+
37
+ # Include the right "family" recipe for installing the server
38
+ # since they do things slightly differently.
39
+ case node.platform
40
+ when "redhat", "centos", "fedora", "suse", "scientific", "amazon"
41
+ include_recipe "postgresql::server_redhat"
42
+ when "debian", "ubuntu"
43
+ include_recipe "postgresql::server_debian"
44
+ end
45
+
46
+ template "#{node[:postgresql][:dir]}/pg_hba.conf" do
47
+ source "pg_hba.conf.erb"
48
+ owner "postgres"
49
+ group "postgres"
50
+ mode 0600
51
+ notifies :reload, resources(:service => "postgresql"), :immediately
52
+ end
53
+
54
+ # Default PostgreSQL install has 'ident' checking on unix user 'postgres'
55
+ # and 'md5' password checking with connections from 'localhost'. This script
56
+ # runs as user 'postgres', so we can execute the 'role' and 'database' resources
57
+ # as 'root' later on, passing the below credentials in the PG client.
58
+ bash "assign-postgres-password" do
59
+ user 'postgres'
60
+ code <<-EOH
61
+ echo "ALTER ROLE postgres ENCRYPTED PASSWORD '#{node[:postgresql][:password][:postgres]}';" | psql
62
+ EOH
63
+ not_if do
64
+ begin
65
+ require 'rubygems'
66
+ Gem.clear_paths
67
+ require 'pg'
68
+ conn = PGconn.connect("localhost", 5432, nil, nil, nil, "postgres", node['postgresql']['password']['postgres'])
69
+ rescue PGError
70
+ false
71
+ end
72
+ end
73
+ action :run
74
+ end
@@ -0,0 +1,62 @@
1
+ #
2
+ # Cookbook Name:: postgresql
3
+ # Recipe:: server
4
+ #
5
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
6
+ # Author:: Lamont Granquist (<lamont@opscode.com>)#
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ include_recipe "postgresql::client"
23
+
24
+ case node[:postgresql][:version]
25
+ when "8.3"
26
+ node.default[:postgresql][:ssl] = "off"
27
+ else # > 8.3
28
+ node.default[:postgresql][:ssl] = "true"
29
+ end
30
+
31
+ package "postgresql"
32
+
33
+ service "postgresql" do
34
+ case node['platform']
35
+ when "ubuntu"
36
+ case
37
+ when node['platform_version'].to_f <= 10.04
38
+ service_name "postgresql-#{node['postgresql']['version']}"
39
+ else
40
+ service_name "postgresql"
41
+ end
42
+ when "debian"
43
+ case
44
+ when platform_version.to_f <= 5.0
45
+ service_name "postgresql-#{node['postgresql']['version']}"
46
+ when platform_version =~ /squeeze/
47
+ service_name "postgresql"
48
+ else
49
+ service_name "postgresql"
50
+ end
51
+ end
52
+ supports :restart => true, :status => true, :reload => true
53
+ action :nothing
54
+ end
55
+
56
+ template "#{node[:postgresql][:dir]}/postgresql.conf" do
57
+ source "debian.postgresql.conf.erb"
58
+ owner "postgres"
59
+ group "postgres"
60
+ mode 0600
61
+ notifies :restart, resources(:service => "postgresql")
62
+ end
@@ -0,0 +1,82 @@
1
+ #
2
+ # Cookbook Name:: postgresql
3
+ # Recipe:: server
4
+ #
5
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
6
+ # Author:: Lamont Granquist (<lamont@opscode.com>)
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ include_recipe "postgresql::client"
23
+
24
+ # Create a group and user like the package will.
25
+ # Otherwise the templates fail.
26
+
27
+ group "postgres" do
28
+ gid 26
29
+ end
30
+
31
+ user "postgres" do
32
+ shell "/bin/bash"
33
+ comment "PostgreSQL Server"
34
+ home "/var/lib/pgsql"
35
+ gid "postgres"
36
+ system true
37
+ uid 26
38
+ supports :manage_home => false
39
+ end
40
+
41
+ package "postgresql" do
42
+ case node.platform
43
+ when "redhat","centos","scientific"
44
+ case
45
+ when node.platform_version.to_f >= 6.0
46
+ package_name "postgresql"
47
+ else
48
+ package_name "postgresql#{node['postgresql']['version'].split('.').join}"
49
+ end
50
+ else
51
+ package_name "postgresql"
52
+ end
53
+ end
54
+
55
+ case node.platform
56
+ when "redhat","centos","scientific"
57
+ case
58
+ when node.platform_version.to_f >= 6.0
59
+ package "postgresql-server"
60
+ else
61
+ package "postgresql#{node['postgresql']['version'].split('.').join}-server"
62
+ end
63
+ when "fedora","suse"
64
+ package "postgresql-server"
65
+ end
66
+
67
+ execute "/sbin/service postgresql initdb" do
68
+ not_if { ::FileTest.exist?(File.join(node.postgresql.dir, "PG_VERSION")) }
69
+ end
70
+
71
+ service "postgresql" do
72
+ supports :restart => true, :status => true, :reload => true
73
+ action [:enable, :start]
74
+ end
75
+
76
+ template "#{node[:postgresql][:dir]}/postgresql.conf" do
77
+ source "redhat.postgresql.conf.erb"
78
+ owner "postgres"
79
+ group "postgres"
80
+ mode 0600
81
+ notifies :restart, resources(:service => "postgresql")
82
+ end
@@ -0,0 +1,499 @@
1
+ # -----------------------------
2
+ # PostgreSQL configuration file
3
+ # -----------------------------
4
+ #
5
+ # This file consists of lines of the form:
6
+ #
7
+ # name = value
8
+ #
9
+ # (The "=" is optional.) Whitespace may be used. Comments are introduced with
10
+ # "#" anywhere on a line. The complete list of parameter names and allowed
11
+ # values can be found in the PostgreSQL documentation.
12
+ #
13
+ # The commented-out settings shown in this file represent the default values.
14
+ # Re-commenting a setting is NOT sufficient to revert it to the default value;
15
+ # you need to reload the server.
16
+ #
17
+ # This file is read on server startup and when the server receives a SIGHUP
18
+ # signal. If you edit the file on a running system, you have to SIGHUP the
19
+ # server for the changes to take effect, or use "pg_ctl reload". Some
20
+ # parameters, which are marked below, require a server shutdown and restart to
21
+ # take effect.
22
+ #
23
+ # Any parameter can also be given as a command-line option to the server, e.g.,
24
+ # "postgres -c log_connections=on". Some paramters can be changed at run time
25
+ # with the "SET" SQL command.
26
+ #
27
+ # Memory units: kB = kilobytes MB = megabytes GB = gigabytes
28
+ # Time units: ms = milliseconds s = seconds min = minutes h = hours d = days
29
+
30
+
31
+ #------------------------------------------------------------------------------
32
+ # FILE LOCATIONS
33
+ #------------------------------------------------------------------------------
34
+
35
+ # The default values of these variables are driven from the -D command-line
36
+ # option or PGDATA environment variable, represented here as ConfigDir.
37
+
38
+ data_directory = '/var/lib/postgresql/<%= node.postgresql.version -%>/main' # use data in another directory
39
+ # (change requires restart)
40
+ hba_file = '/etc/postgresql/<%= node.postgresql.version -%>/main/pg_hba.conf' # host-based authentication file
41
+ # (change requires restart)
42
+ ident_file = '/etc/postgresql/<%= node.postgresql.version -%>/main/pg_ident.conf' # ident configuration file
43
+ # (change requires restart)
44
+
45
+ # If external_pid_file is not explicitly set, no extra PID file is written.
46
+ external_pid_file = '/var/run/postgresql/<%= node.postgresql.version -%>-main.pid' # write an extra PID file
47
+ # (change requires restart)
48
+
49
+
50
+ #------------------------------------------------------------------------------
51
+ # CONNECTIONS AND AUTHENTICATION
52
+ #------------------------------------------------------------------------------
53
+
54
+ # - Connection Settings -
55
+
56
+ #listen_addresses = 'localhost' # what IP address(es) to listen on;
57
+ # comma-separated list of addresses;
58
+ # defaults to 'localhost', '*' = all
59
+ # (change requires restart)
60
+ port = 5432 # (change requires restart)
61
+ max_connections = 100 # (change requires restart)
62
+ # Note: Increasing max_connections costs ~400 bytes of shared memory per
63
+ # connection slot, plus lock space (see max_locks_per_transaction). You might
64
+ # also need to raise shared_buffers to support more connections.
65
+ #superuser_reserved_connections = 3 # (change requires restart)
66
+ unix_socket_directory = '/var/run/postgresql' # (change requires restart)
67
+ #unix_socket_group = '' # (change requires restart)
68
+ #unix_socket_permissions = 0777 # begin with 0 to use octal notation
69
+ # (change requires restart)
70
+ #bonjour_name = '' # defaults to the computer name
71
+ # (change requires restart)
72
+
73
+ # - Security and Authentication -
74
+
75
+ #authentication_timeout = 1min # 1s-600s
76
+ <% if node.postgresql.ssl -%>
77
+ ssl = true # (change requires restart)
78
+ <% else -%>
79
+ #ssl = off # (change requires restart)
80
+ <% end -%>
81
+ #ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers
82
+ # (change requires restart)
83
+ #password_encryption = on
84
+ #db_user_namespace = off
85
+
86
+ # Kerberos and GSSAPI
87
+ #krb_server_keyfile = '' # (change requires restart)
88
+ #krb_srvname = 'postgres' # (change requires restart, Kerberos only)
89
+ #krb_server_hostname = '' # empty string matches any keytab entry
90
+ # (change requires restart, Kerberos only)
91
+ #krb_caseins_users = off # (change requires restart)
92
+ #krb_realm = '' # (change requires restart)
93
+
94
+ # - TCP Keepalives -
95
+ # see "man 7 tcp" for details
96
+
97
+ #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
98
+ # 0 selects the system default
99
+ #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
100
+ # 0 selects the system default
101
+ #tcp_keepalives_count = 0 # TCP_KEEPCNT;
102
+ # 0 selects the system default
103
+
104
+
105
+ #------------------------------------------------------------------------------
106
+ # RESOURCE USAGE (except WAL)
107
+ #------------------------------------------------------------------------------
108
+
109
+ # - Memory -
110
+
111
+ shared_buffers = 24MB # min 128kB or max_connections*16kB
112
+ # (change requires restart)
113
+ #temp_buffers = 8MB # min 800kB
114
+ #max_prepared_transactions = 5 # can be 0 or more
115
+ # (change requires restart)
116
+ # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
117
+ # per transaction slot, plus lock space (see max_locks_per_transaction).
118
+ #work_mem = 1MB # min 64kB
119
+ #maintenance_work_mem = 16MB # min 1MB
120
+ #max_stack_depth = 2MB # min 100kB
121
+
122
+ # - Free Space Map -
123
+
124
+ <% if node['postgresql']['version'].to_f < 8.4 -%>
125
+ max_fsm_pages = 153600 # min max_fsm_relations*16, 6 bytes each
126
+ # (change requires restart)
127
+ #max_fsm_relations = 1000 # min 100, ~70 bytes each
128
+ # (change requires restart)
129
+ <% end -%>
130
+
131
+ # - Kernel Resource Usage -
132
+
133
+ #max_files_per_process = 1000 # min 25
134
+ # (change requires restart)
135
+ #shared_preload_libraries = '' # (change requires restart)
136
+
137
+ # - Cost-Based Vacuum Delay -
138
+
139
+ #vacuum_cost_delay = 0 # 0-1000 milliseconds
140
+ #vacuum_cost_page_hit = 1 # 0-10000 credits
141
+ #vacuum_cost_page_miss = 10 # 0-10000 credits
142
+ #vacuum_cost_page_dirty = 20 # 0-10000 credits
143
+ #vacuum_cost_limit = 200 # 1-10000 credits
144
+
145
+ # - Background Writer -
146
+
147
+ #bgwriter_delay = 200ms # 10-10000ms between rounds
148
+ #bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
149
+ #bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
150
+
151
+
152
+ #------------------------------------------------------------------------------
153
+ # WRITE AHEAD LOG
154
+ #------------------------------------------------------------------------------
155
+
156
+ # - Settings -
157
+
158
+ #fsync = on # turns forced synchronization on or off
159
+ #synchronous_commit = on # immediate fsync at commit
160
+ #wal_sync_method = fsync # the default is the first option
161
+ # supported by the operating system:
162
+ # open_datasync
163
+ # fdatasync
164
+ # fsync
165
+ # fsync_writethrough
166
+ # open_sync
167
+ #full_page_writes = on # recover from partial page writes
168
+ #wal_buffers = 64kB # min 32kB
169
+ # (change requires restart)
170
+ #wal_writer_delay = 200ms # 1-10000 milliseconds
171
+
172
+ #commit_delay = 0 # range 0-100000, in microseconds
173
+ #commit_siblings = 5 # range 1-1000
174
+
175
+ # - Checkpoints -
176
+
177
+ #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
178
+ #checkpoint_timeout = 5min # range 30s-1h
179
+ #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
180
+ #checkpoint_warning = 30s # 0 is off
181
+
182
+ # - Archiving -
183
+
184
+ #archive_mode = off # allows archiving to be done
185
+ # (change requires restart)
186
+ #archive_command = '' # command to use to archive a logfile segment
187
+ #archive_timeout = 0 # force a logfile segment switch after this
188
+ # time; 0 is off
189
+
190
+
191
+ #------------------------------------------------------------------------------
192
+ # QUERY TUNING
193
+ #------------------------------------------------------------------------------
194
+
195
+ # - Planner Method Configuration -
196
+
197
+ #enable_bitmapscan = on
198
+ #enable_hashagg = on
199
+ #enable_hashjoin = on
200
+ #enable_indexscan = on
201
+ #enable_mergejoin = on
202
+ #enable_nestloop = on
203
+ #enable_seqscan = on
204
+ #enable_sort = on
205
+ #enable_tidscan = on
206
+
207
+ # - Planner Cost Constants -
208
+
209
+ #seq_page_cost = 1.0 # measured on an arbitrary scale
210
+ #random_page_cost = 4.0 # same scale as above
211
+ #cpu_tuple_cost = 0.01 # same scale as above
212
+ #cpu_index_tuple_cost = 0.005 # same scale as above
213
+ #cpu_operator_cost = 0.0025 # same scale as above
214
+ #effective_cache_size = 128MB
215
+
216
+ # - Genetic Query Optimizer -
217
+
218
+ #geqo = on
219
+ #geqo_threshold = 12
220
+ #geqo_effort = 5 # range 1-10
221
+ #geqo_pool_size = 0 # selects default based on effort
222
+ #geqo_generations = 0 # selects default based on effort
223
+ #geqo_selection_bias = 2.0 # range 1.5-2.0
224
+
225
+ # - Other Planner Options -
226
+
227
+ #default_statistics_target = 10 # range 1-1000
228
+ #constraint_exclusion = off
229
+ #from_collapse_limit = 8
230
+ #join_collapse_limit = 8 # 1 disables collapsing of explicit
231
+ # JOIN clauses
232
+
233
+
234
+ #------------------------------------------------------------------------------
235
+ # ERROR REPORTING AND LOGGING
236
+ #------------------------------------------------------------------------------
237
+
238
+ # - Where to Log -
239
+
240
+ #log_destination = 'stderr' # Valid values are combinations of
241
+ # stderr, csvlog, syslog and eventlog,
242
+ # depending on platform. csvlog
243
+ # requires logging_collector to be on.
244
+
245
+ # This is used when logging to stderr:
246
+ #logging_collector = off # Enable capturing of stderr and csvlog
247
+ # into log files. Required to be on for
248
+ # csvlogs.
249
+ # (change requires restart)
250
+
251
+ # These are only used if logging_collector is on:
252
+ #log_directory = 'pg_log' # directory where log files are written,
253
+ # can be absolute or relative to PGDATA
254
+ #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
255
+ # can include strftime() escapes
256
+ #log_truncate_on_rotation = off # If on, an existing log file of the
257
+ # same name as the new log file will be
258
+ # truncated rather than appended to.
259
+ # But such truncation only occurs on
260
+ # time-driven rotation, not on restarts
261
+ # or size-driven rotation. Default is
262
+ # off, meaning append to existing files
263
+ # in all cases.
264
+ #log_rotation_age = 1d # Automatic rotation of logfiles will
265
+ # happen after that time. 0 to disable.
266
+ #log_rotation_size = 10MB # Automatic rotation of logfiles will
267
+ # happen after that much log output.
268
+ # 0 to disable.
269
+
270
+ # These are relevant when logging to syslog:
271
+ #syslog_facility = 'LOCAL0'
272
+ #syslog_ident = 'postgres'
273
+
274
+
275
+ # - When to Log -
276
+
277
+ #client_min_messages = notice # values in order of decreasing detail:
278
+ # debug5
279
+ # debug4
280
+ # debug3
281
+ # debug2
282
+ # debug1
283
+ # log
284
+ # notice
285
+ # warning
286
+ # error
287
+
288
+ #log_min_messages = notice # values in order of decreasing detail:
289
+ # debug5
290
+ # debug4
291
+ # debug3
292
+ # debug2
293
+ # debug1
294
+ # info
295
+ # notice
296
+ # warning
297
+ # error
298
+ # log
299
+ # fatal
300
+ # panic
301
+
302
+ #log_error_verbosity = default # terse, default, or verbose messages
303
+
304
+ #log_min_error_statement = error # values in order of decreasing detail:
305
+ # debug5
306
+ # debug4
307
+ # debug3
308
+ # debug2
309
+ # debug1
310
+ # info
311
+ # notice
312
+ # warning
313
+ # error
314
+ # log
315
+ # fatal
316
+ # panic (effectively off)
317
+
318
+ #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
319
+ # and their durations, > 0 logs only
320
+ # statements running at least this time.
321
+
322
+ #silent_mode = off # DO NOT USE without syslog or
323
+ # logging_collector
324
+ # (change requires restart)
325
+
326
+ # - What to Log -
327
+
328
+ #debug_print_parse = off
329
+ #debug_print_rewritten = off
330
+ #debug_print_plan = off
331
+ #debug_pretty_print = off
332
+ #log_checkpoints = off
333
+ #log_connections = off
334
+ #log_disconnections = off
335
+ #log_duration = off
336
+ #log_hostname = off
337
+ log_line_prefix = '%t ' # special values:
338
+ # %u = user name
339
+ # %d = database name
340
+ # %r = remote host and port
341
+ # %h = remote host
342
+ # %p = process ID
343
+ # %t = timestamp without milliseconds
344
+ # %m = timestamp with milliseconds
345
+ # %i = command tag
346
+ # %c = session ID
347
+ # %l = session line number
348
+ # %s = session start timestamp
349
+ # %v = virtual transaction ID
350
+ # %x = transaction ID (0 if none)
351
+ # %q = stop here in non-session
352
+ # processes
353
+ # %% = '%'
354
+ # e.g. '<%u%%%d> '
355
+ #log_lock_waits = off # log lock waits >= deadlock_timeout
356
+ #log_statement = 'none' # none, ddl, mod, all
357
+ #log_temp_files = -1 # log temporary files equal or larger
358
+ # than specified size;
359
+ # -1 disables, 0 logs all temp files
360
+ #log_timezone = unknown # actually, defaults to TZ environment
361
+ # setting
362
+
363
+
364
+ #------------------------------------------------------------------------------
365
+ # RUNTIME STATISTICS
366
+ #------------------------------------------------------------------------------
367
+
368
+ # - Query/Index Statistics Collector -
369
+
370
+ #track_activities = on
371
+ #track_counts = on
372
+ #update_process_title = on
373
+
374
+
375
+ # - Statistics Monitoring -
376
+
377
+ #log_parser_stats = off
378
+ #log_planner_stats = off
379
+ #log_executor_stats = off
380
+ #log_statement_stats = off
381
+
382
+
383
+ #------------------------------------------------------------------------------
384
+ # AUTOVACUUM PARAMETERS
385
+ #------------------------------------------------------------------------------
386
+
387
+ #autovacuum = on # Enable autovacuum subprocess? 'on'
388
+ # requires track_counts to also be on.
389
+ #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
390
+ # their durations, > 0 logs only
391
+ # actions running at least that time.
392
+ #autovacuum_max_workers = 3 # max number of autovacuum subprocesses
393
+ #autovacuum_naptime = 1min # time between autovacuum runs
394
+ #autovacuum_vacuum_threshold = 50 # min number of row updates before
395
+ # vacuum
396
+ #autovacuum_analyze_threshold = 50 # min number of row updates before
397
+ # analyze
398
+ #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
399
+ #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
400
+ #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
401
+ # (change requires restart)
402
+ #autovacuum_vacuum_cost_delay = 20 # default vacuum cost delay for
403
+ # autovacuum, -1 means use
404
+ # vacuum_cost_delay
405
+ #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
406
+ # autovacuum, -1 means use
407
+ # vacuum_cost_limit
408
+
409
+
410
+ #------------------------------------------------------------------------------
411
+ # CLIENT CONNECTION DEFAULTS
412
+ #------------------------------------------------------------------------------
413
+
414
+ # - Statement Behavior -
415
+
416
+ #search_path = '"$user",public' # schema names
417
+ #default_tablespace = '' # a tablespace name, '' uses the default
418
+ #temp_tablespaces = '' # a list of tablespace names, '' uses
419
+ # only default tablespace
420
+ #check_function_bodies = on
421
+ #default_transaction_isolation = 'read committed'
422
+ #default_transaction_read_only = off
423
+ #session_replication_role = 'origin'
424
+ #statement_timeout = 0 # 0 is disabled
425
+ #vacuum_freeze_min_age = 100000000
426
+ #xmlbinary = 'base64'
427
+ #xmloption = 'content'
428
+
429
+ # - Locale and Formatting -
430
+
431
+ datestyle = 'iso, mdy'
432
+ #timezone = unknown # actually, defaults to TZ environment
433
+ # setting
434
+ #timezone_abbreviations = 'Default' # Select the set of available time zone
435
+ # abbreviations. Currently, there are
436
+ # Default
437
+ # Australia
438
+ # India
439
+ # You can create your own file in
440
+ # share/timezonesets/.
441
+ #extra_float_digits = 0 # min -15, max 2
442
+ #client_encoding = sql_ascii # actually, defaults to database
443
+ # encoding
444
+
445
+ # These settings are initialized by initdb, but they can be changed.
446
+ #lc_messages = 'en_US.UTF-8' # locale for system error message
447
+ # strings
448
+ #lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
449
+ #lc_numeric = 'en_US.UTF-8' # locale for number formatting
450
+ #lc_time = 'en_US.UTF-8' # locale for time formatting
451
+
452
+ # default configuration for text search
453
+ default_text_search_config = 'pg_catalog.english'
454
+
455
+ # - Other Defaults -
456
+
457
+ #explain_pretty_print = on
458
+ #dynamic_library_path = '$libdir'
459
+ #local_preload_libraries = ''
460
+
461
+
462
+ #------------------------------------------------------------------------------
463
+ # LOCK MANAGEMENT
464
+ #------------------------------------------------------------------------------
465
+
466
+ #deadlock_timeout = 1s
467
+ #max_locks_per_transaction = 64 # min 10
468
+ # (change requires restart)
469
+ # Note: Each lock table slot uses ~270 bytes of shared memory, and there are
470
+ # max_locks_per_transaction * (max_connections + max_prepared_transactions)
471
+ # lock table slots.
472
+
473
+
474
+ #------------------------------------------------------------------------------
475
+ # VERSION/PLATFORM COMPATIBILITY
476
+ #------------------------------------------------------------------------------
477
+
478
+ # - Previous PostgreSQL Versions -
479
+
480
+ #add_missing_from = off
481
+ #array_nulls = on
482
+ #backslash_quote = safe_encoding # on, off, or safe_encoding
483
+ #default_with_oids = off
484
+ #escape_string_warning = on
485
+ #regex_flavor = advanced # advanced, extended, or basic
486
+ #sql_inheritance = on
487
+ #standard_conforming_strings = off
488
+ #synchronize_seqscans = on
489
+
490
+ # - Other Platforms and Clients -
491
+
492
+ #transform_null_equals = off
493
+
494
+
495
+ #------------------------------------------------------------------------------
496
+ # CUSTOMIZED OPTIONS
497
+ #------------------------------------------------------------------------------
498
+
499
+ #custom_variable_classes = '' # list of custom variable class names