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/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 diff --git a/scripts/upgrade b/scripts/upgrade index e9ef9c9..e559691 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" @@ -140,14 +143,9 @@ 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="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" @@ -217,21 +215,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