Commit
·
6ff9480
1
Parent(s):
c64a795
add some logging
Browse files
docker-entrypoint-wrapper.sh
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
#!/bin/sh
|
2 |
|
3 |
# Create necessary directories in the persistent /data volume
|
|
|
4 |
mkdir -p /data/postgresql/data /data/postgresql/run
|
5 |
chmod 0700 /data/postgresql/data
|
6 |
chmod 0755 /data/postgresql/run
|
7 |
|
8 |
# Initialize PostgreSQL if not already initialized
|
|
|
9 |
if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
|
10 |
# Initialize as postgres user
|
11 |
su postgres -c "initdb -D /data/postgresql/data"
|
@@ -16,12 +18,15 @@ if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
|
|
16 |
fi
|
17 |
|
18 |
# Ensure proper ownership
|
|
|
19 |
chown -R postgres:postgres /data/postgresql/data /data/postgresql/run
|
20 |
|
21 |
# Start PostgreSQL with the persistent directories
|
|
|
22 |
su postgres -c "pg_ctl -D /data/postgresql/data -o '-c listen_addresses=*' -o '-c unix_socket_directories=/data/postgresql/run' start"
|
23 |
|
24 |
# Create database and roles
|
|
|
25 |
su postgres -c "createuser -s postgres" || true
|
26 |
su postgres -c "createuser -s node" || true
|
27 |
su postgres -c "createdb -U postgres postgres" || true
|
|
|
1 |
#!/bin/sh
|
2 |
|
3 |
# Create necessary directories in the persistent /data volume
|
4 |
+
echo "Creating necessary directories in the persistent /data volume..."
|
5 |
mkdir -p /data/postgresql/data /data/postgresql/run
|
6 |
chmod 0700 /data/postgresql/data
|
7 |
chmod 0755 /data/postgresql/run
|
8 |
|
9 |
# Initialize PostgreSQL if not already initialized
|
10 |
+
echo "Initializing PostgreSQL if not already initialized..."
|
11 |
if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
|
12 |
# Initialize as postgres user
|
13 |
su postgres -c "initdb -D /data/postgresql/data"
|
|
|
18 |
fi
|
19 |
|
20 |
# Ensure proper ownership
|
21 |
+
echo "Ensuring proper ownership..."
|
22 |
chown -R postgres:postgres /data/postgresql/data /data/postgresql/run
|
23 |
|
24 |
# Start PostgreSQL with the persistent directories
|
25 |
+
echo "Starting PostgreSQL with the persistent directories..."
|
26 |
su postgres -c "pg_ctl -D /data/postgresql/data -o '-c listen_addresses=*' -o '-c unix_socket_directories=/data/postgresql/run' start"
|
27 |
|
28 |
# Create database and roles
|
29 |
+
echo "Creating database and roles..."
|
30 |
su postgres -c "createuser -s postgres" || true
|
31 |
su postgres -c "createuser -s node" || true
|
32 |
su postgres -c "createdb -U postgres postgres" || true
|