FIX: use chpst to avoid extra process that interferes with signals
authorSam <sam.saffron@gmail.com>
Mon, 25 Aug 2014 02:22:19 +0000 (12:22 +1000)
committerSam <sam.saffron@gmail.com>
Mon, 25 Aug 2014 02:22:19 +0000 (12:22 +1000)
templates/postgres.template.yml
templates/redis.template.yml
templates/web.template.yml

index 037dc5ea21c38559018ed5f4610935f0e3acc5c4..cdc3f46a7ec328d1b922f75b3d312e492ca43286 100644 (file)
@@ -26,7 +26,7 @@ run:
      contents: |
         #!/bin/sh
         exec 2>&1
-        exec su - postgres -c '/usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main'
+        HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main
   - file:
      path: /root/upgrade_postgres
      chmod: "+x"
index 8cea62323d4d0a2863f71791a90db56853c8948c..9b177857de59eec03a8628298156e92fbc732a3e 100644 (file)
@@ -5,7 +5,7 @@ run:
      contents: |
         #!/bin/sh
         exec 2>&1
-        exec su - redis -s /bin/bash -c '/usr/bin/redis-server /etc/redis/redis.conf'
+        exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf
 
   - replace:
       filename: "/etc/redis/redis.conf"
index 6263a101eb3ef9fdfae06e675f301bbd9a7f21f3..b177e91e661126a8e4bd67b63b0d851b1d63da96 100644 (file)
@@ -42,7 +42,7 @@ run:
         # postgres
         cd $home
         chown -R discourse:www-data /shared/log/rails
-        LD_PRELOAD=/usr/lib/libjemalloc.so.1 exec su discourse -c 'bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb'
+        LD_PRELOAD=/usr/lib/libjemalloc.so.1 HOME=/home/discourse USER=discourse exec chpst -u discourse:www-data -U discourse:www-data bundle exec config/unicorn_launcher -E production -c config/unicorn.conf.rb
 
   - file:
      path: /etc/service/nginx/run