diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb index e93169e..597cd10 100644 --- a/cookbooks/postgresql/recipes/default.rb +++ b/cookbooks/postgresql/recipes/default.rb @@ -1,9 +1,22 @@ package 'postgresql-server' -execute 'postgresql-setup initdb || true' do - notifies :start, 'service[postgresql]' +execute 'postgresql-setup initdb || true' + +template '/var/lib/pgsql/data/pg_hba.conf' do + user 'postgres' + group 'postgres' + mode 0600 + notifies :restart, 'service[postgresql]' +end + +template '/var/lib/pgsql/data/postgresql.conf' do + user 'postgres' + group 'postgres' + mode 0600 + notifies :restart, 'service[postgresql]' end service 'postgresql' do action :start + supports :restart => true end diff --git a/cookbooks/postgresql/templates/centos/pg_hba.conf.erb b/cookbooks/postgresql/templates/centos/pg_hba.conf.erb new file mode 100644 index 0000000..d514183 --- /dev/null +++ b/cookbooks/postgresql/templates/centos/pg_hba.conf.erb @@ -0,0 +1,10 @@ +# TYPE DATABASE USER ADDRESS METHOD +# "local" is for Unix domain socket connections only +local all all peer +# IPv4 local connections: +host all all 127.0.0.1/32 ident +# IPv6 local connections: +host all all ::1/128 ident + +# TYPE DATABASE USER ADDRESS METHOD +host colab colab <%= node['peers']['integration'] %>/32 trust diff --git a/cookbooks/postgresql/templates/centos/postgresql.conf.erb b/cookbooks/postgresql/templates/centos/postgresql.conf.erb new file mode 100644 index 0000000..dc4d96a --- /dev/null +++ b/cookbooks/postgresql/templates/centos/postgresql.conf.erb @@ -0,0 +1,19 @@ +listen_addresses = 'localhost,<%= node['peers']['database'] %>' + +# TODO optimize these settings + +max_connections = 100 # (change requires restart) +shared_buffers = 32MB # min 128kB +logging_collector = on # Enable capturing of stderr and csvlog +log_filename = 'postgresql-%a.log' # log file name pattern, +log_truncate_on_rotation = on # If on, an existing log file with the +log_rotation_age = 1d # Automatic rotation of logfiles will +log_rotation_size = 0 # Automatic rotation of logfiles will +log_timezone = 'UTC' +datestyle = 'iso, mdy' +timezone = 'UTC' +lc_messages = 'en_US.UTF-8' # locale for system error message +lc_monetary = 'en_US.UTF-8' # locale for monetary formatting +lc_numeric = 'en_US.UTF-8' # locale for number formatting +lc_time = 'en_US.UTF-8' # locale for time formatting +default_text_search_config = 'pg_catalog.english' -- libgit2 0.21.2