From 3d865a5438ce45f253d91ca4021da51d63f95392 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 24 Feb 2021 11:16:58 +0100 Subject: [PATCH 1/6] fix upgrade after change_url --- scripts/install | 2 +- scripts/upgrade | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index 4c50f0d..4c962be 100644 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path_url --value=$path_url +ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=deskey --value=$deskey diff --git a/scripts/upgrade b/scripts/upgrade index e9ef9c9..8bac390 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,7 @@ app=$YNH_APP_INSTANCE_NAME ynh_app_setting_set --app=$app --key=phpversion --value=$YNH_PHP_VERSION domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path_url) +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) @@ -42,12 +42,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Compatibility with previous version -if [ -z "$path_url" ] ; then - path_url=$(ynh_app_setting_get --app="$app" --key=path) - ynh_app_setting_set --app=$app --key=path_url --value="$path_url" -fi - # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) From e619472e7e8257be3d4f8b162e1840de7986fa3a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 17 Mar 2021 21:23:02 +0100 Subject: [PATCH 2/6] Fix linter warnings --- README.md | 3 +-- check_process | 2 -- conf/.env | 4 ++-- manifest.json | 24 ++++-------------------- pull_request_template.md | 4 +--- scripts/change_url | 15 +++++---------- scripts/install | 18 ++++++------------ scripts/upgrade | 40 +++++++++++++++++----------------------- 8 files changed, 36 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index c07ceff..9967dc3 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,7 @@ But don't worry, you can easilly transfer your data from Pilea to æneria follow --- -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/aeneria_ynh/tree/testing). diff --git a/check_process b/check_process index 862aebb..a0da37a 100644 --- a/check_process +++ b/check_process @@ -19,8 +19,6 @@ incorrect_path=1 port_already_use=0 change_url=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=change diff --git a/conf/.env b/conf/.env index 905d887..2ecf0d2 100644 --- a/conf/.env +++ b/conf/.env @@ -1,6 +1,6 @@ ###> symfony/framework-bundle ### APP_ENV=prod -APP_SECRET=app_secret +APP_SECRET=__DESKEY__ #TRUSTED_PROXIES=127.0.0.1,127.0.0.2 #TRUSTED_HOSTS='^localhost|example\.com$' ###< symfony/framework-bundle ### @@ -11,7 +11,7 @@ APP_SECRET=app_secret # For MySQL database use: "mysql://[database_user]:[database_password]@127.0.0.1:3306/[database_name] # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Configure your db driver and server_version in config/packages/doctrine.yaml -DATABASE_URL=pgsql://database_user:database_password@localhost:5432/database_name +DATABASE_URL=pgsql://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__ ###< doctrine/doctrine-bundle ### ### aeneria features ### diff --git a/manifest.json b/manifest.json index 77e0b12..7ceb607 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "aeneria", "packaging_format": 1, "description": { - "en": "A little dashboard to analyse your energy consumption data from Linky & weather", - "fr": "Un petit tableau de bord pour analyser votre consomation d'énergie à partir des données d'un Linky et de la météo" + "en": "Dashboard to analyse your energy consumption data from Linky & weather", + "fr": "Tableau de bord pour analyser votre consomation d'énergie à partir des données d'un Linky et de la météo" }, "version": "1.1.3~ynh1", "url": "https://gitlab.com/aeneria/aeneria-app", @@ -14,12 +14,12 @@ "email": "bonjour@aeneria.com" }, "requirements": { - "yunohost": ">= 3.7" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "psql" ], "arguments": { @@ -27,29 +27,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for aeneria", - "fr": "Choisissez un domaine pour aeneria" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for aeneria", - "fr": "Choisissez un chemin pour aeneria" - }, "example": "/aeneria", "default": "/aeneria" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public website?", - "fr": "Est-ce un site public ?" - }, "help": { "en": "Choose whether the app should be accessible only for your yunohost users or for everyone.", "fr": "Choisissez si l'application doit être accessible uniquement pour vos utilisateurs yunohost ou pour tout le monde." @@ -59,10 +47,6 @@ { "name": "admin", "type": "user", - "ask": { - "en": "Choose the aeneria administrator", - "fr": "Choisissez l'administrateur de aeneria" - }, "example": "homer" } ] diff --git a/pull_request_template.md b/pull_request_template.md index dbaee56..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/aeneria_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/aeneria_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/change_url b/scripts/change_url index 9779b31..be53f91 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,20 +24,15 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -# Add settings here as needed by your application -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -72,7 +67,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -103,7 +98,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -111,4 +106,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 4c50f0d..a98a173 100644 --- a/scripts/install +++ b/scripts/install @@ -48,9 +48,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path_url --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=deskey --value=$deskey -ynh_app_setting_set --app=$app --key=phpversion --value=$YNH_PHP_VERSION #================================================= # STANDARD MODIFICATIONS @@ -85,7 +83,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -101,7 +99,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" @@ -115,12 +113,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Configuring aeneria..." --weight=1 aeneria_conf="$final_path/.env" -cp ../conf/.env $aeneria_conf -ynh_replace_string --match_string="database_name" --replace_string="${db_name}" --target_file="$aeneria_conf" -ynh_replace_string --match_string="database_user" --replace_string="${db_user}" --target_file="$aeneria_conf" -ynh_replace_string --match_string="database_password" --replace_string="${db_pwd}" --target_file="$aeneria_conf" -ynh_replace_string --match_string="app_secret" --replace_string="${deskey}" --target_file="$aeneria_conf" +ynh_add_config --template="../conf/.env" --destination="$aeneria_conf" # Restrict rights to aeneria user only chmod 600 "$aeneria_conf" @@ -186,18 +180,18 @@ chmod 755 $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add visitors + ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 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 e9ef9c9..faac443 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,13 +16,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -# Ensure php version is set -ynh_app_setting_set --app=$app --key=phpversion --value=$YNH_PHP_VERSION - domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path_url) 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) @@ -60,6 +56,13 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$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 #================================================= @@ -105,7 +108,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -128,7 +131,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" @@ -142,12 +145,14 @@ ynh_script_progression --message="Configuring aeneria..." --weight=1 # Copy and set aeneria dist configuration aeneria_conf="$final_path/.env" -cp ../conf/.env $aeneria_conf +# cp ../conf/.env $aeneria_conf -ynh_replace_string --match_string="database_name" --replace_string="${db_name}" --target_file="$aeneria_conf" -ynh_replace_string --match_string="database_user" --replace_string="${db_user}" --target_file="$aeneria_conf" -ynh_replace_string --match_string="database_password" --replace_string="${db_pwd}" --target_file="$aeneria_conf" -ynh_replace_string --match_string="app_secret" --replace_string="${deskey}" --target_file="$aeneria_conf" +# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$aeneria_conf" +# ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$aeneria_conf" +# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$aeneria_conf" +# ynh_replace_string --match_string="__DESKEY__" --replace_string="$deskey" --target_file="$aeneria_conf" + +ynh_add_config --template="../conf/.env" --destination="$aeneria_conf" # Restrict rights to aeneria user only chmod 600 "$aeneria_conf" @@ -217,21 +222,10 @@ ynh_script_progression --message="Securing files and directories..." chown -R $app: $final_path chmod 755 $final_path -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - ynh_permission_update --permission "main" --add visitors -fi - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="ReloadingNGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload From 1c2df65aadcd2a6eeedc04233d2dd6d4521ba4c7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 18 Mar 2021 08:28:53 +0100 Subject: [PATCH 3/6] Update restore --- scripts/restore | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index bacc361..87e3ae3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,7 +26,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -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) db_user=$db_name From 31d0625fe014001171a996a250f2ed99423907a6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 18 Mar 2021 09:43:45 +0100 Subject: [PATCH 4/6] Update upgrade --- scripts/upgrade | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index faac443..e559691 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,14 +143,7 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie #================================================= ynh_script_progression --message="Configuring aeneria..." --weight=1 -# Copy and set aeneria dist configuration aeneria_conf="$final_path/.env" -# cp ../conf/.env $aeneria_conf - -# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$aeneria_conf" -# ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$aeneria_conf" -# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$aeneria_conf" -# ynh_replace_string --match_string="__DESKEY__" --replace_string="$deskey" --target_file="$aeneria_conf" ynh_add_config --template="../conf/.env" --destination="$aeneria_conf" From aa15596ae18249dda4dc53de4c09666a3d3644aa Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 12 Apr 2021 15:17:53 +0200 Subject: [PATCH 5/6] ynh_exec_as is defined in the _common.sh file --- hooks/post_user_create | 2 +- hooks/post_user_delete | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index 84bd169..ab5efb9 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -3,7 +3,7 @@ app=APPNAMETOCHANGE # Source YunoHost helpers source /usr/share/yunohost/helpers -source /etc/yunohost/apps/$app/scripts/ynh_exec_as +source /etc/yunohost/apps/$app/scripts/_common.sh # Retrieve arguments username=$1 diff --git a/hooks/post_user_delete b/hooks/post_user_delete index 5472601..f5a6eae 100644 --- a/hooks/post_user_delete +++ b/hooks/post_user_delete @@ -3,7 +3,7 @@ app=APPNAMETOCHANGE # Source YunoHost helpers source /usr/share/yunohost/helpers -source /etc/yunohost/apps/$app/scripts/ynh_exec_as +source /etc/yunohost/apps/$app/scripts/_common.sh # Retrieve arguments username=$1 From 770d3497fdc26e2b11bd3aba2d0ae4b59c5702b3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 19 Jun 2021 14:22:51 +0200 Subject: [PATCH 6/6] Fix corrupt source --- conf/app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index c686767..31fbb61 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ SOURCE_URL=https://statics.aeneria.com/aeneria-app-1.1.3.tar.gz -SOURCE_SUM=50194f003c1fcbf605875464a25f27ed1a439ce09fd0404ce400ae96e8e76d9f +SOURCE_SUM=1fcf26a7ceedc9acad0e9fc8302706f09e234949b148629875e827b151cd3d1b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true