Skip to content

Commit 67a1d2f

Browse files
Merge pull request #4563 from esl/fix-postgres-setup
Use the PGDATA directory in docker-setup-postgres
2 parents 502ed0e + 366f68d commit 67a1d2f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tools/docker-setup-postgres.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
#!/bin/bash
22

3-
PGSQLDIR=/var/lib/postgresql/data
4-
53
# Preparing SSL certificates
6-
cp ${SQL_TEMP_DIR}/fake_cert.pem ${PGSQLDIR}/.
7-
cp ${SQL_TEMP_DIR}/fake_key.pem ${PGSQLDIR}/.
8-
chmod 600 ${PGSQLDIR}/fake*
9-
chown postgres:postgres ${PGSQLDIR}/fake*
4+
cp ${SQL_TEMP_DIR}/fake_cert.pem ${PGDATA}/.
5+
cp ${SQL_TEMP_DIR}/fake_key.pem ${PGDATA}/.
6+
chmod 600 ${PGDATA}/fake*
7+
chown postgres:postgres ${PGDATA}/fake*
108

119
#Copy custom config
12-
cp ${SQL_TEMP_DIR}/postgresql.conf ${PGSQLDIR}/.
13-
cp ${SQL_TEMP_DIR}/pg_hba.conf ${PGSQLDIR}/.
10+
cp ${SQL_TEMP_DIR}/postgresql.conf ${PGDATA}/.
11+
cp ${SQL_TEMP_DIR}/pg_hba.conf ${PGDATA}/.
1412

1513
#Copy db scheme
16-
cp ${SQL_TEMP_DIR}/pg.sql ${PGSQLDIR}/.
14+
cp ${SQL_TEMP_DIR}/pg.sql ${PGDATA}/.
1715

1816
# Configuring postgres
1917
psql -U postgres -c "CREATE ROLE mongooseim PASSWORD 'mongooseim_secret' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;"
2018
psql -U postgres -c "CREATE DATABASE mongooseim;"
2119
# Creating schema
22-
psql -U postgres -q -d mongooseim -f ${PGSQLDIR}/pg.sql
20+
psql -U postgres -q -d mongooseim -f ${PGDATA}/pg.sql

0 commit comments

Comments
 (0)