From ac8d0c49bd0acd06511010e3af1a39a5a2026c59 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 12:22:40 +0100 Subject: [PATCH 01/12] Solve issue during install ** (Postgrex.Error) ERROR 42501 (insufficient_privilege): permission denied to create extension "uuid-ossp" --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 72cdb31..db2b8c7 100755 --- a/scripts/install +++ b/scripts/install @@ -117,6 +117,8 @@ ynh_app_setting_set "$app" psqlpwd "$db_pwd" ynh_psql_test_if_first_run ynh_psql_create_user "$app" "$db_pwd" ynh_psql_execute_as_root \ +"ALTER USER $app WITH SUPERUSER;" +ynh_psql_execute_as_root \ "CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;" ynh_psql_execute_as_root "\connect $db_name CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS pg_trgm;" From 3cac9b9ca3f87b41559de2a57f609ae6cc7c4522 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 12:43:02 +0100 Subject: [PATCH 02/12] Solve an installation issue ** (Mix) The task "register_user" could not be found User creation has changed: https://git.pleroma.social/pleroma/pleroma/wikis/Admin%20tasks --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index db2b8c7..d4c651d 100755 --- a/scripts/install +++ b/scripts/install @@ -201,7 +201,7 @@ chown -R "$app":"$app" "$final_path" ( cd $final_path/$app && sudo -u "$app" mix deps.get ) ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force ) # Add user -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix register_user "$admin" "$admin_name" "$admin_email" "Moderator of this instance" "$admin_pass" ) +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix plemora.user "$admin_name" "$admin_email" "$admin_pass" ) # Make user moderator ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix set_moderator "$admin" true ) From 0118bd58be4dde2599c42c4c288f026ca518fb75 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 14:17:46 +0100 Subject: [PATCH 03/12] syntax correction ** (Mix) The task "register_user" could not be found --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d4c651d..29cd9bc 100755 --- a/scripts/install +++ b/scripts/install @@ -201,7 +201,7 @@ chown -R "$app":"$app" "$final_path" ( cd $final_path/$app && sudo -u "$app" mix deps.get ) ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force ) # Add user -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix plemora.user "$admin_name" "$admin_email" "$admin_pass" ) +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user "$admin_name" "$admin_email" "$admin_pass" ) # Make user moderator ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix set_moderator "$admin" true ) From 45a587e3ca8e095543ebb4eb2488de31853967e5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 14:38:33 +0100 Subject: [PATCH 04/12] Update Install Correct user creation and make user admin --- scripts/install | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 29cd9bc..f88e053 100755 --- a/scripts/install +++ b/scripts/install @@ -201,9 +201,11 @@ chown -R "$app":"$app" "$final_path" ( cd $final_path/$app && sudo -u "$app" mix deps.get ) ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force ) # Add user -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user "$admin_name" "$admin_email" "$admin_pass" ) +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" "$admin_pass" ) # Make user moderator -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix set_moderator "$admin" true ) +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --moderator ) +# Make user admin +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) #================================================= # SETUP SSOWAT From 402fb72917d9b2a68a38e599b0616ccdf9e6b91b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 14:52:14 +0100 Subject: [PATCH 05/12] Update Install To generate a password reset link that you can then send to the user --- scripts/install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index f88e053..bf537e9 100755 --- a/scripts/install +++ b/scripts/install @@ -201,11 +201,13 @@ chown -R "$app":"$app" "$final_path" ( cd $final_path/$app && sudo -u "$app" mix deps.get ) ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force ) # Add user -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" "$admin_pass" ) +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" ) # Make user moderator ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --moderator ) # Make user admin ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) +# Send reset password mail +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) #================================================= # SETUP SSOWAT From a4fba8b38d6301f7b83612607297083a5876f13e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 15:41:26 +0100 Subject: [PATCH 06/12] Update install --- scripts/install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index bf537e9..257985f 100755 --- a/scripts/install +++ b/scripts/install @@ -26,7 +26,7 @@ path_url="/" admin=$YNH_APP_ARG_ADMIN admin_email=$(ynh_user_get_info $admin 'mail') admin_name=$(ynh_user_get_info $admin 'firstname') -admin_pass=$(ynh_string_random 24) +admin_pass_reset_url="" is_public=$YNH_APP_ARG_IS_PUBLIC random_key=$(ynh_random 64) name=$YNH_APP_ARG_NAME @@ -206,8 +206,8 @@ chown -R "$app":"$app" "$final_path" ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --moderator ) # Make user admin ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) -# Send reset password mail -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) +# Retrieve a password reset link that you can then send to the user +admin_pass_reset_url=( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) #================================================= # SETUP SSOWAT @@ -246,7 +246,7 @@ message=" $app was successfully installed :) Please open your $app domain: https://$domain$path_url The moderator username is: $admin -The moderator password is: $admin_pass +To reset your password: $admin_pass_reset_url If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/pleroma_ynh/ If you are 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!" From 5ff38d9fc93d9a1811cb00dcabab30611eb82f3d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 16:50:29 +0100 Subject: [PATCH 07/12] trying to retrieve password reset link --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 257985f..c9fb8c4 100755 --- a/scripts/install +++ b/scripts/install @@ -207,7 +207,7 @@ chown -R "$app":"$app" "$final_path" # Make user admin ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) # Retrieve a password reset link that you can then send to the user -admin_pass_reset_url=( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) > admin_pass_reset_url #================================================= # SETUP SSOWAT From 52d7de7763d51b5435288f59b867e64351afd78a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 17:15:19 +0100 Subject: [PATCH 08/12] Update install --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c9fb8c4..1c8b388 100755 --- a/scripts/install +++ b/scripts/install @@ -207,7 +207,8 @@ chown -R "$app":"$app" "$final_path" # Make user admin ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) # Retrieve a password reset link that you can then send to the user -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) > admin_pass_reset_url +( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) +admin_pass_reset_url = $(!!) #================================================= # SETUP SSOWAT From a6f7a457856115ab1fd562dc7eb1e8b1109b42e4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 17:25:11 +0100 Subject: [PATCH 09/12] Attemp to retrieve password reset link --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 1c8b388..61d8e95 100755 --- a/scripts/install +++ b/scripts/install @@ -208,7 +208,7 @@ chown -R "$app":"$app" "$final_path" ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) # Retrieve a password reset link that you can then send to the user ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) -admin_pass_reset_url = $(!!) +admin_pass_reset_url=$(!!) #================================================= # SETUP SSOWAT From 4ef90435b1dd02da785e81926678726f47838c01 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 17:43:57 +0100 Subject: [PATCH 10/12] tryng to retrieve a password reset link --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 61d8e95..707fa3f 100755 --- a/scripts/install +++ b/scripts/install @@ -207,8 +207,7 @@ chown -R "$app":"$app" "$final_path" # Make user admin ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) # Retrieve a password reset link that you can then send to the user -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) -admin_pass_reset_url=$(!!) +admin_pass_reset_url=$( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) #================================================= # SETUP SSOWAT From 251a475c0fcdf22f053187701d87b7c2b978a6d5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 19:47:22 +0100 Subject: [PATCH 11/12] Retrieve last Line for the URL --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 707fa3f..5f887ca 100755 --- a/scripts/install +++ b/scripts/install @@ -207,7 +207,7 @@ chown -R "$app":"$app" "$final_path" # Make user admin ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) # Retrieve a password reset link that you can then send to the user -admin_pass_reset_url=$( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" ) +admin_pass_reset_url=$( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" | tail -1 ) #================================================= # SETUP SSOWAT From b9d548c4f1f3dbd713d9882954b9ead478a2b082 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Jan 2019 19:57:09 +0100 Subject: [PATCH 12/12] Retrieving password reset at the user creation --- scripts/install | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 5f887ca..81015f7 100755 --- a/scripts/install +++ b/scripts/install @@ -200,14 +200,12 @@ chown -R "$app":"$app" "$final_path" ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.rebar --force ) ( cd $final_path/$app && sudo -u "$app" mix deps.get ) ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force ) -# Add user -( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" ) +# Add user and retrieve a password reset link that you can then send to the user +admin_pass_reset_url=$( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" | tail -1 ) # Make user moderator ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --moderator ) # Make user admin ( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin ) -# Retrieve a password reset link that you can then send to the user -admin_pass_reset_url=$( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user reset_password "$admin" | tail -1 ) #================================================= # SETUP SSOWAT