Skip to content

Commit

Permalink
FIX: ensure all exec declarations are run on db tags in postgres temp…
Browse files Browse the repository at this point in the history
…late
  • Loading branch information
featheredtoast committed Nov 10, 2023
1 parent 3e28261 commit 08e16d9
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions templates/postgres.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 08e16d9

Please sign in to comment.