diff --git a/README.md b/README.md index 5c343a8..d52ad1a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Nextcloud for YunoHost -[![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Working status](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Working status](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) *[Lire ce readme en français.](./README_fr.md)* @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Online storage, file sharing platform and various other applications -**Shipped version:** 22.2.9~ynh1 +**Shipped version:** 25.0.3~ynh1 **Demo:** https://demo.nextcloud.com/ @@ -29,16 +29,23 @@ Online storage, file sharing platform and various other applications ## Configuration -#### Configure OnlyOffice integration +### Configure ONLYOFFICE integration -Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an online rich text document editor) through a Nextcloud app. +#### With Nextcloud App (no ARM support, lower performance) + +Starting from Nextcloud 18, it features a direct integration of ONLYOFFICE (an online rich text document editor) through a Nextcloud app. To install and configure it: -- Install *Community Document Server* application in your Nextcloud. That's the part that runs OnlyOffice server. -- Install *ONLYOFFICE* application. That's the client part that will connect to an OnlyOffice server. -- Then in Settings -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), if you want to configure which file formats should be opened by OnlyOffice. +- Install *Community Document Server* application in your Nextcloud. That's the part that runs ONLYOFFICE server. +- Install *ONLYOFFICE* application. That's the client part that will connect to an ONLYOFFICE server. +- Then in Settings -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), if you want to configure which file formats should be opened by ONLYOFFICE. - Here you go :) You should be able to create new type of documents and open them. -*NB: OnlyOffice is only available for x86 architecture - **ARM** architecture is **not** supported (Raspberry Pi, OLinuXino...)* +*NB: ONLYOFFICE Nextcloud App is only available for x86 architecture - for **ARM** architecture (Raspberry Pi, OLinuXino...), consider the YunoHost App below* + +#### With YunoHost App (ARM64 support, better performance) + +For better performance and ARM64 support, install ONLYOFFICE YunoHost App and connect it to Nextcloud, see the tutorial in the [doc of onlyoffice_ynh package](https://github.com/YunoHost-Apps/onlyoffice_ynh/blob/master/README_fr.md#configuration-de-onlyoffice-server) + ## YunoHost specific features diff --git a/README_fr.md b/README_fr.md index f5f3104..b545aac 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,40 +5,47 @@ It shall NOT be edited by hand. # Nextcloud pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) [![Installer Nextcloud avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer Nextcloud rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d’installer Nextcloud rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* -## Vue d'ensemble +## Vue d’ensemble Stockage en ligne, plateforme de partage de fichiers et diverses autres applications -**Version incluse :** 22.2.9~ynh1 +**Version incluse :** 25.0.3~ynh1 **Démo :** https://demo.nextcloud.com/ -## Captures d'écran +## Captures d’écran -![Capture d'écran de Nextcloud](./doc/screenshots/screenshot.png) +![Capture d’écran de Nextcloud](./doc/screenshots/screenshot.png) ## Avertissements / informations importantes ## Configuration -#### Configurer l'intégration d'OnlyOffice +### Configurer l'intégration d'ONLYOFFICE -À partir de sa version 18, Nextcloud inclut une intégration directe de OnlyOffice (un éditeur de texte enrichi en ligne) via une application Nextcloud. +#### Avec l'application Nextcloud (pas de support ARM, performances limitées) + +À partir de sa version 18, Nextcloud inclut une intégration directe de ONLYOFFICE (un éditeur de texte enrichi en ligne) via une application Nextcloud. Pour l'installer et la configurer : -- Installez l'application *Community Document Server* dans votre Nextcloud. C'est la partie qui fait tourner un serveur OnlyOffice. -- Installez l'application *ONLYOFFICE*. C'est la partie cliente qui va se connecter au serveur OnlyOffice. -- Ensuite dans les Paramètres -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), si vous voulez configurer quels formats de fichier s'ouvrent avec OnlyOffice. +- Installez l'application *Community Document Server* dans votre Nextcloud. C'est la partie qui fait tourner un serveur ONLYOFFICE. +- Installez l'application *ONLYOFFICE*. C'est la partie cliente qui va se connecter au serveur ONLYOFFICE. +- Ensuite dans les Paramètres -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), si vous voulez configurer quels formats de fichier s'ouvrent avec ONLYOFFICE. - Et voilà :) Vous devriez pouvoir créer de nouveaux types de documents, et les ouvrir. - -*NB : OnlyOffice n'est disponible que sous architecture x86 - L'architecture **ARM** n'est **pas** supporté (Raspberry Pi, OLinuXino...)* + +*NB : l'app Nextcloud ONLYOFFICE Community Document Server n'est disponible que sous architecture x86 - Pour un support de l'architecture **ARM** (Raspberry Pi, OLinuXino...), installez plutôt l'App YunoHost, voir ci-dessous* + +#### Avec l'application YunoHost (support ARM64, meilleures performances) + +Pour de meilleures performances et le support de ARM64, installez l'app YunoHost ONLYOFFICE, voir le tutoriel dans la [doc du paquet onlyoffice_ynh](https://github.com/YunoHost-Apps/onlyoffice_ynh/blob/master/README_fr.md#configuration-de-onlyoffice-server) + ## Caractéristiques spécifiques YunoHost @@ -52,10 +59,10 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv ## Documentations et ressources -* Site officiel de l'app : +* Site officiel de l’app : * Documentation officielle utilisateur : -* Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : +* Documentation officielle de l’admin : +* Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : @@ -71,4 +78,4 @@ ou sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file diff --git a/check_process b/check_process index ea81cc6..6922dcc 100644 --- a/check_process +++ b/check_process @@ -13,17 +13,15 @@ setup_private=1 setup_public=1 upgrade=1 - #21.0.2 - upgrade=1 from_commit=fa1f0da48d3edbdf5bcb3b8b70a0687b4e878d11 + #25.0.2 + upgrade=1 from_commit=c5cf91ad30149e1924c23b19e93f483c3ed3edd8 backup_restore=1 multi_instance=1 - incorrect_path=1 - port_already_use=0 change_url=1 ;;; Options Email= Notification=none ;;; Upgrade options - ; commit=fa1f0da48d3edbdf5bcb3b8b70a0687b4e878d11 - name=Merge pull request #408 from YunoHost-Apps/21.0.2 + ; commit=c5cf91ad30149e1924c23b19e93f483c3ed3edd8 + name=Merge pull request #495 from YunoHost-Apps/25.0.2 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&user_home=1& diff --git a/conf/nginx.conf b/conf/nginx.conf index af84758..2678d48 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location ^~ /.well-known { location = /.well-known/carddav { return 301 __PATH__/remote.php/dav/; } location = /.well-known/caldav { return 301 __PATH__/remote.php/dav/; } - + location = /.well-known/webfinger { return 301 __PATH__/index.php$uri; } location = /.well-known/nodeinfo { return 301 __PATH__/index.php$uri; } @@ -62,9 +62,6 @@ location ^~ __PATH__/ { # always provides the desired behaviour. index index.php index.html __PATH__/index.php$request_uri; - # Default Cache-Control policy - expires 1m; - # Rule borrowed from `.htaccess` to handle Microsoft DAV clients location = __PATH__/ { if ( $http_user_agent ~ ^DavClnt ) { diff --git a/config_panel.toml b/config_panel.toml index 9c73626..7598044 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,26 +1,38 @@ -version = "0.1" -name = "Nextcloud configuration panel" +version = "1.0" [main] name = "Nextcloud configuration" + [main.maintenance_mode] + name = "Maintenance mode" + + [main.maintenance_mode.maintenance_mode] + ask = "Enable maintenance mode" + type = "boolean" + default = "0" + [main.php_fpm_config] name = "PHP-FPM configuration" - [main.php_fpm_config.footprint] - ask = "Memory footprint of the service?" - choices = ["low", "medium", "high", "specific"] + [main.php_fpm_config.fpm_footprint] + ask = "Memory footprint" + type = "select" + choices.low = "Low, <= 20Mb per pool" + choices.medium = "Medium, between 20Mb and 40Mb per pool" + choices.high = "High, > 40Mb per pool" + choices.specific = "Use specific value" default = "low" - help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.
Use specific to set a value with the following option." - [main.php_fpm_config.free_footprint] + [main.php_fpm_config.fpm_free_footprint] + visible = "fpm_footprint == 'specific'" ask = "Memory footprint of the service?" type = "number" default = "0" help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values." - [main.php_fpm_config.usage] - ask = "Expected usage of the service?" + [main.php_fpm_config.fpm_usage] + ask = "Expected usage" + type = "select" choices = ["low", "medium", "high"] default = "low" - help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." + help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index ff9f640..0a73710 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,15 +1,22 @@ ## Configuration -#### Configure OnlyOffice integration +### Configure ONLYOFFICE integration -Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an online rich text document editor) through a Nextcloud app. +#### With Nextcloud App (no ARM support, lower performance) + +Starting from Nextcloud 18, it features a direct integration of ONLYOFFICE (an online rich text document editor) through a Nextcloud app. To install and configure it: -- Install *Community Document Server* application in your Nextcloud. That's the part that runs OnlyOffice server. -- Install *ONLYOFFICE* application. That's the client part that will connect to an OnlyOffice server. -- Then in Settings -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), if you want to configure which file formats should be opened by OnlyOffice. +- Install *Community Document Server* application in your Nextcloud. That's the part that runs ONLYOFFICE server. +- Install *ONLYOFFICE* application. That's the client part that will connect to an ONLYOFFICE server. +- Then in Settings -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), if you want to configure which file formats should be opened by ONLYOFFICE. - Here you go :) You should be able to create new type of documents and open them. -*NB: OnlyOffice is only available for x86 architecture - **ARM** architecture is **not** supported (Raspberry Pi, OLinuXino...)* +*NB: ONLYOFFICE Nextcloud App is only available for x86 architecture - for **ARM** architecture (Raspberry Pi, OLinuXino...), consider the YunoHost App below* + +#### With YunoHost App (ARM64 support, better performance) + +For better performance and ARM64 support, install ONLYOFFICE YunoHost App and connect it to Nextcloud, see the tutorial in the [doc of onlyoffice_ynh package](https://github.com/YunoHost-Apps/onlyoffice_ynh/blob/master/README_fr.md#configuration-de-onlyoffice-server) + ## YunoHost specific features diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index aacdc22..343894c 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -1,15 +1,22 @@ ## Configuration -#### Configurer l'intégration d'OnlyOffice +### Configurer l'intégration d'ONLYOFFICE -À partir de sa version 18, Nextcloud inclut une intégration directe de OnlyOffice (un éditeur de texte enrichi en ligne) via une application Nextcloud. +#### Avec l'application Nextcloud (pas de support ARM, performances limitées) + +À partir de sa version 18, Nextcloud inclut une intégration directe de ONLYOFFICE (un éditeur de texte enrichi en ligne) via une application Nextcloud. Pour l'installer et la configurer : -- Installez l'application *Community Document Server* dans votre Nextcloud. C'est la partie qui fait tourner un serveur OnlyOffice. -- Installez l'application *ONLYOFFICE*. C'est la partie cliente qui va se connecter au serveur OnlyOffice. -- Ensuite dans les Paramètres -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), si vous voulez configurer quels formats de fichier s'ouvrent avec OnlyOffice. +- Installez l'application *Community Document Server* dans votre Nextcloud. C'est la partie qui fait tourner un serveur ONLYOFFICE. +- Installez l'application *ONLYOFFICE*. C'est la partie cliente qui va se connecter au serveur ONLYOFFICE. +- Ensuite dans les Paramètres -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), si vous voulez configurer quels formats de fichier s'ouvrent avec ONLYOFFICE. - Et voilà :) Vous devriez pouvoir créer de nouveaux types de documents, et les ouvrir. - -*NB : OnlyOffice n'est disponible que sous architecture x86 - L'architecture **ARM** n'est **pas** supporté (Raspberry Pi, OLinuXino...)* + +*NB : l'app Nextcloud ONLYOFFICE Community Document Server n'est disponible que sous architecture x86 - Pour un support de l'architecture **ARM** (Raspberry Pi, OLinuXino...), installez plutôt l'App YunoHost, voir ci-dessous* + +#### Avec l'application YunoHost (support ARM64, meilleures performances) + +Pour de meilleures performances et le support de ARM64, installez l'app YunoHost ONLYOFFICE, voir le tutoriel dans la [doc du paquet onlyoffice_ynh](https://github.com/YunoHost-Apps/onlyoffice_ynh/blob/master/README_fr.md#configuration-de-onlyoffice-server) + ## Caractéristiques spécifiques YunoHost diff --git a/doc/screenshots/screenshot.png b/doc/screenshots/screenshot.png index 966bb3e..1cce4ec 100644 Binary files a/doc/screenshots/screenshot.png and b/doc/screenshots/screenshot.png differ diff --git a/manifest.json b/manifest.json index 9229804..fa5a113 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Online storage, file sharing platform and various other applications", "fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications" }, - "version": "22.2.9~ynh1", + "version": "25.0.3~ynh1", "url": "https://nextcloud.com", "upstream": { "license": "AGPL-3.0", @@ -14,24 +14,25 @@ "demo": "https://demo.nextcloud.com/", "admindoc": "https://docs.nextcloud.com/server/stable/admin_manual/", "userdoc": "https://docs.nextcloud.com/server/latest/user_manual/en/", - "code": "https://github.com/nextcloud/server" + "code": "https://github.com/nextcloud/server", + "cpe": "cpe:2.3:a:nextcloud:nextcloud" }, "license": "AGPL-3.0", "maintainer": { - "name": "Kay0u", + "name": "kay0u", "email": "pierre@kayou.io" }, "requirements": { - "yunohost": ">= 4.3.0" + "yunohost": ">= 11.0.9" }, "multi_instance": true, "services": [ "nginx", - "php7.3-fpm", + "php8.1-fpm", "mysql" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -66,4 +67,4 @@ } ] } -} +} \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index 3f77fef..14814e8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,10 +1,14 @@ +#!/bin/bash #================================================= # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="7.3" -pkg_dependencies="imagemagick libmagickcore-6.q16-6-extra acl tar smbclient at php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath" +YNH_PHP_VERSION="8.1" + +php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath" + +pkg_dependencies="imagemagick libmagickcore-6.q16-6-extra acl tar smbclient at $php_dependencies" set_datadir() { diff --git a/scripts/config b/scripts/config index 0c14bca..7b6b67e 100644 --- a/scripts/config +++ b/scripts/config @@ -9,90 +9,118 @@ source _common.sh source /usr/share/yunohost/helpers +ynh_abort_if_errors + #================================================= # RETRIEVE ARGUMENTS #================================================= -app=$YNH_APP_INSTANCE_NAME - phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) #================================================= -# LOAD VALUES +# SPECIFIC GETTERS FOR TOML SHORT KEY #================================================= -# Load the real value from the app config or elsewhere. -# Then get the value from the form. -# If the form has a value for a variable, take the value from the form, -# Otherwise, keep the value from the app config. +get__maintenance_mode() { + # Maintenance mode status + maintenance_mode_status="$(cd "$final_path" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode)" 2> /dev/null + if echo $maintenance_mode_status | grep -q "disabled" + then + echo "0" + elif echo $maintenance_mode_status | grep -q "enabled" + then + echo "1" + else + ynh_print_err --message="Unexpected output from maintenance status check command." + exit 0 + fi +} -# Footprint for php-fpm -old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)" -fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}" +get__fpm_footprint() { + # Free footprint value for php-fpm + # Check if current_fpm_footprint is an integer + if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null + then + echo "specific" + else + echo "$current_fpm_footprint" + fi +} -# Free footprint value for php-fpm -# Check if fpm_footprint is an integer -if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null -then - # If fpm_footprint is an integer, that's a numeric value for the footprint - old_free_footprint=$fpm_footprint - fpm_footprint=specific -else - old_free_footprint=0 -fi -free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}" - -# Usage for php-fpm -old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)" -fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}" - -#================================================= -# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND -#================================================= - -show_config() { - # here you are supposed to read some config file/database/other then print the values - # ynh_return "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value" - - ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT=$fpm_footprint" - ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT=$free_footprint" - ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE=$fpm_usage" +get__free_footprint() { + # Free footprint value for php-fpm + # Check if current_fpm_footprint is an integer + if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null + then + # If current_fpm_footprint is an integer, that's a numeric value for the footprint + echo "$current_fpm_footprint" + else + echo "0" + fi } #================================================= -# MODIFY THE CONFIGURATION +# SPECIFIC SETTERS FOR TOML SHORT KEYS #================================================= -apply_config() { +set__maintenance_mode() { + if [ "$maintenance_mode" -eq "0" ]; then + # If maintenance_mode was set to 0, disable maintenance mode + (cd "$final_path" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --off) + ynh_print_info "Maintenance mode disabled" + elif [ "$maintenance_mode" -eq "1" ]; then + # If maintenance_mode was set to 1, enable maintenance mode + (cd "$final_path" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --on) + ynh_print_info "Maintenance mode enabled" + fi + ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode" +} - #================================================= - # RECONFIGURE PHP-FPM - #================================================= - - if [ "$fpm_usage" != "$old_fpm_usage" ] || [ "$fpm_footprint" != "$old_fpm_footprint" ] || [ "$free_footprint" != "$old_free_footprint" ] +set__fpm_footprint() { + if [ "$fpm_footprint" != "specific" ] then - # If fpm_footprint is set to 'specific', use $free_footprint value. - if [ "$fpm_footprint" = "specific" ] - then - fpm_footprint=$free_footprint - fi + ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint" + fi +} - if [ "$fpm_footprint" != "0" ] - then - ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" - else - ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below." - fi +set__fpm_free_footprint() { + if [ "$fpm_footprint" = "specific" ] + then + ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint" fi } #================================================= # GENERIC FINALIZATION #================================================= -# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT -#================================================= -case $1 in - show) show_config;; - apply) apply_config;; -esac +ynh_app_config_validate() { + _ynh_app_config_validate + + if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then + # If fpm_footprint is set to 'specific', use $fpm_free_footprint value. + if [ "$fpm_footprint" = "specific" ] + then + fpm_footprint=$fpm_free_footprint + fi + + if [ "$fpm_footprint" == "0" ] + then + ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below." + + exit 0 + fi + fi +} + +ynh_app_config_apply() { + _ynh_app_config_apply + + ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint +} + +ynh_app_config_run $1 diff --git a/scripts/install b/scripts/install index 3ed8f22..981c8be 100755 --- a/scripts/install +++ b/scripts/install @@ -25,6 +25,7 @@ path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN user_home=$YNH_APP_ARG_USER_HOME is_public=$YNH_APP_ARG_IS_PUBLIC +phpversion=$YNH_PHP_VERSION app=$YNH_APP_INSTANCE_NAME @@ -39,6 +40,12 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +# Check machine architecture (Nextcloud will soon deprecate 32-bit support) +if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armhf" ] +then + ynh_print_warn --message="Nextcloud will soon deprecate 32-bit support. It is recommended to upgrade to a 64-bit architecture." +fi + #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -49,6 +56,9 @@ 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=user_home --value=$user_home +maintenance_mode=0 +ynh_app_setting_set --app=$app --key=maintenance_mode --value=$maintenance_mode + #================================================= # STANDARD MODIFICATIONS #================================================= @@ -64,8 +74,9 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Creating a MySQL database..." --weight=2 db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -103,8 +114,16 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring PHP-FPM..." --weight=50 +fpm_footprint="high" +fpm_free_footprint=0 +fpm_usage="medium" + +ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=medium --footprint=high --phpversion=$YNH_PHP_VERSION +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION # Used by ynh_add_nginx_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -161,7 +180,7 @@ admin_password="$(ynh_string_random --length=6)" # Install Nextcloud using a temporary admin user exec_occ maintenance:install \ --database "mysql" --database-name $db_name \ - --database-user $db_name --database-pass "$db_pwd" \ + --database-user $db_user --database-pass "$db_pwd" \ --admin-user "admin" --admin-pass "$admin_password" \ --data-dir "$datadir" \ || ynh_die --message="Unable to install Nextcloud" @@ -256,7 +275,7 @@ exec_occ config:system:set overwrite.cli.url --value="https://${domain}" #================================================= # Set the user as admin -ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name \ +ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \ <<< "INSERT INTO oc_group_user VALUES ('admin','$admin');" # And delete admin user exec_occ user:delete admin diff --git a/scripts/remove b/scripts/remove index 024ed93..36db879 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) @@ -37,7 +38,7 @@ ynh_remove_app_dependencies ynh_script_progression --message="Removing the MySQL database..." --weight=5 # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index 1775ff2..45c43f4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,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) +db_user=$db_name phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) datadir=$(ynh_app_setting_get --app=$app --key=datadir) @@ -43,21 +44,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -# Check if .well-known is available for this domain -if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav" -then - ynh_print_warn --message="Another app already uses the domain $domain to serve a caldav/carddav feature. You may encounter issues when dealing with your calendar or address book." - - # Remove lines about .well-known/carddav and caldav with sed. - sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$domain.d/$app.conf" -fi - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -71,8 +57,8 @@ ynh_restore_file --origin_path="$final_path" ynh_script_progression --message="Restoring the MySQL database..." --weight=9 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 -ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RECREATE THE DEDICATED USER @@ -103,15 +89,32 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +# Check if .well-known is available for this domain +if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav" +then + ynh_print_warn --message="Another app already uses the domain $domain to serve a caldav/carddav feature. You may encounter issues when dealing with your calendar or address book." + + # Remove lines about .well-known/carddav and caldav with sed. + sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$domain.d/$app.conf" +fi + #================================================= # RESTORE THE CRON FILE #================================================= +ynh_script_progression --message="Restoring cron job..." --weight=1 ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # BACKUP THE LOGROTATE CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 ynh_restore_file --origin_path="/etc/logrotate.d/$app" diff --git a/scripts/upgrade b/scripts/upgrade index 30ab6cb..de5d286 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,9 +21,10 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) 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 user_home=$(ynh_app_setting_get --app=$app --key=user_home) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +maintenance_mode=$(ynh_app_setting_get --app=$app --key=maintenance_mode) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) @@ -33,6 +34,12 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) upgrade_type=$(ynh_check_app_version_changed) +# Check machine architecture (Nextcloud will soon deprecate 32-bit support) +if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armhf" ] +then + ynh_print_warn --message="Nextcloud will soon deprecate 32-bit support. It is recommended to upgrade to a 64-bit architecture." +fi + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -59,23 +66,30 @@ fi # Remove the option backup_core_only if it's in the settings.yml file ynh_app_setting_delete --app=$app --key=backup_core_only +# If maintenance_mode doesn't exist, create it +if [ -z "$maintenance_mode" ]; then + maintenance_mode=0 + ynh_app_setting_set --app=$app --key=maintenance_mode --value=$maintenance_mode +fi + # If fpm_footprint doesn't exist, create it if [ -z "$fpm_footprint" ]; then fpm_footprint=high ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint fi +# If fpm_free_footprint doesn't exist, create it +if [ -z "$fpm_free_footprint" ]; then + fpm_free_footprint=0 + ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +fi + # If fpm_usage doesn't exist, create it if [ -z "$fpm_usage" ]; then fpm_usage=medium ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi -# If phpversion doesn't exist, create it -if [ -z "$phpversion" ]; then - phpversion="$YNH_PHP_VERSION" -fi - # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -88,6 +102,11 @@ if ! ynh_permission_exists --permission="api"; then ynh_permission_create --permission="api" --label="api" --url="re:$domain\/.well-known\/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true" fi +# Delete existing ini configuration file (backward compatibility) +if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -148,26 +167,10 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 -# If php has changed, remove the old fpm config file -if [ "$phpversion" != $YNH_PHP_VERSION ] -then - ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" - fi - ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload - - phpversion="$YNH_PHP_VERSION" -fi - # Recreate a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -# Delete existing ini configuration file (backward compatibility) -if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$phpversion/fpm/conf.d/20-$app.ini -fi +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION diff --git a/scripts/upgrade.d/upgrade.22.sh b/scripts/upgrade.d/upgrade.22.sh new file mode 100644 index 0000000..81844ab --- /dev/null +++ b/scripts/upgrade.d/upgrade.22.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available Nextcloud version +next_version="23.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="c37592abc3b65c8fd28459281a24f414b87af52fc8c2ea979be3f9be75d01a2c" diff --git a/scripts/upgrade.d/upgrade.23.sh b/scripts/upgrade.d/upgrade.23.sh new file mode 100644 index 0000000..eb2b944 --- /dev/null +++ b/scripts/upgrade.d/upgrade.23.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available Nextcloud version +next_version="24.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="176cb5620f20465fb4759bdf3caaebeb7acff39d6c8630351af9f8738c173780" diff --git a/scripts/upgrade.d/upgrade.24.sh b/scripts/upgrade.d/upgrade.24.sh new file mode 100644 index 0000000..658c57d --- /dev/null +++ b/scripts/upgrade.d/upgrade.24.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available Nextcloud version +next_version="25.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="2c05ac9d7b72b44ef8b3d2ae03ff0fd6121e254b8054556f5163bd8760dd8f49" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh old mode 100755 new mode 100644 index 3382934..bb058bb --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Last available Nextcloud version -next_version="22.2.9" +next_version="25.0.3" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="0beb6b959db855e30023954bd1299b6bb1331f895e3095b51350ab5eaeb5b1cd" +nextcloud_source_sha256="4b2b1423736ef92469096fe24f61c24cad87a34e07c1c7a81b385d3ea25c00ec" diff --git a/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch b/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch index 38f37f9..43159c3 100644 --- a/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch +++ b/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch @@ -12,6 +12,6 @@ index e9ecf00036..8e69c8d2dc 100644 - protected $evalScriptAllowed = false; + // YunoHost patch: allow for eval in JS scripts for YunoHost tile + protected $evalScriptAllowed = true; - /** @var array Domains from which scripts can get loaded */ - protected $allowedScriptDomains = [ - '\'self\'', + /** @var bool Whether strict-dynamic should be set */ + protected $strictDynamicAllowed = null; + /** @var array Domains from which scripts can get loaded */