forked from github/plane
35 lines
730 B
Bash
35 lines
730 B
Bash
|
#!/bin/bash
|
||
|
script=$(mktemp)
|
||
|
chmod 777 "$script"
|
||
|
|
||
|
chmod -R 750 /ext/pg_data
|
||
|
chown -R postgres:postgres /ext/pg_data
|
||
|
|
||
|
cat << "EOSH" > "$script"
|
||
|
set -m
|
||
|
|
||
|
PGBIN=/usr/lib/postgresql/16/bin/
|
||
|
PGSHARE=/usr/share/postgresql/16/
|
||
|
|
||
|
export POSTGRES_USER=plane
|
||
|
export POSTGRES_PASSWORD=plane
|
||
|
export POSTGRES_DB=plane
|
||
|
export PGDATA=/ext/pg_data
|
||
|
export ROOT_DB_URL=postgresql://plane:plane@localhost:5432/postgres
|
||
|
export TZ=GMT
|
||
|
|
||
|
pwfile=$(mktemp)
|
||
|
echo -n $POSTGRES_PASSWORD > $pwfile
|
||
|
|
||
|
$PGBIN/initdb -U $POSTGRES_USER --pwfile=$pwfile --no-locale -L $PGSHARE || true
|
||
|
$PGBIN/postgres -c 'max_connections=1000' & true;
|
||
|
|
||
|
until pg_isready; do sleep 1; done;
|
||
|
|
||
|
psql -d postgres -c 'create database plane;'
|
||
|
|
||
|
fg %1
|
||
|
EOSH
|
||
|
|
||
|
su postgres -c "/bin/bash $script"
|