Change permissionf for pleroma user during database creation
This commit is contained in:
parent
35bd3d34a5
commit
cb1b654c7c
|
@ -187,6 +187,10 @@ function pleroma_create_database {
|
|||
fi
|
||||
|
||||
add_postgresql_user pleroma "$PLEROMA_ADMIN_PASSWORD" encrypted
|
||||
run_system_query_postgresql "create database pleroma;"
|
||||
# temporarily allow the user to create databases
|
||||
run_system_query_postgresql "ALTER USER pleroma CREATEDB;"
|
||||
run_system_query_postgresql "ALTER USER pleroma SUPERUSER;"
|
||||
run_system_query_postgresql "GRANT ALL ON ALL tables IN SCHEMA public TO pleroma;"
|
||||
run_system_query_postgresql "GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma;"
|
||||
|
||||
|
@ -202,21 +206,28 @@ function pleroma_create_database {
|
|||
sed -i "s|email: .*|email: \"$MY_EMAIL_ADDRESS\",|g" $pleroma_config
|
||||
|
||||
cd $PLEROMA_DIR
|
||||
mix local.rebar --force
|
||||
chown -R pleroma:pleroma *
|
||||
sudo -u pleroma mix local.rebar --force
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $'mix local.rebar failed'
|
||||
exit 73528562
|
||||
fi
|
||||
mix ecto.create --force
|
||||
sudo -u pleroma mix local.hex --force
|
||||
sudo -u pleroma mix deps.compile mimerl
|
||||
sudo -u pleroma mix ecto.create --force
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $'mix ecto.create failed'
|
||||
exit 83653582
|
||||
fi
|
||||
mix ecto.migrate --force
|
||||
sudo -u pleroma mix ecto.migrate --force
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $'mix ecto.migrate failed'
|
||||
exit 73752573
|
||||
fi
|
||||
|
||||
# revoke the ability to create databases for this user
|
||||
run_system_query_postgresql "ALTER USER pleroma NOSUPERUSER;"
|
||||
run_system_query_postgresql "ALTER USER pleroma NOCREATEDB;"
|
||||
}
|
||||
|
||||
function reconfigure_pleroma {
|
||||
|
@ -637,12 +648,13 @@ function install_pleroma {
|
|||
|
||||
# back end
|
||||
cd $PLEROMA_DIR
|
||||
mix local.hex --force
|
||||
chown -R pleroma:pleroma *
|
||||
sudo -u pleroma mix local.hex --force
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $'mix local.hex failed'
|
||||
exit 1745673
|
||||
fi
|
||||
mix deps.get --force
|
||||
sudo -u pleroma mix deps.get --force
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $'mix deps.get failed'
|
||||
exit 7325733
|
||||
|
|
Loading…
Reference in New Issue