Files
Cyril Rohr 588a526531 Make postgres13 the default version when installing OpenProject (#9088)
* Reexport PGVERSION and PGBIN according to existing install
* Display message if PostgreSQL version deprecated
* Do not launch postgres if using external URI
* Add script to auto-upgrade postgres database for all-in-one dockerfile
* Add documentation for packages and all-in-one docker image
2021-06-11 10:05:21 +02:00

13 lines
338 B
Bash
Executable File

#!/bin/bash
set -e
set -o pipefail
PGUSER=${PGUSER:=postgres}
PGPASSWORD=${PGPASSWORD:=postgres}
chown -R postgres.postgres "$PGDATA"
pwfile=$(mktemp)
echo "$PGPASSWORD" > $pwfile
chown postgres $pwfile
su postgres -c "$PGBIN/initdb --pgdata=${PGDATA} --username=${PGUSER} --encoding=unicode --auth=trust --pwfile=$pwfile"
rm -f $pwfile