From 6f2057ccd6653fb2a71ea689c398a5f5308205f8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 08:54:30 +0100 Subject: [PATCH 1/9] fix linter warnings --- check_process | 14 -------------- manifest.json | 3 ++- scripts/upgrade | 5 ++--- 3 files changed, 4 insertions(+), 18 deletions(-) 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/manifest.json b/manifest.json index 2c4caf0..f1a3c08 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.0.0" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ @@ -59,6 +59,7 @@ }, { "name": "language", + "type": "string", "ask": { "en": "Choose the application language" }, diff --git a/scripts/upgrade b/scripts/upgrade index c4c74fb..e6afb73 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,10 +95,10 @@ 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" #================================================= @@ -135,7 +135,6 @@ 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 #================================================= From 70de55504d9dc9fff3c99600238a1a0ca3b30209 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:03:08 +0100 Subject: [PATCH 2/9] Fix warnings --- conf/nginx.conf | 2 +- scripts/backup | 14 +++++----- scripts/install | 70 +++++++++---------------------------------------- scripts/upgrade | 31 +++++++--------------- 4 files changed, 29 insertions(+), 88 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 9aaa771..f3341ad 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,4 +1,4 @@ -location __PATH__ { +location __PATH__/ { # Path to source alias __FINALPATH__/ ; 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..5c53fce 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,23 +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_script_progression --message="Configuring nginx web server..." ### `ynh_add_nginx_config` will use the file conf/nginx.conf @@ -121,7 +89,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 +97,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 #================================================= @@ -212,23 +168,21 @@ 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 SSOwat..." # 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 "/" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." systemctl reload nginx @@ -251,4 +205,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/upgrade b/scripts/upgrade index e6afb73..55d85ea 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,7 +88,7 @@ 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" @@ -100,11 +100,10 @@ cp -a "$tmpdir/config.php" "${final_path}" #remove tmp dir 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 @@ -144,22 +143,10 @@ 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 @@ -167,4 +154,4 @@ systemctl reload nginx # END OF SCRIPT #================================================= -ynh_print_info "Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" From bc9623dc8385e5fec36faef80ccfde0ad17fb25f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:04:21 +0100 Subject: [PATCH 3/9] Update README.md --- README.md | 79 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 7623870..dc3c5ad 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:** 1.0 -## 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 +``` From fb48c76cd0076b5a9257d6a8c891a4bb5e78b769 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:09:25 +0100 Subject: [PATCH 4/9] Fix --- conf/nginx.conf | 10 ---------- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/install | 2 +- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f3341ad..d106044 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -7,7 +7,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 +16,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 f1a3c08..d1a4683 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "version": "0.5~ynh1", "url": "https://github.com/bfabiszewski/ulogger-server", - "license": "GPL", + "license": "AGPL-3.0-only", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" 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/install b/scripts/install index 5c53fce..5dd3903 100644 --- a/scripts/install +++ b/scripts/install @@ -171,7 +171,7 @@ chown -R $app: $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] From 499724f278d67303a910b8ba693e884d641a4160 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:14:29 +0100 Subject: [PATCH 5/9] Fix --- manifest.json | 2 +- scripts/install | 6 ------ scripts/restore | 1 - scripts/upgrade | 2 -- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/manifest.json b/manifest.json index d1a4683..b36abe9 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "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", diff --git a/scripts/install b/scripts/install index 5dd3903..42ca451 100644 --- a/scripts/install +++ b/scripts/install @@ -81,8 +81,6 @@ cp -r ../conf/config.php $final_path #================================================= ynh_script_progression --message="Configuring nginx web server..." -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated nginx config ynh_add_nginx_config @@ -152,10 +150,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" diff --git a/scripts/restore b/scripts/restore index fe9eb1f..7d379d6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -96,4 +96,3 @@ systemctl reload nginx #================================================= ynh_print_info "Restoration completed for $app" - diff --git a/scripts/upgrade b/scripts/upgrade index 55d85ea..85ab0e1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -128,8 +128,6 @@ 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" From 912f538ca60d1b16cedaa0c0baca4547511adc9f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:17:31 +0100 Subject: [PATCH 6/9] Update install --- scripts/install | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/scripts/install b/scripts/install index 42ca451..7b2ba22 100644 --- a/scripts/install +++ b/scripts/install @@ -120,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 @@ -167,10 +161,10 @@ chown -R $app: $final_path #================================================= 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 - ynh_permission_update --permission="main" --add="visitors" + ynh_permission_update --permission "main" --remove "visitors" fi #================================================= @@ -178,7 +172,7 @@ fi #================================================= 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 From 72e16e6d9f524811de3183366e47032148a3a054 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:29:32 +0100 Subject: [PATCH 7/9] Update nginx.conf --- conf/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index d106044..f220fda 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,4 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { # Path to source From 747c04cb3bf676855726da75faa1897a910d69df Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:37:10 +0100 Subject: [PATCH 8/9] Update manifest.json --- manifest.json | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index b36abe9..645149c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "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": "AGPL-3.0-only", "maintainer": { @@ -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,7 +56,8 @@ "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 }, @@ -61,7 +65,8 @@ "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" From 79658050ccfb5ac10efabb4dcb3e90a8a85ab795 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 09:41:19 +0100 Subject: [PATCH 9/9] Small fixes --- README.md | 2 +- scripts/install | 6 +++--- scripts/remove | 19 +++++++------------ scripts/restore | 19 +++++++++---------- scripts/upgrade | 8 ++++---- 5 files changed, 24 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index dc3c5ad..1653358 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## 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:** 1.0 +**Version:** 0.5 ## Demo * [Official demo](http://ulogger.fabiszewski.net/) (login: demo, password: demo) diff --git a/scripts/install b/scripts/install index 7b2ba22..dc5fe1e 100644 --- a/scripts/install +++ b/scripts/install @@ -79,7 +79,7 @@ cp -r ../conf/config.php $final_path #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -95,7 +95,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." +ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -170,7 +170,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload 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 7d379d6..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,13 +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 85ab0e1..ef6c72c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,7 +103,7 @@ ynh_secure_remove "$tmpdir" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -119,7 +119,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -144,9 +144,9 @@ chown -R $app: $final_path #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="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