From 8e99ec37fb90d1ac4f8eb2c838e6d2e1f5b0c905 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 26 Feb 2021 00:50:43 +0100 Subject: [PATCH] Apply last example_ynh --- README.md | 9 +++---- check_process | 4 +++ conf/app.src | 1 + conf/nginx.conf | 2 ++ conf/php-fpm.conf | 6 ++--- issue_template.md | 55 ++++++++++++++++++++++++++++++++++++++++ manifest.json | 8 +++--- pull_request_template.md | 4 +-- scripts/install | 11 ++++---- scripts/remove | 1 - scripts/restore | 2 +- scripts/upgrade | 40 ++++++++--------------------- 12 files changed, 92 insertions(+), 51 deletions(-) create mode 100644 issue_template.md diff --git a/README.md b/README.md index eb54622..45ab151 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [![Integration level](https://dash.yunohost.org/integration/z-push.svg)](https://dash.yunohost.org/appci/app/z-push) ![](https://ci-apps.yunohost.org/ci/badges/z-push.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/z-push.maintain.svg) [![Install Z-Push with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=z-push) -> *This package allow you to install Z-Push quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +> *This package allows you to install Z-Push 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.* ## Overview Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchronize emails (IMAP/SMTP backend) and calendar/contacts (cardDAV and caldDAV backend) @@ -21,7 +21,6 @@ Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchroni - [x] The current IMAP backend configuration seems able to handle email addresses different from login (for example login: john and email john.doe@domain.tld instead of john@domain.tld) - Further testing required! - [x] The sources are based on http://download.z-push.org/final/ - [x] Autodiscover implemented -- [x] Use of version 2.6.1 final ## Documentation @@ -41,9 +40,9 @@ Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchroni --- -## Developers info +## Developer info -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/z-push_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/z-push_ynh/tree/testing). To try the testing branch, please proceed like that. ``` diff --git a/check_process b/check_process index b3bf74c..ee41019 100644 --- a/check_process +++ b/check_process @@ -15,6 +15,8 @@ upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db # 2.5.2~ynh1 upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3 + # 2.6.1~ynh1 + upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b backup_restore=1 multi_instance=1 port_already_use=0 @@ -27,3 +29,5 @@ Notification=all name=2.5.1~ynh3 ; commit=a857788c1fb369baa5f0608da12013b003cceed3 name=2.5.2~ynh1 + ; commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b + name=2.6.1~ynh1 diff --git a/conf/app.src b/conf/app.src index 0cae42c..2825efa 100644 --- a/conf/app.src +++ b/conf/app.src @@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 0a7f195..70e4d41 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,6 @@ #sub_path_only rewrite ^Microsoft-Server-ActiveSync$ Microsoft-Server-ActiveSync/ permanent; location /Microsoft-Server-ActiveSync/ { + # Path to source alias __FINALPATH__/ ; @@ -12,6 +13,7 @@ location /Microsoft-Server-ActiveSync/ { # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file client_max_body_size 50M; + try_files $uri $uri/ index.php; rewrite ^(.*)$ /Microsoft-Server-ActiveSync/index.php last; location ~ [^/]\.php(/|$) { diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index b592e5b..0f27b8b 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -235,7 +235,7 @@ pm.max_requests = 0 ; anything, but it may not be a good idea to use the .php extension or it ; may conflict with a real PHP file. ; Default Value: not set -pm.status_path = /fpm-status +pm.status_path = /status ; The ping URI to call the monitoring page of FPM. If this value is not set, no ; URI will be recognized as a ping page. This could be used to test from outside @@ -320,7 +320,7 @@ ping.path = /ping ; The log file for slow requests ; Default Value: not set ; Note: slowlog is mandatory if request_slowlog_timeout is set -slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log +slowlog = log/$pool.log.slow ; The timeout for serving a single request after which a PHP backtrace will be ; dumped to the 'slowlog' file. A value of '0s' means 'off'. @@ -358,7 +358,7 @@ rlimit_core = 0 ; Chdir to this directory at the start. ; Note: relative path can be used. ; Default Value: current directory or / when chroot -chdir = /var/www/__NAMETOCHANGE__ +chdir = __FINALPATH__ ; Redirect worker stdout and stderr into main error log. If not set, stdout and ; stderr will be redirected to /dev/null according to FastCGI specs. diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 0000000..6934cda --- /dev/null +++ b/issue_template.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to Z-Push itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install z-push + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/manifest.json b/manifest.json index 1e058b9..44f0e06 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "ActiveSync frontend that helps you synchronize emails, calendar and contacts", "fr": "Frontend ActiveSync qui permet de synchroniser emails, calendrier et contacts" }, - "version": "2.6.1~ynh1", + "version": "2.6.1~ynh2", "url": "https://z-push.org", "license": "AGPL-3.0-or-later", "maintainer": { @@ -21,13 +21,13 @@ } ], "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.3" }, + "multi_instance": true, "services": [ "nginx", "php7.3-fpm" ], - "multi_instance": true, "arguments": { "install" : [ { @@ -37,7 +37,7 @@ "en": "Choose a domain for Z-Push", "fr": "Choisissez un domaine pour Z-Push" }, - "example": "domain.org" + "example": "example.com" } ] } diff --git a/pull_request_template.md b/pull_request_template.md index b199919..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/z-push_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/z-push_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/install b/scripts/install index df26e45..df6f985 100755 --- a/scripts/install +++ b/scripts/install @@ -51,8 +51,8 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=statedir --value="$statedir" -ynh_app_setting_set --app=$app --key=final_logpath --value="$final_logpath" +ynh_app_setting_set --app=$app --key=statedir --value=$statedir +ynh_app_setting_set --app=$app --key=final_logpath --value=$final_logpath #================================================= # STANDARD MODIFICATIONS @@ -227,12 +227,13 @@ ynh_use_logrotate #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" +ynh_permission_update --permission="main" --add="visitors" + domain_regex=$(echo "$domain" | sed 's@-@.@g') -ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex/[Aa]uto[Dd]iscover/.*" +ynh_permission_create --permission="autodiscover" --url "re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true" #================================================= # RELOAD NGINX diff --git a/scripts/remove b/scripts/remove index a107d11..710d389 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) - final_path=$(ynh_app_setting_get --app=$app --key=final_path) statedir=$(ynh_app_setting_get --app=$app --key=statedir) final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath) diff --git a/scripts/restore b/scripts/restore index af5ec35..1690a70 100755 --- a/scripts/restore +++ b/scripts/restore @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_script_progression --message="Managing script failure..." ynh_clean_setup () { true @@ -94,6 +93,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index 5622664..0fa9dd8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,21 +34,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - if [ -z "$statedir" ]; then statedir="/home/yunohost.app/$app" @@ -63,6 +48,13 @@ then mkdir -p $final_logpath 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 #================================================= @@ -220,14 +212,6 @@ cp ../conf/backend/config-searchldap.php $final_path/backend/searchldap/config.p # Fixstates to avoid full resync of devices after version upgrades $final_path/z-push-admin.php -a fixstates -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # GENERIC FINALIZATION #================================================= @@ -242,14 +226,12 @@ chown -R $app: $statedir chown -R $app: $final_logpath #================================================= -# SETUP SSOWAT +# SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading logrotate configuration..." -# Make app public -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -domain_regex=$(echo "$domain" | sed 's@-@.@g') -ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex/[Aa]uto[Dd]iscover/.*" +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append #================================================= # RELOAD NGINX