FEATURE: allow tweaking more pg setup options
authorSam <sam.saffron@gmail.com>
Thu, 7 Aug 2014 03:11:37 +0000 (13:11 +1000)
committerSam <sam.saffron@gmail.com>
Thu, 7 Aug 2014 03:11:37 +0000 (13:11 +1000)
samples/data.yml
samples/standalone.yml
templates/postgres.template.yml

index df4864fa1d6c64d1a318ce99d8af3790e09ba923..ddb6228f069219e671a9d2b083ce46e6ff9cf101 100644 (file)
@@ -16,6 +16,12 @@ env:
   # ensure locale exists in container, you may need to install it
   LANG: en_US.UTF-8
 
+params:
+  db_default_text_search_config: "pb_catelog.english"
+  ##  Set db_shared_buffers to 1/3 of the memory you wish to allocate to postgres
+  ##  on 1GB install set to 128MB on a 4GB instance you may raise to 1GB
+  # db_shared_buffers: "256MB"
+
 # amend SOME_SECRET to a password for the discourse user
 hooks:
   after_postgres:
index 70b1c8e69482b9ffdd864237a169f34d32e79f04..6b1aba09614c3adb702f6d189aa2644fdb8e40b5 100644 (file)
@@ -19,7 +19,12 @@ expose:
   - "80:80"   # fwd host port 80   to container port 80 (http)
   - "2222:22" # fwd host port 2222 to container port 22 (ssh)
 
-#params:
+params:
+  db_default_text_search_config: "pb_catelog.english"
+  ##  Set db_shared_buffers to 1/3 of the memory you wish to allocate to postgres
+  ##  on 1GB install set to 128MB on a 4GB instance you may raise to 1GB
+  #db_shared_buffers: "256MB"
+  #
   ## Which Git revision should this container use? (default: tests-passed)
   #version: tests-passed
 
index abed0f4e98d0e2e3c7f65e0f79168158734f5fba..21d62273c362538cf67bd6154f6493167c30ec5e 100644 (file)
@@ -1,3 +1,9 @@
+params:
+  db_synchronous_commit: "off"
+  db_shared_buffers: "256MB"
+  db_work_mem: "10MB"
+  db_default_text_search_config: "pb_catelog.english"
+
 hooks:
   after_cron:
     - file:
@@ -107,6 +113,8 @@ run:
         - chown -R postgres:postgres /var/run/postgresql
 
   - exec: /root/upgrade_postgres
+  - exec: rm /root/upgrade_postgres
+
   - replace:
       filename: "/etc/postgresql/9.3/main/postgresql.conf"
       from: "data_directory = '/var/lib/postgresql/9.3/main'"
@@ -118,6 +126,36 @@ run:
       from: /#?listen_addresses *=.*/
       to: "listen_addresses = '*'"
 
+  # listen on all interfaces
+  - replace:
+      filename: "/etc/postgresql/9.3/main/postgresql.conf"
+      from: /#?listen_addresses *=.*/
+      to: "listen_addresses = '*'"
+
+  # sync commit off is faster and less spiky, also marginally less safe
+  - replace:
+      filename: "/etc/postgresql/9.3/main/postgresql.conf"
+      from: /#?synchronous_commit *=.*/
+      to: "synchronous_commit = $db_synchronous_commit"
+
+  # default is 128MB which is way too small
+  - replace:
+      filename: "/etc/postgresql/9.3/main/postgresql.conf"
+      from: /#?shared_buffers *=.*/
+      to: "shared_buffers = $db_shared_buffers"
+
+  # default is 1MB which is too small
+  - replace:
+      filename: "/etc/postgresql/9.3/main/postgresql.conf"
+      from: /#?work_mem *=.*/
+      to: "work_mem = $db_work_mem"
+
+  # allow for other
+  - replace:
+      filename: "/etc/postgresql/9.3/main/postgresql.conf"
+      from: /#?default_text_search_config *=.*/
+      to: "default_text_search_config = '$db_default_text_search_config'"
+
   # Necessary to enable backups
   - exec:
       cmd: