From ce6204e1913a76a9bfd2583599a1a639c3a95619 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 7 Feb 2021 10:25:59 +0100 Subject: [PATCH] upgrade to version 1.0 --- README.md | 2 +- check_process | 2 -- conf/app.src | 4 ++-- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- manifest.json | 6 +++--- scripts/_common.sh | 18 ++++++++++++++++++ scripts/backup | 9 +++++---- scripts/install | 6 +++--- scripts/remove | 6 +++--- scripts/restore | 13 +++++++------ scripts/upgrade | 22 +++++++++++++++------- 12 files changed, 59 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 1653358..dc3c5ad 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:** 0.5 +**Version:** 1.0 ## Demo * [Official demo](http://ulogger.fabiszewski.net/) (login: demo, password: demo) diff --git a/check_process b/check_process index 0860708..fde3dea 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,6 @@ # See here for more informations # https://github.com/YunoHost/package_check#syntax-check_process-file -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) diff --git a/conf/app.src b/conf/app.src index d27a5a0..e254634 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/bfabiszewski/ulogger-server/archive/v0.5.zip -SOURCE_SUM=77205e03323ab7aab46f2115e578357dd65b1ba8476d9d348ae3dc216f58a4d3 +SOURCE_URL=https://github.com/bfabiszewski/ulogger-server/archive/v1.0.zip +SOURCE_SUM=aac2f69f64477b3a1c4265d19603fa32d9ba385f3e00358c0a4f08e7dcbb2020 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index f220fda..2b2538e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,7 +16,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ab5dca9..ab1a471 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 645149c..74dacda 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~ynh2", + "version": "1.0~ynh1", "url": "https://github.com/bfabiszewski/ulogger-server", "license": "AGPL-3.0-only", "maintainer": { @@ -14,12 +14,12 @@ "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.0.0" }, "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 9e3b7ca..cbb04d3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,23 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + +YNH_PHP_VERSION="7.3" + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= + # Send an email to inform the administrator # # usage: ynh_send_readme_to_admin app_message [recipients] diff --git a/scripts/backup b/scripts/backup index 7f9fee5..1fad65a 100644 --- a/scripts/backup +++ b/scripts/backup @@ -28,9 +28,10 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app db_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 @@ -53,7 +54,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/install b/scripts/install index dc5fe1e..4545c3c 100644 --- a/scripts/install +++ b/scripts/install @@ -99,6 +99,7 @@ ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated php-fpm config ynh_add_fpm_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP @@ -120,13 +121,12 @@ 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 - #================================================= # SETUP APPLICATION WITH CURL #================================================= # Set the app as temporarily public for cURL call -ynh_permission_update --permission "main" --add "visitors" +ynh_permission_update --permission="main" --add="visitors" # Reload NGINX ynh_systemd_action --service_name=nginx --action=reload @@ -164,7 +164,7 @@ ynh_script_progression --message="Configuring permissions..." # Make app public if necessary or protect it if [ $is_public -eq 0 ] then - ynh_permission_update --permission "main" --remove "visitors" + ynh_permission_update --permission="main" --remove="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index f0bf565..381cf48 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,10 +16,10 @@ ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get --app=$app --key=domain) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -final_path=$(ynh_app_setting_get $app final_path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE THE MYSQL DATABASE diff --git a/scripts/restore b/scripts/restore index 4dd5b96..49dc6e2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,10 +27,11 @@ ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -final_path=$(ynh_app_setting_get $app final_path) -db_name=$(ynh_app_setting_get $app db_name) +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 @@ -78,7 +79,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # GENERIC FINALIZATION @@ -87,7 +88,7 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -ynh_systemd_action --service_name=php7.0-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 ef6c72c..f1d8c35 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,12 +16,13 @@ ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -admin=$(ynh_app_setting_get $app admin) -is_public=$(ynh_app_setting_get $app is_public) -final_path=$(ynh_app_setting_get $app final_path) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +admin=$(ynh_app_setting_get --app=$app --key=admin) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +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) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -49,6 +50,13 @@ if [ -z $final_path ]; then ynh_app_setting_set $app final_path $final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -95,7 +103,7 @@ ynh_setup_source "$final_path" #copy cofig.php from tmp to final_path -cp -a "$tmpdir/config.php" "${final_path}" +cp -a "$tmpdir/config.php" "$final_path" #remove tmp dir ynh_secure_remove "$tmpdir"