Commit ea75e1cc authored by Spctrl's avatar Spctrl

verify password, add is_public checkbox, general touch ups

parent 9f18a81f
......@@ -42,5 +42,5 @@ Extra info:
* On installation you'll be able to chose a dedicated domain for Pleroma. You'll also be asked for a username and password a user. This user will have moderator rights.
* Pleroma will be listed in the admin-panel under services, so you can stop and start the service there.
* Postgresql will also be listed in the admin-panel
* Registrations are open by default
* You can choose to close sign-up on installation, but you'll need to create invite tokens if you want others to join your instance as well. You can do this by accessing your yunohost server over ssh and run `MIX_ENV=prod mix generate_invite_token`. See: https://git.pleroma.social/pleroma/pleroma/wikis/Admin%20tasks
* If you're not afraid of the terminal, check out https://git.pleroma.social/pleroma/pleroma/wikis/home to see what more you can do with your awesome instance!
......@@ -38,24 +38,40 @@
"example": "YUNoHost Pleroma?"
},
{
"name": "admin_name",
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Give a username for the admin user that will be created."
"en": "Is it a public instance? (registrations are open to everyone)"
},
"example": "admin"
"default": true
},
{
"name": "admin_password",
"name": "instance_user",
"ask": {
"en": "A user with moderator rights will be created. Give a username for this user."
},
"example": "moderator"
},
{
"name": "instance_user_password",
"type": "password",
"ask": {
"en": "Set the password for the moderator user"
},
"example": "myreallystrongtpassword"
},
{
"name": "instance_user_password_verify",
"type": "password",
"ask": {
"en": "Set the password for the admin user"
"en": "Type the password for the moderator user again"
},
"example": "myreallystrongtpassword"
},
{
"name": "admin_mail",
"name": "instance_user_mail",
"ask": {
"en": "The mailadress for the admin user. This will be the mailadres for the admin user and will also be visseble for other people on your pleroma instance."
"en": "The mailadress for the moderator user. This will be the mailadres for the moderator user and will also be visseble for other people on your pleroma instance."
},
"example": "pleroma@mypleroma.org"
}
......
......@@ -19,22 +19,26 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
# TODO: I'm talking about an admin user, but administration happens through the terminal. This is a user with moderator rights. I should change the var name throughout the scripts.
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
server_name=$YNH_APP_ARG_INSTANCE_NAME
admin_user=$YNH_APP_ARG_ADMIN_NAME
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
admin_mail=$YNH_APP_ARG_ADMIN_MAIL
email=$admin_mail
is_public=1 # TODO make this a question. Non-public means no new subscriptions.
instance_user=$YNH_APP_ARG_INSTANCE_USER
instance_user_password=$YNH_APP_ARG_INSTANCE_USER_PASSWORD
instance_user_password_verify=$YNH_APP_ARG_INSTANCE_USER_PASSWORD_VERIFY
instance_user_mail=$YNH_APP_ARG_INSTANCE_USER_MAIL
email=$instance_user_mail
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
db_name="pleroma_dev" # Change this to $app when DB-name can be easily chosen
db_name="pleroma_dev" # TODO: Change this to $app when DB-name can be easily chosen. see: https://git.pleroma.social/pleroma/pleroma/merge_requests/243
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
if [ $instance_user_password != $instance_user_password_verify ]
then ynh_die "Passwords didn't match"
fi
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
......@@ -72,14 +76,13 @@ then
rm erlang_solutions.asc
fi
apt-get update
# TODO:
echo "For some reason I get an error during update the first time I try to install this."
echo "The second time it only gets 19 things instead of 51. Do I do something wrong when adding the erlang-solution?"
# TODO: For some reason I get an error during update the first time I try to install this. The second time it only gets 19 things instead of 51. Do I do something wrong when adding erlang-solution?
ynh_install_app_dependencies git build-essential postgresql-9.6 postgresql-contrib-9.6 elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools esl-erlang
#=================================================
# CREATE DEDICATED USER
#=================================================
mkdir --parents $final_path
useradd $app --home-dir=$final_path
......@@ -88,7 +91,7 @@ useradd $app --home-dir=$final_path
#=================================================
git clone https://git.pleroma.social/pleroma/pleroma $final_path/pleroma
# replace the generate_config file with a modified one to have it non-interactive
# TODO: replace the generate_config file with a modified one to have it non-interactive
# There's a merge comming in Pleroma that makes it all non-interactive
# https://git.pleroma.social/pleroma/pleroma/merge_requests/243
cp ../conf/generate_config.ex $final_path/pleroma/lib/mix/tasks/generate_config.ex
......@@ -107,6 +110,7 @@ cat $final_path/pleroma/config/setup_db.psql | grep "<%= .* %>" && ynh_die "$fin
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
# Fail installation if database already exists.
! su - postgres -c "psql -lqt" | cut -d \| -f 1 | grep -ws $db_name || ynh_die 'The database $db_name already exists'
......@@ -129,12 +133,12 @@ then
fi
#=================================================
# ADD ADMIN USER
# ADD USER TO INSTANCE
#=================================================
# the tasks fails, so I have to set the the pasword for the postgresql DB-user first.
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
su - $app -c "cd $final_path/pleroma; MIX_ENV=prod mix local.hex --force; MIX_ENV=prod mix register_user $admin_user $admin_user $admin_mail 'Moderator of this instance' $admin_password; MIX_ENV=prod mix set_moderator $admin_user true;"
su - $app -c "cd $final_path/pleroma; MIX_ENV=prod mix local.hex --force; MIX_ENV=prod mix register_user $instance_user $instance_user $instance_user_mail 'Moderator of this instance' $instance_user_password; MIX_ENV=prod mix set_moderator $instance_user true;"
#=================================================
# NGINX CONFIGURATION
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment