diff --git a/README.md b/README.md index 7623870..1653358 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,63 @@ -# ![ulogger_logo_small](https://cloud.githubusercontent.com/assets/3366666/24080878/0288f046-0ca8-11e7-9ffd-753e5c417756.png) μlogger +# μlogger for YunoHost -[![Integration level](https://dash.yunohost.org/integration/ulogger.svg)](https://dash.yunohost.org/appci/app/ulogger) -[![Install ulogger with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=ulogger) +[![Integration level](https://dash.yunohost.org/integration/ulogger.svg)](https://dash.yunohost.org/appci/app/ulogger) ![](https://ci-apps.yunohost.org/ci/badges/ulogger.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ulogger.maintain.svg) +[![Install μlogger with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ulogger) -- [Yunohost project](https://yunohost.org) -- [μlogger](https://github.com/bfabiszewski/ulogger-server) +> *This package allows you to install μlogger quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* -## Description of the app. -This is a web application for real-time collection of geolocation data, tracks viewing and management. Together with a dedicated [μlogger mobile client](https://github.com/bfabiszewski/ulogger-android) it may be used as a complete self hosted server–client solution for logging and monitoring users' geolocation.

+## Overview +This is a web application for real-time collection of geolocation data, tracks viewing and management. Together with a dedicated [μlogger mobile client](https://github.com/bfabiszewski/ulogger-android) it may be used as a complete self hosted server–client solution for logging and monitoring users' geolocation. -Version: 0.5

+**Version:** 0.5 -## Live demo: -- http://ulogger.fabiszewski.net/ (test track upload and editing, login: demo, password: demo) +## Demo +* [Official demo](http://ulogger.fabiszewski.net/) (login: demo, password: demo) -## Features: -- simple -- allows live tracking -- track statistics -- altitudes graph -- multiple users -- user authentication -- Google Maps API v3 -- OpenLayers v2 or v3 (OpenStreet and other layers) -- ajax -- user preferences stored in cookies -- simple admin menu -- export tracks to gpx and kml -- import tracks from gpx +## Configuration -## To-Do's -- [ ] Use config file from the sources rather then conf/config.php for the configuration. +How to configure this app: From an admin panel, a plain file with SSH, or any other way. -**Multi-user:** Yes +## Documentation + + * Official documentation: Link to the official documentation of this app + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +#### Multi-user support + +* Are LDAP and HTTP auth supported? **No** +* Can the app be used by multiple users? **Yes** #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ulogger%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/ulogger/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ulogger%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/ulogger/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/ulogger%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/ulogger/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/ulogger%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/ulogger/) +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/ulogger_ynh/issues + * Upstream app repository: https://github.com/bfabiszewski/ulogger-server + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/ulogger_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/ulogger_ynh/tree/testing --debug +or +sudo yunohost app upgrade ulogger -u https://github.com/YunoHost-Apps/ulogger_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index dfc3ed3..0860708 100644 --- a/check_process +++ b/check_process @@ -20,22 +20,8 @@ upgrade=1 backup_restore=1 multi_instance=1 - incorrect_path=1 port_already_use=0 change_url=0 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: - Level 4=na -# Level 5: - Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email=anmol@datamol.org Notification=change diff --git a/conf/nginx.conf b/conf/nginx.conf index 9aaa771..f220fda 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,5 @@ -location __PATH__ { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { # Path to source alias __FINALPATH__/ ; @@ -7,7 +8,6 @@ location __PATH__ { rewrite ^ https://$server_name$request_uri? permanent; } - # Example PHP configuration (remove if not used) index index.html index.php; # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file @@ -17,21 +17,12 @@ location __PATH__ { location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; - - # If you don't use a dedicated fpm config for your app, - # use a general fpm pool. - # This is to be used INSTEAD of line above - # Don't forget to adjust scripts install/upgrade/remove/backup accordingly - # - #fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } - # PHP configuration end # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/manifest.json b/manifest.json index 2c4caf0..645149c 100644 --- a/manifest.json +++ b/manifest.json @@ -3,18 +3,18 @@ "id": "ulogger", "packaging_format": 1, "description": { - "en": "A real-time collection of geolocation data, tracks viewing and management.", + "en": "Real-time collection of geolocation data, tracks viewing and management.", "fr": "Géolocalisation en temps réel, gestion et affichage de traces." }, - "version": "0.5~ynh1", + "version": "0.5~ynh2", "url": "https://github.com/bfabiszewski/ulogger-server", - "license": "GPL", + "license": "AGPL-3.0-only", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.0.0" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ @@ -28,7 +28,8 @@ "name": "domain", "type": "domain", "ask": { - "en": "Choose a domain name for ulogger" + "en": "Choose a domain name for ulogger", + "fr": "Choisissez un nom de domaine pour ulogger" }, "example": "example.com" }, @@ -36,7 +37,8 @@ "name": "path", "type": "path", "ask": { - "en": "Choose a path for ulogger" + "en": "Choose a path for ulogger", + "fr": "Choisissez un chemin pour ulogger" }, "example": "/ulogger", "default": "/ulogger" @@ -45,7 +47,8 @@ "name": "admin", "type": "string", "ask": { - "en": "Choose an admin user" + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" }, "example": "johndoe" }, @@ -53,14 +56,17 @@ "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public application?" + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" }, "default": true }, { "name": "language", + "type": "string", "ask": { - "en": "Choose the application language" + "en": "Choose the application language", + "fr": "Choisissez la langue de l'application" }, "choices": ["fr", "en", "pl", "de", "hu", "it" ], "default": "en" diff --git a/scripts/_common.sh b/scripts/_common.sh index 90061b9..9e3b7ca 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -80,5 +80,5 @@ ynh_smart_mktemp () { ynh_die "Insufficient free space to continue..." fi - echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" + echo "$(mktemp --directory --tmpdir="$tmpdir")" } diff --git a/scripts/backup b/scripts/backup index 1a4c268..7f9fee5 100644 --- a/scripts/backup +++ b/scripts/backup @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -33,32 +33,32 @@ domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info "Backing up the main app directory..." ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Backing up php-fpm configuration..." ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info "Backing up the MySQL database..." +ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db "$db_name" > db.sql @@ -66,4 +66,4 @@ ynh_mysql_dump_db "$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 398dab1..dc5fe1e 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -31,25 +30,13 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE password=$(ynh_string_random 12) -### 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", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info "Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -61,7 +48,7 @@ admin_password=$(openssl passwd -1 -salt xyz $password) #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info "Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url @@ -69,24 +56,10 @@ ynh_app_setting_set $app admin $admin ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app language $language -#================================================= -# STANDARD MODIFICATIONS -#================================================= - - #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_print_info "Creating a MySQL database..." - -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script +ynh_script_progression --message="Creating a MySQL database..." db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name @@ -95,25 +68,18 @@ ynh_mysql_setup_db $db_name $db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files..." - -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" #Copy config.php to the final path -sudo cp -r ../conf/config.php $final_path - +cp -r ../conf/config.php $final_path #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Configuring nginx web server..." - -### `ynh_add_nginx_config` will use the file conf/nginx.conf +ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -121,7 +87,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Configuring system user..." +ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create $app @@ -129,23 +95,11 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Configuring php-fpm..." - -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script +ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated php-fpm config ynh_add_fpm_config - #================================================= # SPECIFIC SETUP #================================================= @@ -166,27 +120,21 @@ ynh_replace_string "^\$enabled = false;" "\$enabled = true;" "$final_path/script ynh_replace_string "__admin__" "$admin" ../conf/admin.sql ynh_replace_string "__admin_pwd__" "$admin_password" ../conf/admin.sql -# Set the app as temporarily public for curl call -ynh_print_info "Configuring SSOwat..." -ynh_app_setting_set $app skipped_uris "/" -# Reload SSOwat config -yunohost app ssowatconf +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= -# Reload Nginx -systemctl reload nginx +# Set the app as temporarily public for cURL call +ynh_permission_update --permission "main" --add "visitors" -# Installation with curl -ynh_print_info "Finalizing installation..." +# Reload NGINX +ynh_systemd_action --service_name=nginx --action=reload + +ynh_script_progression --message="Finalizing installation..." ynh_local_curl "/scripts/setup.php" "command=setup" -# Remove the public access -if [ $is_public -eq 0 ] -then - ynh_app_setting_delete $app skipped_uris -fi - #Add the admin account to the database ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/admin.sql" #Disable setup for security @@ -196,10 +144,6 @@ ynh_replace_string "^\$enabled = true;" "\$enabled = false;" "$final_path/script # STORE THE CONFIG FILE CHECKSUM #================================================= -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/config.php" @@ -212,25 +156,23 @@ ynh_store_file_checksum "$final_path/config.php" # Set permissions to app files chown -R $app: $final_path - #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." -# Make app public if necessary -if [ $is_public -eq 1 ] +# Make app public if necessary or protect it +if [ $is_public -eq 0 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set $app unprotected_uris "/" + ynh_permission_update --permission "main" --remove "visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # SEND A README FOR THE ADMIN @@ -251,4 +193,4 @@ ynh_send_readme_to_admin "$message" # END OF SCRIPT #================================================= -ynh_print_info "Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index da291ac..f0bf565 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -21,15 +21,10 @@ db_name=$(ynh_app_setting_get $app db_name) db_user=$db_name final_path=$(ynh_app_setting_get $app final_path) -#================================================= -# STANDARD REMOVE -#================================================= - - #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_print_info "Removing the MySQL database" +ynh_script_progression --message="Removing the MySQL database" # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_user $db_name @@ -37,7 +32,7 @@ ynh_mysql_remove_db $db_user $db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" @@ -45,7 +40,7 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_script_progression --message="Removing NGINX web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config @@ -53,7 +48,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Removing php-fpm configuration" +ynh_script_progression --message="Removing PHP-FPM configuration" # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -63,7 +58,7 @@ ynh_remove_fpm_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user" # Delete a system user ynh_system_user_delete $app @@ -72,4 +67,4 @@ ynh_system_user_delete $app # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index fe9eb1f..4dd5b96 100644 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -24,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -36,7 +35,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -54,14 +53,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info "Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file "$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info "Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -69,7 +68,7 @@ ynh_system_user_create $app #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_print_info "Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd @@ -86,14 +85,13 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info "Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -systemctl reload php7.0-fpm -systemctl reload nginx +ynh_systemd_action --service_name=php7.0-fpm --action=reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Restoration completed for $app" - +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index c4c74fb..ef6c72c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -26,7 +26,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info "Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -52,7 +52,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info "Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -88,23 +88,22 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" #copy cofig.php from tmp to final_path -sudo cp -a "$tmpdir/config.php" "${final_path}" +cp -a "$tmpdir/config.php" "${final_path}" #remove tmp dir -sudo rm -Rf "$tmpdir" - +ynh_secure_remove "$tmpdir" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -112,7 +111,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create $app @@ -120,7 +119,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -129,13 +128,10 @@ ynh_add_fpm_config # SPECIFIC UPGRADE #================================================= -### 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. ynh_backup_if_checksum_is_different "$final_path/conf.php" # Recalculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/config.php" - #================================================= # GENERIC FINALIZATION #================================================= @@ -145,27 +141,15 @@ ynh_store_file_checksum "$final_path/config.php" # Set right permissions for curl installation chown -R $app: $final_path -#================================================= -# SETUP SSOWAT -#================================================= -ynh_print_info "Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set $app unprotected_uris "/" -fi - #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed"