File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 3030 rm /root/install_postgres
3131 fi
3232 if [ "$CREATE_DB_ON_BOOT" = "1" ]; then
33- /usr/local/bin/create_db&
33+ sudo -E -u postgres /usr/lib/postgresql/15/bin/pg_ctl -D /etc/postgresql/15/main -o "-c listen_addresses='' -p 5432" -w start
34+ /usr/local/bin/create_db
35+ sudo -E -u postgres /usr/lib/postgresql/15/bin/pg_ctl -D /etc/postgresql/15/main -m fast -w stop
3436 fi
3537 HOME=/var/lib/postgresql USER=postgres exec thpoff chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/15/bin/postmaster -D /etc/postgresql/15/main
3638
@@ -245,11 +247,6 @@ run:
245247 chmod : +x
246248 contents : |
247249 #!/bin/bash
248- # wait for postgres to start up...
249- for i in {1..5}; do
250- su postgres -c 'pg_isready -q' && break
251- sleep 1
252- done
253250 su postgres -c 'createdb $db_name' || true
254251 su postgres -c 'psql $db_name -c "create user $db_user;"' || true
255252 su postgres -c 'psql $db_name -c "grant all privileges on database $db_name to $db_user;"' || true
289286 tag : db
290287 hook : postgres
291288 cmd :
289+ # wait for postgres to start up...
290+ - sleep 5
292291 - /usr/local/bin/create_db
293292 - " echo postgres installed!"
You can’t perform that action at this time.
0 commit comments