Skip to content
Browse files

Added postgresql.conf and shmmax setting to postgres sls.

  • Loading branch information...
1 parent 550b02c commit b65c41014f8d14dccd922080aea982509517bdbc @rca rca committed Mar 14, 2013
Showing with 28 additions and 7 deletions.
  1. +28 −7 init.sls
View
35 init.sls
@@ -5,13 +5,6 @@ include:
{% set pg_pref = '/etc/apt/preferences.d/pgdg.pref' %}
-postgresql:
- service:
- - running
- - require:
- - pkg: postgresql_packages
-
-
postgresql_packages:
pkg.installed:
- pkgs:
@@ -25,3 +18,31 @@ postgresql_packages:
- cmd.run: add_postgresql_apt_key
- file: {{ pg_list }}
- file: {{ pg_pref }}
+
+
+{% set postgresql_conf = '/etc/postgresql/9.2/main/postgresql.conf' %}
+{{ postgresql_conf }}:
+ file.managed:
+ - source: salt://postgresql/files{{ postgresql_conf }}
+ - template: jinja
+ - user: postgres
+ - group: postgres
+ - mode: 0644
+ - require:
+ - pkg: postgresql_packages
+
+
+{% set mem = 8192 if 8192 < (grains['mem_total'] / 4) else (grains['mem_total'] / 4) %}
+kernel.shmmax:
+ sysctl.present:
+ - value: {{ (1024**2 * mem * 1.1)|int }}
+
+
+postgresql:
+ service:
+ - running
+ - require:
+ - sysctl: kernel.shmmax
+ - pkg: postgresql_packages
+ - watch:
+ - file: {{ postgresql_conf }}

0 comments on commit b65c410

Please sign in to comment.
Something went wrong with that request. Please try again.