Commit 935274673aa137bd0443263b88d2a6fb9df22b54

Authored by Antonio Terceiro
1 parent 30e2eb7c

configure PostgreSQL

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