Skip to content

Commit 702e9a7

Browse files
author
Gabriel Monroy
committed
fix(database): initdb if not already initialized
1 parent d40b1b3 commit 702e9a7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

database/bin/boot

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ until confd -onetime -node $ETCD -config-file /app/confd.toml; do
4848
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
4949
done
5050

51+
# initialize database if one doesn't already exist
52+
# for example, in the case of a data container
53+
if [[ ! -d /var/lib/postgresql/9.3/main ]]; then
54+
sudo -u postgres /usr/lib/postgresql/9.3/bin/initdb -D /var/lib/postgresql/9.3/main --locale=en_US.UTF-8
55+
chown -R postgres:postgres /var/lib/postgresql
56+
fi
57+
5158
# ensure WAL log bucket exists
5259
envdir /etc/wal-e.d/env /app/bin/create_bucket ${BUCKET_NAME}
5360

0 commit comments

Comments
 (0)