pleroma/postgresql/setup.sh
Verita84 729cc4df2b fix
2021-08-25 08:39:26 -06:00

20 lines
826 B
Bash

#!/bin/bash
export SHELL="/bin/bash"
#Database Setup
mkdir /run/postgresql
mkdir -p /var/lib/postgresql/13/main
chown -R postgres:postgres /run/postgresql/
chown -R postgres:postgres /var/lib/postgresql
chown -R postgres:postgres /var/log/postgresql
su postgres -s $SHELL -lc "mkdir /var/lib/postgresql/data;chmod 0700 /var/lib/postgresql/data"
/etc/init.d/postgresql start
sleep 5
echo "CREATE USER pleroma WITH ENCRYPTED PASSWORD 'sql';" | su postgres -s $SHELL -lc psql
echo "create user root with encrypted password 'sql';"| su postgres -s $SHELL -lc psql
echo "ALTER ROLE pleroma SUPERUSER;" | su postgres -s $SHELL -lc psql
echo "CREATE DATABASE pleroma OWNER pleroma;" | su postgres -s $SHELL -lc psql
echo "grant all privileges on database pleroma to pleroma;" | su postgres -s $SHELL -lc psql
touch /configured.txt