Skip to content

Commit d438ffd

Browse files
authored
Fix: create pulp PostgreSQL role at startup (#1090)
* fix: rm PGDATA dir so initdb can create it with correct UID at runtime * fix: create pulp role in entrypoint for arbitrary UID environments
1 parent 4af64e5 commit d438ffd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

dev-container/entrypoint.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ until $PG_BIN/pg_isready -h localhost -q; do
2828
sleep 1
2929
done
3030

31-
# Create pulp database (idempotent)
31+
# Create pulp role and database (idempotent)
32+
$PG_BIN/psql -d postgres -tc "SELECT 1 FROM pg_roles WHERE rolname = 'pulp'" | grep -q 1 || \
33+
$PG_BIN/psql -d postgres -c "CREATE ROLE pulp WITH LOGIN SUPERUSER"
3234
$PG_BIN/psql -d postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'pulp'" | grep -q 1 || \
33-
$PG_BIN/psql -d postgres -c "CREATE DATABASE pulp"
35+
$PG_BIN/psql -d postgres -c "CREATE DATABASE pulp OWNER pulp"
3436

3537
# Start Redis
3638
echo "Starting Redis..."

0 commit comments

Comments
 (0)