From 387ec4be23f745621a0fa3aec21219004edd2a35 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 25 Feb 2021 23:53:02 +0100 Subject: [PATCH 1/2] Apply last example_ynh --- README.md | 4 +-- check_process | 9 +++--- conf/nginx.conf | 61 ++++++++++++++++++++-------------------- issue_template.md | 35 ++++++++++++++--------- manifest.json | 6 ++-- pull_request_template.md | 4 +-- scripts/install | 9 +++--- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 16 +++++++---- 10 files changed, 81 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index 3f6f235..b0abb6f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Wekan for YunoHost [![Integration level](https://dash.yunohost.org/integration/wekan.svg)](https://dash.yunohost.org/appci/app/wekan) ![](https://ci-apps.yunohost.org/ci/badges/wekan.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/wekan.maintain.svg) -[![Install Wekan with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wekan) +[![Install Wekan with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wekan) > *This package allows you to install Wekan 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.* @@ -65,7 +65,7 @@ LDAP is supported but HTTP auth is still not supported --- -Developer info +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/wekan_ynh/tree/testing). diff --git a/check_process b/check_process index c641bde..2d87cf2 100644 --- a/check_process +++ b/check_process @@ -24,15 +24,12 @@ upgrade=1 from_commit=2cf63bd4d660eae4526221c1a68efede499e3ee6 # 4.64~ynh1 upgrade=1 from_commit=32fe3a7c342e5f29d7a7534125151723f916de46 + # 4.64~ynh2 + upgrade=1 from_commit=9e698d094c29fc6ab12ac60cd1d0e68b56bfc953 backup_restore=1 multi_instance=1 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 port_already_use=0 change_url=1 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email=ljf+ynh-wekan@reflexlibre.net Notification=down @@ -49,3 +46,5 @@ Notification=down name=4.43~ynh1 ; commit=32fe3a7c342e5f29d7a7534125151723f916de46 name=4.64~ynh1 + ; commit=9e698d094c29fc6ab12ac60cd1d0e68b56bfc953 + name=4.64~ynh2 diff --git a/conf/nginx.conf b/conf/nginx.conf index 7833fae..e271a09 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,34 +1,35 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - proxy_pass http://127.0.0.1:__PORT__; - proxy_http_version 1.1; - client_max_body_size 100M; - proxy_set_header Accept-Encoding ""; - - # allow websockets - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - - # preserve client IP - proxy_set_header X-Forwarded-For $remote_addr; + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } - proxy_set_header Host $host; - #proxy_buffering off; - - # this setting allows the browser to cache the application in - # a way compatible with Meteor. - # on every applicaiton update the name of CSS and JS file is different, - # so they can be cache infinitely (here: 30 days) - # the root path MUST NOT be cached - if ($uri != '__PATH__') - { - expires 30d; - } - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + proxy_pass http://127.0.0.1:__PORT__; + proxy_http_version 1.1; + client_max_body_size 100M; + proxy_set_header Accept-Encoding ""; + + # allow websockets + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + + # preserve client IP + proxy_set_header X-Forwarded-For $remote_addr; + + proxy_set_header Host $host; + #proxy_buffering off; + + # this setting allows the browser to cache the application in + # a way compatible with Meteor. + # on every applicaiton update the name of CSS and JS file is different, + # so they can be cache infinitely (here: 30 days) + # the root path MUST NOT be cached + if ($uri != '__PATH__') + { + expires 30d; + } + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/issue_template.md b/issue_template.md index 3c02af4..46ab7d4 100644 --- a/issue_template.md +++ b/issue_template.md @@ -1,32 +1,34 @@ --- name: Bug report -about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. +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!* + - *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 Wekan itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *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** +### Describe the bug + *A clear and concise description of what the bug is.* -**Versions** +### 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* +- 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`* -**To Reproduce** -*Steps to reproduce the behavior.* +### Steps to reproduce + - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh sudo yunohost app install wekan @@ -34,13 +36,20 @@ about: Create a report to help us debug, it would be nice to fill the template a - *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 '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* -**Expected behavior** +### 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** -*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.* +### 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 99a3336..b9b90c6 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Trello-like kanban", "fr": "Un kanban similaire à Trello" }, - "version": "4.64~ynh2", + "version": "4.64~ynh3", "url": "https://wekan.io", "license": "MIT", "maintainer": [ @@ -19,7 +19,7 @@ "name": "ljf" }], "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.3" }, "multi_instance": true, "services": [ @@ -51,7 +51,7 @@ "type": "user", "ask": { "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" + "fr": "Choisissez l'administrateur" }, "example": "johndoe" }, diff --git a/pull_request_template.md b/pull_request_template.md index e72bcc4..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/wekan_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/wekan_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 712430e..2988aae 100644 --- a/scripts/install +++ b/scripts/install @@ -58,7 +58,6 @@ 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=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -152,7 +151,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "Wekan daemon" +yunohost service add $app --description="Wekan daemon" #================================================= # START SYSTEMD SERVICE @@ -169,14 +168,16 @@ fi #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." ynh_permission_create --permission="admin" --allowed "$admin" # Make app public if necessary if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add "visitors" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 463ca8f..120e182 100755 --- a/scripts/remove +++ b/scripts/remove @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service..." + ynh_script_progression --message="Removing $app service integration..." yunohost service remove $app fi diff --git a/scripts/restore b/scripts/restore index bbc8ced..a509e8f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -113,7 +113,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "Wekan daemon" +yunohost service add $app --description="Wekan daemon" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index b59fd6c..3ab08fb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,10 +38,16 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --allowed "$admin" fi #================================================= @@ -215,7 +221,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "Wekan daemon" +yunohost service add $app --description="Wekan daemon" #================================================= # START SYSTEMD SERVICE From 2bef56e330aaea0c2c8f3a54bcce590eec853bc4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 26 Feb 2021 00:01:09 +0100 Subject: [PATCH 2/2] removing ynh_add_config --- scripts/install | 1 - scripts/upgrade | 1 - scripts/ynh_add_config | 140 ----------------------------------------- 3 files changed, 142 deletions(-) delete mode 100644 scripts/ynh_add_config diff --git a/scripts/install b/scripts/install index 2988aae..c94c5a8 100644 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,6 @@ source _common.sh source ynh_detect_arch__2 -source ynh_add_config source ynh_mongo_db source /usr/share/yunohost/helpers diff --git a/scripts/upgrade b/scripts/upgrade index 3ab08fb..34ce41e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,7 +9,6 @@ source _common.sh source ynh_package_version source ynh_detect_arch__2 -source ynh_add_config source ynh_mongo_db source /usr/share/yunohost/helpers diff --git a/scripts/ynh_add_config b/scripts/ynh_add_config deleted file mode 100644 index 58fad65..0000000 --- a/scripts/ynh_add_config +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/bash - -# Create a dedicated config file from a template -# -# examples: -# ynh_add_config --template=".env" --destination="$final_path/.env" -# ynh_add_config --template="../conf/.env" --destination="$final_path/.env" -# ynh_add_config --template="/etc/nginx/sites-available/default" --destination="etc/nginx/sites-available/mydomain.conf" -# -# usage: ynh_add_config --template="template" --destination="destination" -# | arg: -t, --template= - Template config file to use -# | arg: -d, --destination= - Destination of the config file -# -# The template can be by default the name of a file in the conf directory -# of a YunoHost Package, a relative path or an absolute path -# The helper will use the template $template to generate a config file -# $destination by replacing the following keywords with global variables -# that should be defined before calling this helper : -# __PATH__ by $path_url -# __NAME__ by $app -# __NAMETOCHANGE__ by $app -# __USER__ by $app -# __FINALPATH__ by $final_path -# __PHPVERSION__ by $YNH_PHP_VERSION -# -# And any dynamic variables that should be defined before calling this helper like: -# __DOMAIN__ by $domain -# __APP__ by $app -# __VAR_1__ by $var_1 -# __VAR_2__ by $var_2 -# -# The helper will verify the checksum and backup the destination file -# if it's different before applying the new template. -# And it will calculate and store the destination file checksum -# into the app settings when configuration is done. -# -# -ynh_add_config () { - # Declare an array to define the options of this helper. - local legacy_args=tdv - local -A args_array=( [t]=template= [d]=destination= ) - local template - local destination - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - local template_path - - if [ -f "../conf/$template" ]; then - template_path="../conf/$template" - elif [ -f "../settings/conf/$template" ]; then - template_path="../settings/conf/$template" - elif [ -f "$template" ]; then - template_path=$template - else - ynh_die --message="The provided template $template doesn't exist" - fi - - ynh_backup_if_checksum_is_different --file="$destination" - - cp "$template_path" "$destination" - - ynh_replace_vars --file="$destination" - - ynh_store_file_checksum --file="$destination" -} - -# Replace variables in a file -# -# usage: ynh_replace_vars --file="file" -# | arg: -f, --file= - File where to replace variables -# -# The helper will replace the following keywords with global variables -# that should be defined before calling this helper : -# __PATH__ by $path_url -# __NAME__ by $app -# __NAMETOCHANGE__ by $app -# __USER__ by $app -# __FINALPATH__ by $final_path -# __PHPVERSION__ by $YNH_PHP_VERSION -# -# And any dynamic variables that should be defined before calling this helper like: -# __DOMAIN__ by $domain -# __APP__ by $app -# __VAR_1__ by $var_1 -# __VAR_2__ by $var_2 -# -# -ynh_replace_vars () { - # Declare an array to define the options of this helper. - local legacy_args=f - local -A args_array=( [f]=file= ) - local file - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - # Replace specific YunoHost variables - if test -n "${path_url:-}" - then - # path_url_slash_less is path_url, or a blank value if path_url is only '/' - local path_url_slash_less=${path_url%/} - ynh_replace_string --match_string="__PATH__/" --replace_string="$path_url_slash_less/" --target_file="$file" - ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$file" - fi - if test -n "${app:-}"; then - ynh_replace_string --match_string="__NAME__" --replace_string="$app" --target_file="$file" - ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$file" - ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$file" - fi - if test -n "${final_path:-}"; then - ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$file" - fi - if test -n "${YNH_PHP_VERSION:-}"; then - ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$YNH_PHP_VERSION" --target_file="$file" - fi - if test -n "${ynh_node_load_PATH:-}"; then - ynh_replace_string --match_string="__YNH_NODE_LOAD_PATH__" --replace_string="$ynh_node_load_PATH" --target_file="$file" - fi - - # Replace others variables - - # List other unique (__ __) variables in $file - local uniques_vars=( $(grep -o '__[A-Z0-9_]*__' $file | sort --unique | sed "s@__\([^.]*\)__@\L\1@g" )) - - # Do the replacement - local delimit=@ - for one_var in "${uniques_vars[@]}" - do - # Validate that one_var is indeed defined - test -n "${!one_var:-}" || ynh_die --message="\$$one_var wasn't initialized when trying to replace __${one_var^^}__ in $file" - - # Escape delimiter in match/replace string - match_string="__${one_var^^}__" - match_string=${match_string//${delimit}/"\\${delimit}"} - replace_string="${!one_var}" - replace_string=${replace_string//${delimit}/"\\${delimit}"} - - # Actually replace (sed is used instead of ynh_replace_string to avoid triggering an epic amount of debug logs) - sed --in-place "s${delimit}${match_string}${delimit}${replace_string}${delimit}g" "$file" - done -}