From 3c7da5aa2441c0bd31bca65997ee664236a23ac3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 28 Jan 2022 11:11:32 +0100 Subject: [PATCH] Fix --- conf/.env.example | 2 +- scripts/_common.sh | 2 +- scripts/change_url | 7 +++++-- scripts/install | 10 +++++----- scripts/upgrade | 23 ++--------------------- 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/conf/.env.example b/conf/.env.example index b7c1110..eeb8cf2 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -7,7 +7,7 @@ # wrap the entire value in quotes. (eg. MAIL_FROM_NAME="BookStack Mailer") # Application key -APP_KEY=SomeRandomString +APP_KEY=__STRING__ # Application URL APP_URL=https://__DOMAIN____PATH__ diff --git a/scripts/_common.sh b/scripts/_common.sh index e9fac5a..289f09f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="8.0" pkg_dependencies="php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-tidy php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd" diff --git a/scripts/change_url b/scripts/change_url index 42ec4d0..4bd7d51 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,7 +30,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) +mail_pwd=$(ynh_app_setting_get --app=$app --key=mail_pwd) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -102,12 +105,12 @@ fi path_url="$new_path" domain="$new_domain" -mail_pwd=$(ynh_string_random --length=12) ynh_add_config --template=../conf/.env.example --destination=$final_path/.env - chmod 600 $final_path/.env + + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/install b/scripts/install index 2aa6d41..3254826 100644 --- a/scripts/install +++ b/scripts/install @@ -25,6 +25,9 @@ path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE phpversion=$YNH_PHP_VERSION +string=$(ynh_string_random --length=64) +redis_db=$(ynh_redis_get_free_db) +mail_pwd=$(ynh_string_random --length=12) app=$YNH_APP_INSTANCE_NAME @@ -48,6 +51,8 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion +ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db +ynh_app_setting_set --app=$app --key=mail_pwd --value=$mail_pwd #================================================= # INSTALL DEPENDENCIES @@ -118,11 +123,6 @@ ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_ar # MODIFY A CONFIG FILE #================================================= -# Configure redis -redis_db=$(ynh_redis_get_free_db) -ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" -mail_pwd=$(ynh_string_random --length=12) - ynh_add_config --template=../conf/.env.example --destination=$final_path/.env chmod 600 $final_path/.env diff --git a/scripts/upgrade b/scripts/upgrade index 6dbcbd6..c8eafe0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -61,7 +61,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 pushd $final_path - git pull --quiet origin release && ynh_install_composer --install_args="--no-dev" && php$phpversion artisan migrate --no-interaction --force + git pull --quiet origin release && ynh_install_composer --install_args="--no-dev" + php$phpversion artisan migrate --force popd fi @@ -92,26 +93,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config -# #================================================= -# # INSTALL LYCHEE WITH COMPOSER -# #================================================= -# ynh_script_progression --message="Installing BookStack with Composer..." --weight=5 - -# # Install composer -# ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_args="--no-dev" - -# #================================================= -# # FINAL BOOKSTACK INSTALL -# #================================================= -# ynh_script_progression --message="Install BookStack" --weight=5 - -# pushd $final_path -# php$phpversion artisan migrate --no-interaction -# php$phpversion artisan cache:clear --no-interaction -# php$phpversion artisan config:clear --no-interaction -# php$phpversion artisan view:clear --no-interaction -# popd - #================================================= # RELOAD NGINX #=================================================