From 04cafbc8e4b16b46a4a4c6506ee63d35298f4f0a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 5 Feb 2019 19:26:12 +0100 Subject: [PATCH] Cleanup --- manifest.json | 2 +- scripts/backup | 2 +- scripts/install | 10 +++++----- scripts/remove | 2 +- scripts/restore | 10 +++++----- scripts/upgrade | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/manifest.json b/manifest.json index e47d88d..b8f0f5e 100755 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon", "fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon" }, - "version": "0.9.0~ynh2", + "version": "0.9.0~ynh3", "url": "https://git.pleroma.social/pleroma/pleroma", "license": "AGPL-3.0-only", "maintainer": { diff --git a/scripts/backup b/scripts/backup index f239428..4b23447 100755 --- a/scripts/backup +++ b/scripts/backup @@ -29,7 +29,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get "$app" db_name) +db_name=$(ynh_app_setting_get $app db_name) cache=$(ynh_app_setting_get "$app" cache) #================================================= diff --git a/scripts/install b/scripts/install index 3496678..58885a3 100755 --- a/scripts/install +++ b/scripts/install @@ -44,7 +44,6 @@ then admin="test" fi - ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID ### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) @@ -128,7 +127,7 @@ sudo apt-key add erlang_solutions.asc sudo rm erlang_solutions.asc # install dependencies -ynh_install_app_dependencies git build-essential postgresql postgresql-contrib openssl g++ apt-transport-https erlang-inets elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools +ynh_install_app_dependencies git build-essential openssl ssh sudo postgresql postgresql-contrib elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools #================================================= # CREATE A POSTGRESQL DATABASE @@ -141,9 +140,9 @@ ynh_install_app_dependencies git build-essential postgresql postgresql-contrib o ### - Remove also the section "REMOVE THE POSTGRESQL DATABASE" in the remove script ### - As well as the section "RESTORE THE POSTGRESQL DATABASE" in the restore script -db_name="$app" +db_name=$(ynh_sanitize_dbid $app) db_pwd=$(ynh_string_random 30) -ynh_app_setting_set "$app" db_name "$db_name" +ynh_app_setting_set $app db_name $db_name ynh_app_setting_set "$app" db_pwd "$db_pwd" ynh_psql_test_if_first_run ynh_psql_create_user "$app" "$db_pwd" @@ -219,6 +218,7 @@ ynh_system_user_create "$app" "$final_path" #================================================= # MODIFY A CONFIG FILE #================================================= + cp -f ../conf/generated_config.exs "$final_path/$app/config/prod.secret.exs" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/config/prod.secret.exs" @@ -253,6 +253,7 @@ cp -f ../conf/prod.exs "$final_path/$app/config/prod.exs" #================================================= # MAKE SETUP #================================================= + # Give permission to the final_path chown -R "$app":"$app" "$final_path" @@ -271,7 +272,6 @@ pushd $final_path/$app ynh_replace_string "administrator@example.com" "__ADMIN_EMAIL__" "$final_path/$app/config/prod.secret.exs" popd - #================================================= # SETUP SYSTEMD #================================================= diff --git a/scripts/remove b/scripts/remove index e22f895..14b3bce 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) port=$(ynh_app_setting_get $app port) -db_name=$(ynh_app_setting_get "$app" db_name) +db_name=$(ynh_app_setting_get $app db_name) final_path=$(ynh_app_setting_get $app final_path) cache=$(ynh_app_setting_get "$app" cache) diff --git a/scripts/restore b/scripts/restore index c4a54d5..f71b46b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -30,10 +30,10 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) path_url="/" final_path=$(ynh_app_setting_get $app final_path) -port=$(ynh_app_setting_get "$app" port) -db_name=$(ynh_app_setting_get "$app" db_name) -db_pwd=$(ynh_app_setting_get "$app" db_pwd) -cache=$(ynh_app_setting_get "$app" cache) +port=$(ynh_app_setting_get $app port) +db_name=$(ynh_app_setting_get $app db_name) +db_pwd=$(ynh_app_setting_get $app db_pwd) +cache=$(ynh_app_setting_get $app cache) #================================================= @@ -117,7 +117,7 @@ sudo apt-key add erlang_solutions.asc sudo rm erlang_solutions.asc # install dependencies -ynh_install_app_dependencies git build-essential postgresql postgresql-contrib openssl g++ apt-transport-https erlang-inets elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools +ynh_install_app_dependencies git build-essential openssl ssh sudo postgresql postgresql-contrib elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index a5d050e..babcf66 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -142,8 +142,7 @@ sudo apt-key add erlang_solutions.asc sudo rm erlang_solutions.asc # install dependencies -ynh_install_app_dependencies git build-essential postgresql postgresql-contrib openssl g++ apt-transport-https erlang-inets elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools - +ynh_install_app_dependencies git build-essential openssl ssh sudo postgresql postgresql-contrib elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools #================================================= # CREATE DEDICATED USER @@ -164,6 +163,7 @@ ynh_system_user_create "$app" "$final_path" #================================================= # MODIFY A CONFIG FILE #================================================= + cp -f ../conf/generated_config.exs "$final_path/$app/config/prod.secret.exs" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/config/prod.secret.exs" @@ -212,7 +212,7 @@ cp -f ../conf/prod.exs "$final_path/$app/config/prod.exs" # Give permission to the final_path chown -R "$app":"$app" "$final_path" pushd $final_path/$app - sudo -u "$app" mix deps.get + sudo -u "$app" MIX_ENV=prod mix deps.get sudo -u "$app" MIX_ENV=prod mix ecto.migrate --force popd