From 549b29dd34b702c7cc77a6b9e792a70368d4bbdb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 11 Jul 2021 13:27:07 +0200 Subject: [PATCH] Update install --- scripts/install | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index f22fb99..b9daac6 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS #================================================= +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -38,26 +39,31 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +#================================================= +ynh_script_progression --message="Storing installation settings..." --weight=1 -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # STANDARD MODIFICATIONS #================================================= -# CREATE A SQL BDD +# CREATE A MYSQL DATABASE #================================================= +ynh_script_progression --message="Creating a MySQL database..." --weight=2 db_name=$(ynh_sanitize_dbid $app) -ynh_app_setting_set $app db_name $db_name -ynh_mysql_setup_db $db_name $db_name +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Setting up source files..." --weight=7 -ynh_app_setting_set $app final_path $final_path -ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path +ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$final_path" # Delete the install directory. ynh_secure_remove "$final_path/install" @@ -65,20 +71,26 @@ ynh_secure_remove "$final_path/install" #================================================= # NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Configuring system user..." --weight=2 -ynh_system_user_create $app # Créer un utilisateur système dédié à l'app +# Create a system user +ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure. +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP @@ -212,8 +224,9 @@ chmod 750 $final_path/backups #================================================= # RELOAD NGINX #================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_system_reload --service_name=nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # SEND A README FOR THE ADMIN @@ -224,3 +237,10 @@ message="If you facing an issue or want to improve this app, please open a new i !!! Be carreful when using this app, we have encountered many issues with the last upgrade. The next upgrade could be also difficult, and may need to reinstall the app and migrate manually." ynh_send_readme_to_admin --app_message="$message" --recipients="root" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of $app completed" --last +