diff --git a/README.md b/README.md index b4b939b..e439bda 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,18 @@ # Nextcloud for YunoHost [![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) -[![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) +[![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)* + > *This package allow you to install Nextcloud 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 -[Nextcloud](https://nextcloud.com) gives you freedom and control over your -own data. A personal cloud which runs on your own server. With Nextcloud -you can synchronize your files over your devices. +[Nextcloud](https://nextcloud.com) gives you freedom and control over your own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices. - -**Shipped version:** 19.0.3 +**Shipped version:** 20.0.7 ## Screenshots @@ -27,7 +25,7 @@ you can synchronize your files over your devices. ## Documentation - * Official documentation: https://docs.nextcloud.com/server/19/user_manual/ + * Official documentation: https://docs.nextcloud.com/server/20/user_manual/en/ * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud.md ## Configuration @@ -37,11 +35,11 @@ you can synchronize your files over your devices. 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 *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** (Raspberry Pi, …) is **not** supported* +*NB: OnlyOffice is only available for x86 architecture - **ARM** architecture is **not** supported (Raspberry Pi, OLinuXino...)* ## YunoHost specific features @@ -51,10 +49,8 @@ this package: * Integrate with YunoHost users and SSO - i.e. logout button * Allow one user to be the administrator (set at the installation) * Allow multiple instances of this application - * Optionally access the user home folder from Nextcloud files (set at the - installation, the sharing is enabled by default) - * Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's - not already served - i.e. by Baïkal + * Optionally access the user home folder from Nextcloud files (set at the installation, the sharing is enabled by default) + * Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal #### Multi-users support @@ -65,13 +61,9 @@ this package: ## Limitations -To integrate the logout button to the SSO, we have to patch Nextcloud sources. -In waiting an upstream integration, the source code integrity checking has been -disabled to prevent the warning message. +To integrate the logout button to the SSO, we have to patch Nextcloud sources. In waiting an upstream integration, the source code integrity checking has been disabled to prevent the warning message. -Also, note we made the choice to disable third-parties applications at the -upgrade. It allows to prevent an unstable - and sometimes broken - Nextcloud -installation. You will just have to manually activate them after the upgrade. +Also, note we made the choice to disable third-parties applications at the upgrade. It allows to prevent an unstable - and sometimes broken - Nextcloud installation. You will just have to manually activate them after the upgrade. Finally, the following error message in Nextcloud logs can be safely ignored: ``` @@ -89,38 +81,6 @@ If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/n ¹ See https://docs.nextcloud.com/server/18/admin_manual/configuration_server/occ_command.html Use this only if you know what you're doing :) -#### Migrate from ownCloud - -**This is not considered as stable yet, please do it with care and only for -testing!** - -This package handles the migration from ownCloud to Nextcloud. For that, your -ownCloud application must be **up-to-date** in YunoHost. - -You will then have to upgrade your ownCloud application with this repository. -This can only be done from the command-line interface - e.g. through SSH. Once -you're connected, you simply have to execute the following: - -```bash -sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh owncloud --debug -``` - -The `--debug` option will let you see the full output. If you encounter any -issue, please paste it. - -Note that a cron job will be executed at some time after the end of this -command. You must wait that before doing any other application operations! -You should see that Nextcloud is installed after that. - -Note that it does not change the application label nor the URL. To rename -the label, you can execute the following - replace `Nextcloud` with whatever -you want: - -```bash -sudo yunohost app setting nextcloud label -v "Nextcloud" -sudo yunohost app ssowatconf -``` - ## Links * Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues @@ -130,8 +90,7 @@ sudo yunohost app ssowatconf --- -Developers infos ----------------- +## Developers infos Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). diff --git a/README_fr.md b/README_fr.md index 404ef69..a949264 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,11 +1,10 @@ # Nextcloud pour YunoHost [![Niveau d'integration](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg) -[![Installer Nextcloud avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) +[![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.* @@ -14,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour [Nextcloud](https://nextcloud.com) vous donne la liberté et le contrôle sur vos données. Un nuage personnel qui tourne sur votre serveur. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 19.0.3 +**Version incluse :** 20.0.7 ## Captures d'écran @@ -27,21 +26,21 @@ Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. ## Documentation - * Documentation officielle : https://docs.nextcloud.com/server/19/user_manual/ + * Documentation officielle : https://docs.nextcloud.com/server/20/user_manual/fr/ * Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md ## Configuration #### Configurer l'intégration d'OnlyOffice -À partir de sa version 18, Nextcloud intégre une intégration directe de OnlyOffice (un éditeur de texte enrichi en ligne) via une application Nextcloud. -Pour l'installer et le 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. - - Et voilà :) Vous devriez pouvoir créer de nouveaux types de documents, et les ouvrir. +À 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. +- Et voilà :) Vous devriez pouvoir créer de nouveaux types de documents, et les ouvrir. - *NB : OnlyOffice n'est disponible que sous architecture x86 - **ARM** (Raspberry Pi, …) n'est **pas** supporté* +*NB : OnlyOffice n'est disponible que sous architecture x86 - L'architecture **ARM** n'est **pas** supporté (Raspberry Pi, OLinuXino...)* ## Caractéristiques spécifiques YunoHost @@ -73,32 +72,7 @@ Et enfin, le message d'erreur suivant dans les logs de Nextcloud peut être igno Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/') ``` -## Informations supplémentaires - -#### Migrer depuis ownCloud - -**La migration n'est pas encore considérée comme stable, merci de la faire prudemment et uniquement pour tester !** - -Ce package gère la migration de OwnCloud vers Nextcloud. Pour ça, l'application OwnCloud doit **être à jour** dans YunoHost. - -Vous allez ensuite mettre à niveau votre OwnCloud avec ce dépôt. -Ça ne peut être fait qu'en ligne de commande - par exemple via SSH. Une fois connecté, vous n'avez plus qu'à exécuter la commande suivante : -```bash -sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh owncloud --debug -``` - -L'option `--debug` va vous permettre de visualiser entièrement les retours de la mise à niveau. Si vous rencontrez un problème, merci de nous le transmettre. - -Notez qu'une tâche cron va être exécutée une fois la fin de cette commande. Vous devez attendre qu'elle se fasse avant de faire une autre opération liée aux applications. -Vous devriez constater que Nextcloud sera installé après ça. - -Notez que ça ne changera pas le label ni l'URL. Pour renommer le label, vous pouvez exécuter la commande suivante (en remplaçant `Nextcloud` par ce que vous voulez) : -```bash -sudo yunohost app setting nextcloud label -v "Nextcloud" -sudo yunohost app ssowatconf -``` - -## Links +## Liens * Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Site web de Nextcloud : https://nextcloud.com/ @@ -107,8 +81,7 @@ sudo yunohost app ssowatconf --- -Informations pour les développeurs ----------------- +## Informations pour les développeurs Merci de faire votre « pull request » sur la [branche testing](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). Pour tester la branche testing, faites comme ceci. diff --git a/check_process b/check_process index 0ee0bab..440eb43 100644 --- a/check_process +++ b/check_process @@ -18,8 +18,6 @@ incorrect_path=1 port_already_use=0 change_url=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=none diff --git a/conf/nginx.conf b/conf/nginx.conf index 0cf3732..e9f864a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,27 +1,20 @@ -location = /.well-known/carddav { - return 301 https://$server_name__PATH__/remote.php/dav; -} -location = /.well-known/caldav { - return 301 https://$server_name__PATH__/remote.php/dav; -} +location ^~ /.well-known { + # The following 6 rules are borrowed from `.htaccess` -# The following 2 rules are only needed for the user_webfinger app. -# Uncomment it if you're planning to use this app. -#location = /.well-known/host-meta { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta; -#} -#location = /.well-known/host-meta.json { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta-json; -#} + # The following 2 rules are only needed for the user_webfinger app. + # Uncomment it if you're planning to use this app. + #rewrite ^/\.well-known/host-meta\.json __PATH__/public.php?service=host-meta-json last; + #rewrite ^/\.well-known/host-meta __PATH__/public.php?service=host-meta last; + # The following 2 rules are only needed for the Social app. + # Uncomment it if you're planning to use this app. + #rewrite ^/\.well-known/webfinger __PATH__/public.php?service=webfinger last; + #rewrite ^/\.well-known/nodeinfo __PATH__/public.php?service=nodeinfo last; -# The following 2 rules are only needed for the Social app. -# Uncomment it if you're planning to use this app. -#location = /.well-known/webfinger { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=webfinger; -#} -#location = /.well-known/nodeinfo { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=nodeinfo; -#} + location = /.well-known/carddav { return 301 __PATH__/remote.php/dav/; } + location = /.well-known/caldav { return 301 __PATH__/remote.php/dav/; } + + try_files $uri $uri/ =404; +} #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { @@ -36,33 +29,53 @@ location ^~ __PATH__/ { # Add headers to serve security related headers more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;"; - more_set_headers "X-Content-Type-Options: nosniff"; - more_set_headers "X-XSS-Protection: 1; mode=block"; - more_set_headers "X-Robots-Tag: none"; - more_set_headers "X-Download-Options: noopen"; - more_set_headers "X-Permitted-Cross-Domain-Policies: none"; more_set_headers "Referrer-Policy: no-referrer"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "X-Download-Options: noopen"; + more_set_headers "X-Frame-Options: SAMEORIGIN"; + more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "X-Robots-Tag: none"; + more_set_headers "X-XSS-Protection: 1; mode=block"; # Set max upload size client_max_body_size 10G; fastcgi_buffers 64 4K; - # Extend timeouts - client_body_timeout 60m; - proxy_read_timeout 60m; - fastcgi_read_timeout 60m; + # Enable gzip but do not remove ETag headers + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; - # Disable gzip to avoid the removal of the ETag header - gzip off; + # Pagespeed is not supported by Nextcloud, so if your server is built + # with the `ngx_pagespeed` module, uncomment this line to disable it. + #pagespeed off; - # Errors pages - error_page 403 __PATH__/core/templates/403.php; - # Don't set custom 404 error page, as nextcloud uses 404 codes with meaningful payload. - # Setting custom 404 page clears the payload and creates UI bugs - # error_page 404 __PATH__/core/templates/404.php; + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; - location __PATH__/ { - rewrite ^ __PATH__/index.php; + # Specify how to handle directories -- specifying `/nextcloud/index.php$request_uri` + # here as the fallback means that Nginx always exhibits the desired behaviour + # when a client requests a path that corresponds to a directory that exists + # on the server. In particular, if that directory contains an index.php file, + # that file is correctly served; if it doesn't, then the request is passed to + # the front-end controller. This consistent behaviour means that we don't need + # to specify custom rules for certain paths (e.g. images and other assets, + # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus + # `try_files $uri $uri/ /nextcloud/index.php$request_uri` + # 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 ) { + return 302 __PATH__/remote.php/webdav/$is_args$args; + } } location = __PATH__/robots.txt { @@ -71,15 +84,16 @@ location ^~ __PATH__/ { access_log off; } - location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)\/ { - deny all; - } - location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { - deny all; - } + # Rules borrowed from `.htaccess` to hide certain paths from clients + location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } + location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } - location ~ ^__PATH__/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { - fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; + # Ensure this block, which passes PHP files to the PHP process, is above the blocks + # which handle static assets (as seen below). If this block is not declared first, + # then Nginx will encounter an infinite rewriting loop when it prepends + # `/nextcloud/index.php` to the URI, resulting in a HTTP 500 error response. + location ~ \.php(?:$|/) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; include fastcgi_params; @@ -87,62 +101,33 @@ location ^~ __PATH__/ { fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $path_info; fastcgi_param HTTPS on; - # Avoid sending the security headers twice - fastcgi_param modHeadersAvailable true; - # Enable pretty urls - fastcgi_param front_controller_active true; - fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock; + fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice + fastcgi_param front_controller_active true; # Enable pretty urls + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; } - location ~ ^__PATH__/(?:updater|oc[ms]-provider)(?:$|\/) { - try_files $uri/ =404; - index index.php; + location ~ \.(?:css|js|svg|gif)$ { + try_files $uri / __PATH__/index.php$request_uri; + expires 6M; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets } - location = __PATH__/core/js/oc.js { - rewrite ^ __PATH__/index.php$request_uri; + location ~ \.woff2?$ { + try_files $uri / __PATH__/index.php$request_uri; + expires 7d; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets } - location = __PATH__/core/preview.png { - rewrite ^ __PATH__/index.php$request_uri; - } - - location ~* ^__PATH__/(?:css|js)/ { - rewrite ^ __PATH__/index.php$request_uri; - } - - location ~* ^__PATH__/apps/theming/img/core/filetypes/ { - rewrite ^ __PATH__/index.php$request_uri; - } - - location ~* ^__PATH__/apps/documentserver_community/ { - rewrite ^ __PATH__/index.php$request_uri; - } - - # Adding the cache control header for js, css and map files - location ~ ^__PATH__/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ { - try_files $uri __PATH__/index.php$request_uri; - more_set_headers "Cache-Control: public, max-age=15778463"; - # Add headers to serve security related headers - more_set_headers "Strict-Transport-Security: max-age=15768000"; - more_set_headers "X-Content-Type-Options: nosniff"; - more_set_headers "X-XSS-Protection: 1; mode=block"; - more_set_headers "X-Robots-Tag: none"; - more_set_headers "X-Download-Options: noopen"; - more_set_headers "X-Permitted-Cross-Domain-Policies: none"; - more_set_headers "X-Frame-Options: SAMEORIGIN"; - more_set_headers "Referrer-Policy: no-referrer"; - - # Optional: Don't log access to assets - access_log off; - } - - location ~ ^__PATH__/.+[^\/]\.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ { - try_files $uri __PATH__/index.php$request_uri; - # Optional: Don't log access to other assets - access_log off; + location ~ / { + if ($request_method ~ ^PUT$) { + rewrite ^ __PATH__/index.php$request_uri last; + } + if ($request_method ~ ^DELETE$) { + rewrite ^ __PATH__/index.php$request_uri last; + } + try_files $uri / __PATH__/index.php$request_uri; } # show YunoHost panel access diff --git a/conf/owncloud_migration b/conf/owncloud_migration deleted file mode 100644 index 4c1be85..0000000 --- a/conf/owncloud_migration +++ /dev/null @@ -1,13 +0,0 @@ -# File to migrate from Owncloud - -# Final path -/var/www/$app - -# Data directory -/home/yunohost.app/$app - -# Nginx config -/etc/nginx/conf.d/$domain.d/$app.conf - -# php-fpm config -/etc/php5/fpm/pool.d/$app.conf diff --git a/conf/owncloud_post_migration.sh b/conf/owncloud_post_migration.sh deleted file mode 100644 index 952baac..0000000 --- a/conf/owncloud_post_migration.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# Ending the migration process from Owncloud to Nextcloud - -set -u - -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source /usr/share/yunohost/helpers - -#================================================= -# SET VARIABLES -#================================================= - -old_app="__OLD_APP__" -new_app="__NEW_APP__" -script_name="$0" - -#================================================= -# MOVE HOOKS -#================================================= - -hooks_dir="/etc/yunohost/hooks.d/" -mv "$hooks_dir/post_user_create/50-$old_app" "$hooks_dir/post_user_create/50-$new_app" - -#================================================= -# DELETE OLD APP'S SETTINGS -#================================================= - -ynh_secure_remove "/etc/yunohost/apps/$old_app" -yunohost app ssowatconf - -#================================================= -# REMOVE THE OLD USER -#================================================= - -ynh_system_user_delete $old_app - -#================================================= -# DELETE THIS SCRIPT -#================================================= - -echo "rm $script_name" | at now + 1 minutes diff --git a/manifest.json b/manifest.json index 75aa560..9bb361f 100644 --- a/manifest.json +++ b/manifest.json @@ -3,10 +3,10 @@ "name": "Nextcloud", "packaging_format": 1, "description": { - "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", - "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" + "en": "Online storage, file sharing platform and various other applications", + "fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications" }, - "version": "19.0.3~ynh1", + "version": "20.0.7~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { @@ -14,12 +14,12 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.8.0" + "yunohost": ">= 4.1.6" }, "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { diff --git a/pull_request_template.md b/pull_request_template.md index da30b7b..f501dd4 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -18,7 +18,7 @@ - [ ] **Code review** : - [ ] **Approval (LGTM)** : - [ ] **Approval (LGTM)** : -- **CI succeeded** : -[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/) -*Please replace '-NUM-' in this link by the PR number.* -When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. + +## Package_check results +--- +* 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/_common.sh b/scripts/_common.sh index 2b9a766..ebffb0e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -154,7 +154,7 @@ ynh_handle_app_migration () { # TODO Handle multi instance apps... # Check that there is not already an app installed for this id. - (yunohost app list --installed -f "$new_app" | grep -q id) \ + yunohost app list | grep -q 'id: $appname' \ && ynh_die "$new_app is already installed" #================================================= @@ -341,7 +341,7 @@ ynh_smart_mktemp () { ynh_die "Insufficient free space to continue..." fi - echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" + echo "$(mktemp --directory --tmpdir="$tmpdir")" } #================================================= @@ -360,7 +360,7 @@ ynh_multimedia_build_main_dir () { local checksum="806a827ba1902d6911095602a9221181" # Download yunohost.multimedia scripts - wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz + wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1 # Check the control sum echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ diff --git a/scripts/backup b/scripts/backup index bb92dda..7ed3c7f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,6 +26,7 @@ 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) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -48,7 +49,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/change_url b/scripts/change_url index 2aa5f36..5cb1cb9 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED @@ -63,7 +64,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config YNH_PHP_VERSION + ynh_add_nginx_config fi # Change the domain for NGINX @@ -84,7 +85,7 @@ ynh_script_progression --message="Applying Nextcloud specific modifications..." # Define a function to execute commands with `occ` exec_occ() { (cd "$final_path" && exec_as "$app" \ - php${YNH_PHP_VERSION} occ --no-interaction --no-ansi "$@") + php${phpversion} occ --no-interaction --no-ansi "$@") } if [ $change_domain -eq 1 ] @@ -104,7 +105,7 @@ 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/$new_domain.d/$app.conf" + sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi fi diff --git a/scripts/config b/scripts/config index 1d774dd..0c14bca 100644 --- a/scripts/config +++ b/scripts/config @@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # LOAD VALUES #================================================= @@ -77,7 +79,7 @@ apply_config() { if [ "$fpm_footprint" != "0" ] then - ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION + 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 diff --git a/scripts/install b/scripts/install index cfe9d5b..1e1621d 100755 --- a/scripts/install +++ b/scripts/install @@ -84,22 +84,8 @@ cp -a ../sources/patches_last_version/* ../sources/patches # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - -# 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' "../conf/nginx.conf" -fi - -# Create a dedicated NGINX config -ynh_add_nginx_config YNH_PHP_VERSION +# Allow Symlinks for multimedia folder +ynh_replace_string --match_string="protected \$allowSymlinks = false;" --replace_string="protected \$allowSymlinks = true;" --target_file="$final_path/lib/private/Files/Storage/Local.php" #================================================= # CREATE DEDICATED USER @@ -116,6 +102,25 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=50 # Create a dedicated php-fpm config ynh_add_fpm_config --usage=medium --footprint=high --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +# Used by ynh_add_nginx_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + +# 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' "../conf/nginx.conf" +fi + +# Create a dedicated NGINX config +ynh_add_nginx_config #================================================= # SPECIFIC SETUP @@ -136,7 +141,7 @@ ynh_script_progression --message="Installing Nextcloud..." --weight=30 # Define a function to execute commands with `occ` exec_occ() { (cd "$final_path" && exec_as "$app" \ - php$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@") + php${phpversion} occ --no-interaction --no-ansi "$@") } # Set write access for the following commands @@ -158,7 +163,7 @@ ynh_script_progression --message="Configuring Nextcloud..." --weight=8 # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification -# Enable ldap plugin +# Enable LDAP plugin exec_occ app:enable user_ldap exec_occ ldap:create-empty-config @@ -187,7 +192,7 @@ ynh_secure_remove --file="$nc_conf" #================================================= # Check LDAP configuration to see if everything worked well -exec_occ ldap:test-config \'\' \ +exec_occ ldap:test-config '' \ || ynh_die --message="An error occured during LDAP configuration" #================================================= @@ -265,7 +270,7 @@ chmod 644 "$cron_path" ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$cron_path" ynh_replace_string --match_string="__DESTDIR__" --replace_string="$final_path" --target_file="$cron_path" -ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$YNH_PHP_VERSION" --target_file="$cron_path" +ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path" exec_occ background:cron @@ -273,12 +278,9 @@ exec_occ background:cron # POST-INSTALL MAINTENANCE #================================================= -( - cd $final_path - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns - sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n -) +exec_occ db:add-missing-indices +exec_occ db:add-missing-columns +exec_occ db:convert-filecache-bigint -n #================================================= # CONFIGURE THE HOOK FILE FOR USER CREATE @@ -327,9 +329,9 @@ ynh_use_logrotate --logfile="$datadir/nextcloud.log" #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring Fail2ban..." --weight=8 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=8 -# Create a dedicated Fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= diff --git a/scripts/remove b/scripts/remove index ebf87d2..b84d5bf 100755 --- a/scripts/remove +++ b/scripts/remove @@ -73,9 +73,9 @@ ynh_remove_logrotate #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing Fail2ban configuration..." --weight=8 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8 -# Remove the dedicated Fail2ban config +# Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config #================================================= diff --git a/scripts/restore b/scripts/restore index daa51e9..44f8384 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) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) @@ -55,7 +56,7 @@ 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" + sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$domain.d/$app.conf" fi #================================================= @@ -98,10 +99,10 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50 # Restore the file first, so it can have a backup if different -ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +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=$YNH_PHP_VERSION --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion --package="$extra_php_dependencies" #================================================= # RESTORE THE CRON FILE @@ -156,7 +157,7 @@ ynh_multimedia_addaccess $app #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the Fail2ban configuration..." --weight=7 +ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=7 ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index 6c76b8f..5805432 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,7 @@ 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) user_home=$(ynh_app_setting_get --app=$app --key=user_home) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) @@ -64,6 +65,11 @@ if [ -z "$fpm_usage" ]; then 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 + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -88,49 +94,14 @@ then ynh_app_setting_delete $app backup_core_only ynh_clean_setup () { - # Remove the post migration script before its execution ! - ynh_exec_warn_less ynh_secure_remove --file="/tmp/owncloud_post_migration.sh" - - # restore it if the upgrade fails - ynh_restore_upgradebackup + # restore it if the upgrade fails + ynh_restore_upgradebackup } fi # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# HANDLE MIGRATION FROM OWNCLOUD -#================================================= - -ynh_handle_app_migration "owncloud" "owncloud_migration" -if [ $migration_process -eq 1 ] -then - # If a migration has been performed - # Reload some values changed by the migration process - final_path=$(ynh_app_setting_get --app=$app --key=final_path) - db_name=$(ynh_app_setting_get --app=$app --key=db_name) - - # Remove the old fake package for owncloud. - # Its name is specific, so the migration process can't remove it - ynh_package_autopurge owncloud-deps - - # Change the database access in the config - ynh_replace_string "\('dbname' =>\).*" "\1 '$db_name'," "$final_path/config/config.php" - ynh_replace_string "\('dbuser' =>\).*" "\1 '$db_name'," "$final_path/config/config.php" - - # Change the path of the data directory - ynh_replace_string "\('dbuser' =>\).*" "\1 '$db_name'," "$final_path/config/config.php" - ynh_replace_string "\('datadirectory' =>.*\)$old_app" "\1$app" "$final_path/config/config.php" -fi - -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -140,32 +111,6 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # STANDARD UPGRADE STEPS -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 - -ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" - -# Delete current nginx configuration to be able to check if .well-known is already served. -ynh_remove_nginx_config -ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" - -# Wait untils nginx has fully reloaded -ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" - -# 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' "../conf/nginx.conf" -fi - -# Create a dedicated nginx config -ynh_add_nginx_config YNH_PHP_VERSION - #================================================= # CREATE DEDICATED USER #================================================= @@ -179,14 +124,53 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 -# Recreate a dedicated php-fpm config -ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" +# 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 --package="$extra_php_dependencies" # 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 +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 +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 + +ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" + +# Delete current NGINX configuration to be able to check if .well-known is already served. +ynh_remove_nginx_config +ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" + +# Wait untils NGINX has fully reloaded +ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" + +# 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' "../conf/nginx.conf" +fi + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC UPGRADE #================================================= @@ -199,7 +183,7 @@ exec_occ() { # Backward compatibility to upgrade from NC14 or older version if [ $current_major_version = "last" ] || [ $current_major_version -ge 15 ] then - NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION + NEXTCLOUD_PHP_VERSION=$phpversion else NEXTCLOUD_PHP_VERSION="7.0" fi @@ -212,8 +196,8 @@ exec_occ() { create_external_storage() { local datadir="$1" local mount_name="$2" -local mount_id=`exec_occ files_external:create --output=json \ - "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` +local mount_id=$(exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true) ! [[ $mount_id =~ ^[0-9]+$ ]] \ && ynh_print_warn --message="Unable to create external storage" \ || exec_occ files_external:option "$mount_id" enable_sharing true @@ -237,6 +221,17 @@ then # Print the current version number of Nextcloud exec_occ -V + + # Upgrade may fail if this app is enabled + # Take all apps enabled, and check if mail is one of them + # Then temporary disable the mail app + mail_app_must_be_reactived=0 + + if exec_occ app:list | awk '/Enabled/{f=1;next} /Disabled/{f=0} f' | grep -q -w mail; then + exec_occ app:disable mail + mail_app_must_be_reactived=1 + fi + # While the current version is not the last version, do an upgrade while [ "$last_version" != "$current_version" ] do @@ -244,9 +239,17 @@ then # The major version is the first part of the version number current_major_version=${current_version%%.*} + if [ ! -f upgrade.d/upgrade.$current_major_version.sh ]; then + source upgrade.d/upgrade.last.sh + else + source upgrade.d/upgrade.$current_major_version.sh + fi + # If the current version has the same major version than the next one, # then it's the last upgrade to do - if [ "$last_major_version" -eq "$current_major_version" ]; then + # We also cover the case where the last version is the first of the current major version series + # (e.g. 20.0.0 is the latest version) + if [[ ("$last_major_version" -eq "$current_major_version") || ( ("$last_major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then current_major_version=last # Enable YunoHost patches on Nextcloud sources cp -a ../sources/patches_last_version/* ../sources/patches @@ -268,6 +271,9 @@ then # Install the next nextcloud version in $tmpdir ynh_setup_source --dest_dir="$tmpdir" + # Allow Symlinks for multimedia folder + ynh_replace_string --match_string="protected \$allowSymlinks = false;" --replace_string="protected \$allowSymlinks = true;" --target_file="$tmpdir/lib/private/Files/Storage/Local.php" + # Enable maintenance mode exec_occ maintenance:mode --on @@ -309,12 +315,10 @@ then exec_occ -V done - ( - cd $final_path - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns - sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n - ) + exec_occ db:add-missing-indices -n + exec_occ db:add-missing-columns -n + exec_occ db:add-missing-primary-keys -n + exec_occ db:convert-filecache-bigint -n #================================================= # CONFIGURE NEXTCLOUD @@ -330,10 +334,15 @@ then ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$nc_conf" ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$nc_conf" + # Reneable the mail app + if [ $mail_app_must_be_reactived -eq 1 ]; then + exec_occ app:enable mail + fi + # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification - # Enable plugins + # Enable LDAP plugin exec_occ app:enable user_ldap # Load the config file in nextcloud @@ -397,7 +406,7 @@ chmod 644 "$cron_path" ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$cron_path" ynh_replace_string --match_string="__DESTDIR__" --replace_string="$final_path" --target_file="$cron_path" -ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$YNH_PHP_VERSION" --target_file="$cron_path" +ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path" exec_occ background:cron @@ -445,9 +454,9 @@ ynh_use_logrotate --non-append #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring Fail2ban..." --weight=7 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=7 -# Create a dedicated Fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= @@ -464,30 +473,10 @@ ynh_app_setting_set --app=$app --key=skipped_regex \ #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=nginx --action=reload - -#================================================= -# FINISH MIGRATION PROCESS -#================================================= - -if [ $migration_process -eq 1 ] -then - ynh_print_info --message="OwnCloud has been successfully migrated to Nextcloud! \ -A last scheduled operation will run in a couple of minutes to finish the \ -migration in YunoHost side. Do not proceed any application operation while \ -you don't see Nextcloud as installed." - - # Execute a post migration script after the end of this upgrade. - # Mainly for some cleaning - script_post_migration=owncloud_post_migration.sh - ynh_replace_string --match_string="__OLD_APP__" --replace_string="$old_app" --target_file=../conf/$script_post_migration - ynh_replace_string --match_string="__NEW_APP__" --replace_string="$app" --target_file=../conf/$script_post_migration - cp ../conf/$script_post_migration /tmp - chmod +x /tmp/$script_post_migration - (cd /tmp; echo "/tmp/$script_post_migration > /tmp/$script_post_migration.log 2>&1" | at now + 2 minutes) -fi +ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/upgrade.d/upgrade.19.sh b/scripts/upgrade.d/upgrade.19.sh new file mode 100644 index 0000000..c44f02b --- /dev/null +++ b/scripts/upgrade.d/upgrade.19.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="20.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="a273e0151f68567f729d9a82a7e3f124ff0f0471aa17bae6bfd83c5362d84cd8" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 569c56e..1e8134f 100755 --- 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="19.0.3" +# Last available Nextcloud version +next_version="20.0.7" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="fc503985e8aa4ed795d882e35679e0e1b7670181768e7820307222d8b4658969" +nextcloud_source_sha256="8ced82b772bf0af67d5be1323e40f977429bc0a2bcc864095efc78767500b72b"