irongit

pretty clean

huncholanehuncholaneauthored
parent 8833966commit 741ff061b832ef43aff8c65302635cb9e760c256Browse files

1 file changed, +11 -6

+11-6docker-entrypoint.sh
@@ -1,20 +1,25 @@
11 #!/bin/sh
22
3+if [ ! -d /var/lib/postgresql/data ];then
4+ mkdir /var/lib/postgresql/data
5+fi
6+
37 # take care of postgres business
4-chown -R postgres:postgres /var/lib/postgresql
8+chmod 700 /var/lib/postgresql/data
9+chown -R postgres:postgres /var/lib/postgresql/data
510 su -s /bin/sh postgres <<EOF
611 cd
7-if [ ! -d data ];then
12+if [ -z $(ls /var/lib/postgresql/data) ];then
813 echo 'No data found, initializing postgres.'
9- mkdir data
10- chmod 700 data
11- initdb -D data > /dev/null 2> /dev/null
14+ initdb -D data > /dev/null > /dev/null 2>&1
1215 echo "host all all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf
1316 echo "listen_addresses='*'" >> /var/lib/postgresql/data/postgresql.conf
1417 sed -i '/unix_socket_directories/d' /var/lib/postgresql/data/postgresql.conf
1518 echo 'Postgres initialized'
19+else
20+ echo "Postgres data found, skipping initialization"
1621 fi
17-pg_ctl start -D /var/lib/postgresql/data > /dev/null
22+pg_ctl start -D /var/lib/postgresql/data > /dev/null 2>&1
1823 echo 'Postgres Ready'
1924 EOF
2025