From b2c5b653b63e4bfc8915af90f3cfdb81e0c1b755 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 1 Nov 2020 12:37:36 +0100 Subject: [PATCH] Small fixes --- conf/.env | 6 +++--- manifest.json | 2 +- scripts/backup | 3 ++- scripts/install | 13 ++++++++----- scripts/restore | 3 ++- scripts/upgrade | 9 ++++++--- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/conf/.env b/conf/.env index d5add3f..129bc5d 100644 --- a/conf/.env +++ b/conf/.env @@ -4,7 +4,7 @@ APP_ENV=production APP_DEBUG=false APP_KEY=ChangeMe -APP_URL= +APP_URL=http://__DOMAIN__ APP_TIMEZONE='UTC' APP_LOCALE=__LANGUAGE__ @@ -39,9 +39,9 @@ MAIL_PORT=25 MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION=null -MAIL_FROM_ADDR=snipeit@yunodomain +MAIL_FROM_ADDR=snipeit@__DOMAIN__ MAIL_FROM_NAME='Snip-IT' -MAIL_REPLYTO_ADDR=snipeit@yunodomain +MAIL_REPLYTO_ADDR=snipeit@__DOMAIN__ MAIL_REPLYTO_NAME='Snipe-IT' # -------------------------------------------- diff --git a/manifest.json b/manifest.json index 0e6b82c..e84b48d 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.8" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/backup b/scripts/backup index 12128ac..84e5d45 100755 --- a/scripts/backup +++ b/scripts/backup @@ -25,6 +25,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -47,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index 9e57038..68b7ad5 100755 --- a/scripts/install +++ b/scripts/install @@ -97,6 +97,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP @@ -121,14 +122,16 @@ cp ../conf/.env $final_path/.env ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.env" ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$final_path/.env" -ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.env" ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/.env" # setup application config -( cd $final_path && php$YNH_PHP_VERSION artisan key:generate -n --force --env) -( cd $final_path && php$YNH_PHP_VERSION artisan migrate -n --force) -( cd $final_path && php$YNH_PHP_VERSION artisan config:clear -n) -( cd $final_path && php$YNH_PHP_VERSION artisan config:cache -n) +pushd "$final_path" + php$phpversion artisan key:generate -n --force --env + php$phpversion artisan migrate -n --force + php$phpversion artisan config:clear -n + php$phpversion artisan config:cache -n +popd #================================================= # STORE THE CONFIG FILE CHECKSUM diff --git a/scripts/restore b/scripts/restore index c015f6a..118113d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -26,6 +26,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -103,7 +104,7 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./ #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 -ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2ae6dd9..9666da7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public) 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) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -127,9 +128,11 @@ ynh_install_composer ynh_exec_warn_less ynh_composer_exec --commands=\"dump-autoload\" -( cd $final_path && php$YNH_PHP_VERSION artisan migrate -n --force) -( cd $final_path && php$YNH_PHP_VERSION artisan config:clear -n ) -( cd $final_path && php$YNH_PHP_VERSION artisan config:cache -n ) +pushd "$final_path" + php$phpversion artisan migrate -n --force + php$phpversion artisan config:clear -n + php$phpversion artisan config:cache -n +popd ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.