From 586666e9ca4fe949d94bf8859a495956121b86ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 12 Nov 2020 15:39:12 +0100 Subject: [PATCH] Testing (#101) * Upgrade v.1.2.16 * Upgrade to PHP7.3 Co-authored-by: Maniack Crudelis Co-authored-by: Jimmy Monin --- README.md | 22 +++++++------- README_fr.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++ conf/app.src | 4 +-- conf/config.php | 11 +++++++ conf/cron_kanboard | 2 ++ conf/nginx.conf | 12 +++++++- conf/php-fpm.conf | 2 +- issue_template.md | 55 ++++++++++++++++++++++++++++++++++ manifest.json | 21 ++++++++----- scripts/_common.sh | 16 +++++++++- scripts/backup | 25 +++++++++------- scripts/change_url | 29 ++++++++++++------ scripts/install | 40 +++++++++++++++---------- scripts/remove | 24 ++++++++++----- scripts/restore | 37 +++++++++++++---------- scripts/upgrade | 50 +++++++++++++++++-------------- 16 files changed, 320 insertions(+), 105 deletions(-) create mode 100644 README_fr.md create mode 100644 conf/cron_kanboard create mode 100644 issue_template.md diff --git a/README.md b/README.md index c43a620..6c9a7b8 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ # Kanboard for Yunohost -[![Integration level](https://dash.yunohost.org/integration/kanboard.svg)](https://dash.yunohost.org/appci/app/kanboard) +[![Integration level](https://dash.yunohost.org/integration/kanboard.svg)](https://dash.yunohost.org/appci/app/kanboard) ![](https://ci-apps.yunohost.org/ci/badges/kanboard.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/kanboard.maintain.svg) [![Install Kanboard with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=kanboard) +*[Lire ce readme en français.](./README_fr.md)* + > *This package allow you to install Kanboard 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.* ## Overview -Kanboard is a simple visual task board web application. +Kanboard is a visual task manager that makes it easy to manage small projects in a collaborative way. The tool is particularly suitable for people who use the Kanban method. Kanboard can be seen as a (Simplified) alternative to the proprietary Trello software. Kanboard is a minimalist software, it focuses only on the features that are really necessary. The user interface is simple and clear. The tool is designed to run on a small machine such as a Raspberry Pi or a Virtual Private Server (VPS). There are no external dependencies, drag and drop of tasks uses the new HTML5 APIs. -**Shipped version:** 1.2.12 +**Shipped version:** 1.2.16 ## Screenshots @@ -17,24 +19,26 @@ Kanboard is a simple visual task board web application. ## Demo -* [YunoHost demo](https://demo.yunohost.org/dokuwiki/) +* [YunoHost demo](https://demo.yunohost.org/kanboard/) ## Configuration ## Documentation * Official documentation: https://docs.kanboard.org/en/latest/ - * YunoHost documentation: If specific documentation is needed, feel free to contribute. + * YunoHost documentation: https://yunohost.org/#/app_kanboard ## YunoHost specific features #### Multi-users support + * Are LDAP and HTTP auth supported? **No** + * Can the app be used by multiple users? **Yes** + #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/kanboard%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/kanboard/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/kanboard%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/kanboard/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/kanboard%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/kanboard/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/kanboard%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/kanboard/) ## Limitations @@ -59,10 +63,8 @@ This is due to a Kanboard limitation. --- -Developers info ----------------- +## Developers info -**Only if you want to use a testing branch for coding, instead of merging directly into master.** Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/kanboard_ynh/tree/testing). To try the testing branch, please proceed like that. diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..6042062 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,75 @@ +# Kanboard pour Yunohost + +[![Integration level](https://dash.yunohost.org/integration/kanboard.svg)](https://dash.yunohost.org/appci/app/kanboard) ![](https://ci-apps.yunohost.org/ci/badges/kanboard.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/kanboard.maintain.svg) +[![Installer Kanboard avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=kanboard) + +*[Read this readme in english.](./README.md)* + +> *Ce package vous permet d'installer Kanboard rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* + +## Vue d'ensemble +Kanboard est un gestionnaire de tâches visuel qui permet de gérer facilement des petits projets de manière collaborative. L'outil est particulièrement adapté aux personnes qui utilisent la méthode Kanban. On peut voir Kanboard comme une alternative (simplifiée) au logiciel propriétaire Trello. Kanboard est un logiciel minimaliste, il se concentre uniquement sur les fonctionnalités réellement nécessaires. L'interface utilisateur est simple et clair. L'outil est prévu pour fonctionner sur une petite machine tel qu'un Raspberry Pi ou un serveur virtuel privé (VPS). Il n'y a aucune dépendance externe, le glisser-déposer des tâches utilise les nouvelles API de HTML5. + +**Version incluse :** 1.2.16 + +## Captures d'écran + +![](https://kanboard.org/assets/img/board.png) + +## Démo + +* [Démo YunoHost](https://demo.yunohost.org/kanboard/) + +## Configuration + +## Documentation + + * Documentation officielle : https://docs.kanboard.org/fr/latest/ + * Documentation YunoHost : https://yunohost.org/#/app_kanboard_fr + +## Caractéristiques spécifiques YunoHost + +#### Support multi-utilisateur + +* L'authentification LDAP et HTTP est-elle prise en charge ? **Non** +* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** + +#### Architectures supportées + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/kanboard%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/kanboard/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/kanboard%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/kanboard/) + +## Limitations + +## Informations additionnelles + +### Comment se connecter en tant qu'utilisateurs externes (non SSOwat) + +Vous devez éditer ce fichier `/var/www/kanboard/config.php`, trouver la ligne `define('REVERSE_PROXY_AUTH', true);`et la changer de `true` à `false`. +**Attention** cela désactive la possibilité de se connecter avec les utilisateurs SSOwat. Vous ne pourrez *que* vous connecter avec les utilisateurs Kanboard créés à l'intérieur de Kanboard. +Ensuite, vous pouvez vous connecter. + +**NB**: si vous n'effectuez pas cette modification, vous obtiendrez le message d'erreur suivant "Accès interdit". + +Cela est dû à une limitation de Kanboard. + +## Liens + + * Signaler un bug : https://github.com/YunoHost-Apps/kanboard_ynh/issues + * Site de l'application : https://kanboard.org + * Dépôt de l'application principale : https://github.com/kanboard/kanboard + * Site web YunoHost : https://yunohost.org/ + +--- + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/kanboard_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/kanboard_ynh/tree/testing --debug +or +sudo yunohost app upgrade kanboard -u https://github.com/YunoHost-Apps/kanboard_ynh/tree/testing --debug +``` diff --git a/conf/app.src b/conf/app.src index f8239ea..466ac16 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/kanboard/kanboard/archive/v1.2.12.tar.gz -SOURCE_SUM=6b17a4cfcf2402e69e49826b248c284f5ed84b02aaf054743c2a46f4af2f9fa3 +SOURCE_URL=https://github.com/kanboard/kanboard/archive/v1.2.16.tar.gz +SOURCE_SUM=d43bbabceb47f42d3418bfb7abf8af2ad01f00304ffcfc644abd9feca9d9ceef SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/config.php b/conf/config.php index 616cf56..7ae3929 100644 --- a/conf/config.php +++ b/conf/config.php @@ -234,3 +234,14 @@ define('HTTP_VERIFY_SSL_CERTIFICATE', false); // TOTP (2FA) issuer name define('TOTP_ISSUER', 'Kanboard'); + +// Comma separated list of fields to not synchronize when using external authentication providers +define('EXTERNAL_AUTH_EXCLUDE_FIELDS', 'username'); + +// Enable or disable displaying group-memberships in userlist (true by default) +define('SHOW_GROUP_MEMBERSHIPS_IN_USERLIST', true); + +// Limit number of groups to display in userlist (The full list of group-memberships is always shown, ... +// ... when hovering the mouse over the group-icon of a given user!) +// If set to 0 ALL group-memberships will be listed (7 by default) +define('SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT', 7); diff --git a/conf/cron_kanboard b/conf/cron_kanboard new file mode 100644 index 0000000..eb9679c --- /dev/null +++ b/conf/cron_kanboard @@ -0,0 +1,2 @@ +# Execute the daily cronjob at 8am +0 8 * * * __APP__ cd "__FINALPATH__" && PHP__PHPVERSION__ ./cli cronjob >/dev/null 2>&1 \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 1048a82..f1689fc 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,14 +16,24 @@ location __PATH__/ { # Override CSP header to make SSOWAT user panel compatible with kanboard more_set_headers Content-Security-Policy "default-src 'self' 'unsafe-eval' data:;"; + location __PATH__/(?:kanboard|config.php|config.default.php) { + deny all; + } + + # Deny access to the directory data + location __PATH__/data { + deny all; + } + 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; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; + fastcgi_param SERVER_NAME $host; } # Include SSOWAT user panel. diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 39a47a1..ff2075e 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/issue_template.md b/issue_template.md new file mode 100644 index 0000000..53d9f38 --- /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. *Make sure 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 the app itself. Refer to its documentation or repository for help.* + - *In doubt, ask here and we will figure it out together.* +3. *Delete these 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 kanboard + ``` +- *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 2545ebc..cd8d2c6 100644 --- a/manifest.json +++ b/manifest.json @@ -3,17 +3,18 @@ "id": "kanboard", "packaging_format": 1, "description": { - "en": "Kanboard is a simple visual task board web application" + "en": "Kanban project management software", + "fr": "Logiciel de gestion de projet Kanban" }, - "version": "1.2.12~ynh1", + "version": "1.2.16~ynh1", "url": "https://kanboard.net/", - "license": "AGPL-3.0", + "license": "MIT", "maintainer": { "name": "YunoHost Contributors", "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.5.0" + "yunohost": ">= 3.8.1" }, "previous_maintainers": [{ "name": "mbugeia", @@ -35,7 +36,8 @@ "name": "domain", "type": "domain", "ask": { - "en": "Choose a domain for Kanboard" + "en": "Choose a domain name for Kanboard", + "fr": "Choisissez un nom de domaine pour Kanboard" }, "example": "domain.org" }, @@ -43,7 +45,8 @@ "name": "path", "type": "path", "ask": { - "en": "Choose a path for Kanboard" + "en": "Choose a path for Kanboard", + "fr": "Choisissez un chemin pour Kanboard" }, "example": "/kanboard", "default": "/kanboard" @@ -52,7 +55,8 @@ "name": "admin", "type": "user", "ask": { - "en": "Choose the admin user for Kanboard" + "en": "Choose the admin user", + "fr": "Choisissez l'administrateur" }, "example": "johndoe" }, @@ -60,7 +64,8 @@ "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public site ?" + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" }, "default": false } diff --git a/scripts/_common.sh b/scripts/_common.sh index d321ecc..cea4e7d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,4 +4,18 @@ # COMMON VARIABLES #================================================= -pkg_dependencies="php-gd php-zip php-dom php-mbstring" +YNH_PHP_VERSION="7.3" + +extra_php_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql" + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup index 9258216..4ddf7a7 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,55 +13,60 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_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) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Backing up fail2ban configuration..." ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" +#================================================= +# BACKUP A CRON FILE +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" + #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." +ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql @@ -69,4 +74,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for Kanboard. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index cae08dd..4a27e23 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +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) @@ -50,23 +50,23 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -76,6 +76,17 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# SETUP FAIL2BAN +#================================================= +ynh_script_progression --message="Configuring Fail2Ban..." --weight=10 + +# Remove the config file with $old_domain +ynh_remove_fail2ban_config + +# Add config file with $new_domain +ynh_add_fail2ban_config --logpath="/var/log/nginx/${new_domain}-error.log" --failregex="^.*authentication failure\" while reading response header from upstream, client: ,.*$" --max_retry=5 + #================================================= # SPECIFIC MODIFICATIONS #================================================= @@ -91,7 +102,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload @@ -99,4 +110,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression --message="Change of URL completed for Kanboard" --last diff --git a/scripts/install b/scripts/install index 049173d..080e850 100644 --- a/scripts/install +++ b/scripts/install @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -50,13 +49,6 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=14 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # CREATE A MYSQL DATABASE #================================================ @@ -80,7 +72,7 @@ mkdir -p $final_path/sessions/ #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=2 +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -96,17 +88,18 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=2 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=16 -# Create a dedicated php-fpm config -ynh_add_fpm_config +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP #================================================= # CREATE CONFIG.PHP #================================================= -ynh_script_progression --message="Configuring kanboard..." +ynh_script_progression --message="Configuring Kanboard..." # Retrieve admin email email=$(ynh_user_get_info --username=$admin --key=mail) @@ -127,6 +120,11 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --targ ynh_script_progression --message="Initializing database..." --weight=7 ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < "${final_path}/app/Schema/Sql/mysql.sql" +( + cd "$final_path" + # Launch database migration + php$YNH_PHP_VERSION cli db:migrate --no-interaction --verbose +) #================================================= # GENERIC FINALIZATION @@ -142,10 +140,20 @@ chmod -R 700 $final_path/sessions #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring fail2ban..." --weight=10 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=10 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex="^.*authentication failure\" while reading response header from upstream, client: ,.*$" --max_retry=5 +#================================================= +# SETUP CRON +#================================================= +ynh_script_progression --message="Setuping a cron..." + +cp ../conf/cron_kanboard /etc/cron.d/$app +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" + #================================================= # SETUP SSOWAT #================================================= @@ -169,7 +177,7 @@ ynh_store_file_checksum --file="$config_php" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -177,4 +185,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of Kanboard completed" --last diff --git a/scripts/remove b/scripts/remove index f530da7..80922e1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -41,7 +41,7 @@ ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." +ynh_script_progression --message="Removing Kanboard main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -49,17 +49,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= @@ -67,10 +67,18 @@ ynh_remove_fpm_config #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." --weight=7 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=7 ynh_remove_fail2ban_config +#================================================= +# REMOVE THE CRON FILE +#================================================= +ynh_script_progression --message="Removing the cron file..." --weight=2 + +# Remove a cron file +ynh_secure_remove --file="/etc/cron.d/$app" + #================================================= # REMOVE DEDICATED USER #================================================= @@ -83,4 +91,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression --message="Removal of Kanboard completed" --last diff --git a/scripts/restore b/scripts/restore index 18ebad5..af1036a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,13 +13,12 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --weight=2 +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME @@ -27,6 +26,7 @@ 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 @@ -49,7 +49,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring Kanboard main directory..." --weight=5 ynh_restore_file --origin_path="$final_path" @@ -71,22 +71,20 @@ chown -R $app $final_path/{data,plugins,sessions} #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=6 -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" +# Restore the file first, so it can have a backup if different +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +# Recreate a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= # SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=13 - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." --weight=3 db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd @@ -95,24 +93,31 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./ #================================================= # RESTORE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=8 +ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=8 ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban +#================================================= +# RESTORE THE CRON FILE +#================================================= +ynh_script_progression --message="Restoring the cron file..." --weight=2 + +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=2 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM.." --weight=2 -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 #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for Kanboard" --last diff --git a/scripts/upgrade b/scripts/upgrade index 32b5665..f141e9b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -22,6 +22,7 @@ admin=$(ynh_app_setting_get --app=$app --key=adminusername) 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) #================================================= # CHECK VERSION @@ -32,7 +33,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -58,7 +59,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 +ynh_script_progression --message="Backing up Kanboard before upgrading (may take a while)..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -95,15 +96,15 @@ mkdir -p $final_path/sessions/ #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app @@ -111,24 +112,17 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5 -# Create a dedicated php-fpm config -ynh_add_fpm_config - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=6 - -ynh_install_app_dependencies $pkg_dependencies +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= # SPECIFIC UPGRADE #================================================= # CREATE CONFIG.PHP #================================================= -ynh_script_progression --message="Reconfiguring kanboard..." --weight=2 +ynh_script_progression --message="Reconfiguring Kanboard..." --weight=2 # Retrieve admin email email=$(ynh_user_get_info --username=$admin --key=mail) @@ -149,14 +143,14 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --targ #================================================= # UPGRADE KANBOARD #================================================= -ynh_script_progression --message="Upgrading kanboard..." --weight=2 +ynh_script_progression --message="Upgrading Kanboard..." --weight=2 ( cd "$final_path" # Launch database migration - php cli db:migrate --no-interaction --verbose + php$YNH_PHP_VERSION cli db:migrate --no-interaction --verbose # Launch plugins migration - php cli plugin:upgrade --no-interaction --verbose + php$YNH_PHP_VERSION cli plugin:upgrade --no-interaction --verbose ) #================================================= @@ -173,10 +167,20 @@ chmod -R 700 $final_path/sessions #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=7 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=7 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-error.log" --failregex="^.*authentication failure\" while reading response header from upstream, client: ,.*$" --max_retry=5 +#================================================= +# SETUP CRON +#================================================= +ynh_script_progression --message="Setuping a cron..." + +cp ../conf/cron_kanboard /etc/cron.d/$app +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" + #================================================= # SETUP SSOWAT #================================================= @@ -200,7 +204,7 @@ ynh_store_file_checksum --file="$config_php" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -208,4 +212,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of Kanboard completed" --last