From 08e16d953552f0868fc4f8d1d34fb0be3fa370e0 Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Fri, 10 Nov 2023 05:26:41 -0800 Subject: [PATCH] FIX: ensure all exec declarations are run on db tags in postgres template --- templates/postgres.template.yml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/templates/postgres.template.yml b/templates/postgres.template.yml index 7d0bed7db3..fd920af030 100644 --- a/templates/postgres.template.yml +++ b/templates/postgres.template.yml @@ -17,17 +17,20 @@ hooks: to: sv start postgres || exit 1 run: - - exec: locale-gen $LANG && update-locale - - exec: mkdir -p /shared/postgres_run - - exec: chown postgres:postgres /shared/postgres_run - - exec: chmod 775 /shared/postgres_run - - exec: rm -fr /var/run/postgresql - - exec: ln -s /shared/postgres_run /var/run/postgresql - - exec: socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1 - - exec: rm -fr /shared/postgres_run/.s* - - exec: rm -fr /shared/postgres_run/*.pid - - exec: mkdir -p /shared/postgres_run/13-main.pg_stat_tmp - - exec: chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp + - exec: + cmd: + - locale-gen $LANG && update-locale + - mkdir -p /shared/postgres_run + - chown postgres:postgres /shared/postgres_run + - chmod 775 /shared/postgres_run + - rm -fr /var/run/postgresql + - ln -s /shared/postgres_run /var/run/postgresql + - socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1 + - rm -fr /shared/postgres_run/.s* + - rm -fr /shared/postgres_run/*.pid + - mkdir -p /shared/postgres_run/13-main.pg_stat_tmp + - chown postgres:postgres /shared/postgres_run/13-main.pg_stat_tmp + tag: db - file: path: /etc/service/postgres/run chmod: "+x" @@ -117,14 +120,14 @@ run: fi - exec: + tag: db cmd: - chown -R root /var/lib/postgresql/13/main - "[ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/13/bin/initdb -D /shared/postgres_data || exit 0" - chown -R postgres:postgres /shared/postgres_data - chown -R postgres:postgres /var/run/postgresql - - - exec: /root/upgrade_postgres - - exec: rm /root/upgrade_postgres + - /root/upgrade_postgres + - rm /root/upgrade_postgres - replace: filename: "/etc/postgresql/13/main/postgresql.conf" @@ -165,6 +168,7 @@ run: - exec: cmd: - install -d -m 0755 -o postgres -g postgres /shared/postgres_backup + tag: db - replace: filename: "/etc/postgresql/13/main/postgresql.conf"