4 filename: /etc/service/unicorn/run
6 to: sv start postgres || exit 1
9 - exec: apt-get update && apt-get install -y postgresql-9.3
10 - exec: /etc/init.d/postgresql stop
11 - exec: mkdir -p /shared/postgres_run
12 - exec: chown postgres:postgres /shared/postgres_run
13 - exec: chmod 775 /shared/postgres_run
14 - exec: rm -fr /var/run/postgresql
15 - exec: ln -s /shared/postgres_run /var/run/postgresql
16 - exec: socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
17 - exec: rm -fr /shared/postgres_run/.s*
18 - exec: rm -fr /shared/postgres_run/*.pid
19 - exec: mkdir -p /shared/postgres_run/9.3-main.pg_stat_tmp
20 - exec: chown postgres:postgres /shared/postgres_run/9.3-main.pg_stat_tmp
22 path: /etc/service/postgres/run
27 echo -1000 >/proc/self/oom_score_adj
28 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
31 path: /etc/runit/3.d/99-postgres
39 - chown -R root /var/lib/postgresql/9.3/main
40 - "[ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/9.3/bin/initdb -D /shared/postgres_data || exit 0"
41 - chown -R postgres:postgres /shared/postgres_data
42 - chown -R postgres:postgres /var/run/postgresql
45 filename: "/etc/postgresql/9.3/main/postgresql.conf"
46 from: "data_directory = '/var/lib/postgresql/9.3/main'"
47 to: "data_directory = '/shared/postgres_data'"
49 # listen on all interfaces
51 filename: "/etc/postgresql/9.3/main/postgresql.conf"
52 from: /#?listen_addresses *=.*/
53 to: "listen_addresses = '*'"
56 filename: "/etc/postgresql/9.3/main/pg_hba.conf"
57 from: /^#local +replication +postgres +peer$/
58 to: "local replication postgres peer"
60 # allow all to connect in with md5 auth
62 filename: "/etc/postgresql/9.3/main/pg_hba.conf"
63 from: /^host.*all.*all.*127.*$/
64 to: "host all all 0.0.0.0/0 md5"
68 # use fast shutdown for pg
70 cmd: 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
72 # give db a few secs to start up
77 cmd: "echo postgres installed!"