Peertube database creation

This commit is contained in:
Bob Mottram 2017-11-29 22:02:55 +00:00
parent deefdf38eb
commit 1ab966a6ed
1 changed files with 3 additions and 12 deletions

View File

@ -62,14 +62,9 @@ function peertube_create_database {
fi
systemctl restart postgresql
add_postgresql_user peertube "$PEERTUBE_ADMIN_PASSWORD" encrypted
run_system_query_postgresql "create database peertube;"
# temporarily allow the user to create databases
run_system_query_postgresql "ALTER USER peertube CREATEDB;"
run_system_query_postgresql "ALTER USER peertube SUPERUSER;"
run_system_query_postgresql "GRANT ALL ON ALL tables IN SCHEMA public TO peertube;"
run_system_query_postgresql "GRANT ALL ON ALL sequences IN SCHEMA public TO peertube;"
run_system_query_postgresql "CREATE EXTENSION citext;"
run_system_query_postgresql "CREATE USER peertube WITH PASSWORD '$PEERTUBE_ADMIN_PASSWORD';"
run_system_query_postgresql "CREATE DATABASE peertube OWNER peertube;"
run_system_query_postgresql "GRANT ALL PRIVILEGES ON DATABASE peertube to peertube;"
run_system_query_postgresql "set statement_timeout to 40000;"
}
@ -545,10 +540,6 @@ function install_peertube {
exit 5293593
fi
# revoke the ability to create databases for this user
run_system_query_postgresql "ALTER USER peertube NOSUPERUSER;"
run_system_query_postgresql "ALTER USER peertube NOCREATEDB;"
PEERTUBE_ONION_HOSTNAME=$(add_onion_service peertube 80 ${PEERTUBE_ONION_PORT})
echo '[Unit]' > /etc/systemd/system/peertube.service