Le blog de Genma
Vous êtes ici : Accueil » Nextcloud » Yunohost et plusieurs instances de Nextcloud (2/N)

Yunohost et plusieurs instances de Nextcloud (2/N)

D 13 janvier 2020     H 09:00     A Genma     C 0 messages   Logo Tipee

TAGS : Nextcloud Planet Libre Yunohost

Cet article fait suite à mon article Yunohost et plusieurs instances de Nextcloud (1/N).

Dans cet article, je présenterai des problématiques rencontrées suite à ce mode multi-instance.

Nettoyage suite montée en version

Il faut nettoyer le dossier /home/yunohost.app/nextcloud/data/updater-ocfwd41fh2cx/backups/nextcloud-15.0.12.1

Conséquence de la changement de version de PHP

Pour l’installation de Nextcloud 17 (montée en version de Nextcloud 15, installé en tant qu’application Yunohost) et en suivant le tutoriel de mon premier billet Yunohost et plusieurs instances de Nextcloud (1/N), j’ai installé PHP 7.3 et (finalement) migré TOUS les instances Nextcloud sur PHP 7.3 (gain de performance, à valider, pour les instances 15).

Par conséquences, les fichiers /etc/php/7.0/fpm/pool.d/nextcloud.conf n’existent plus, cela casse la sauvegarde de Nextcloud via Yunohost. Il faut faire les sauvegardes à la main (via Borg par exemple). Cela sera le sujet d’un article futur.

Listing d’une sauvegarde de l’application Nextcloud via Yunohost et des erreurs rencontrées :

# yunohost backup create --apps nextcloud
Info: Collecting files to be backuped for nextcloud…
Info: [++..................] > Loading installation settings...
Info: [##++................] > Backing up the main app directory...
Info: [####++..............] > Backing up nginx web server configuration...
Info: [######++............] > Backing up php-fpm configuration...
Warning: [WARN] Source path '/etc/php/7.0/fpm/pool.d/nextcloud.conf' does not exist
Warning: [ERR] !!
Warning:   nextcloud's script has encountered an error. Its execution was cancelled.
Warning: !!
Warning: Please find here an extract of the log before the crash:
Warning: [DEBUG]: DEBUG   - ++ ynh_app_setting get nextcloud do_not_backup_data
Warning: [DEBUG]: INFO    - > Backing up php-fpm configuration...
Warning: [DEBUG]: DEBUG   - ++ ACTION=get
Warning: [DEBUG]: DEBUG   - ++ APP=nextcloud
Warning: [DEBUG]: DEBUG   - ++ KEY=do_not_backup_data
Warning: [DEBUG]: DEBUG   - ++ VALUE=
Warning: [DEBUG]: DEBUG   - ++ python -
Warning: [DEBUG]: DEBUG   - + do_not_backup_data=
Warning: [DEBUG]: WARNING - Source path '/etc/php/7.0/fpm/pool.d/nextcloud.conf' does not exist
Warning: [DEBUG]: DEBUG   -'
Warning: [DEBUG]: DEBUG   -
Warning: [DEBUG]: DEBUG   - + ynh_print_warn '--message=Source path '\''/etc/php/7.0/fpm/pool.d/nextcloud.conf'\'' does not exist'
Warning: [DEBUG]: DEBUG   - + local legacy_args=m
Warning: [DEBUG]: DEBUG   -=message=)
Warning: [DEBUG]: DEBUG   - + declare -Ar args_array
Warning: [DEBUG]: DEBUG   - + local message
Warning: [DEBUG]: DEBUG   - + ynh_handle_getopts_args '--message=Source path '\''/etc/php/7.0/fpm/pool.d/nextcloud.conf'\'' does not exist'
Warning: [DEBUG]: DEBUG   - + set +x
Warning: [DEBUG]: DEBUG   - Source path '\'''\'' does not exist'
Warning: [DEBUG]: DEBUG   - Source path '\''/etc/php/7.0/fpm/pool.d/nextcloud.conf'\'' does not exist'
Warning: [DEBUG]: DEBUG   -'
Warning: [DEBUG]: DEBUG   - + grep --quiet /etc/fail2ban
Warning: [DEBUG]: DEBUG   - + echo /etc/php/7.0/fpm/pool.d/nextcloud.conf
Warning: [DEBUG]: DEBUG   - + return 1
Warning: [DEBUG]: DEBUG   - + ynh_exit_properly
Warning: 
Error: Unable to back up the app 'nextcloud'
Error: There is nothing to save

Ne pas faire les mises à jour de Nextcloud via Yunohost

Pour les différentes applications Nextcloud installées, dans sa partie administration, Yunohost continue de proposer de faire les mises à jour. En effet, Yunohost conserve la version de l’application installée et quand l’application packagée dispose d’une mise à jour, il la propose.

Suite aux modifications manuelles faites sur les instances Nextcloud, on perd la compatibilité avec Yunohost. Il ne faut donc plus faire les mises à jour de Nextcloud via Yunohost, mais via l’application Nextcloud en elle-même.

Il va falloir que je creuse ce point, sans casser Yunohost, pour enlever ces notification. A suivre.

DAVx⁵ ne synchronise pas sur la bonne instance malgré la saisie de la bonne URL

Sur un même serveur, j’ai donc différentes instances Nextcloud. Comme cela le sera expliqué dans un article futur, il est possible de se connecter avec les applications comme DAVx⁵ (ex DavDroid) à plusieurs instances Nextcloud pour synchoniser Contacts, Agenda...

DAVx⁵ ne synchronise pas sur la bonne instance malgré le bon compte et la saisie de la bonne URL du serveur.

Je mets ici le résultat de mon analyse :

Dans la configuration de l’instance Nextcloud sur laquelle je souhaite me connecter, dans la configuration Nginx, dans le fichier /etc/nginx/conf.d/nextproduction.mondomaine.org.d/nextcloud__3.conf il manque les lignes

location = /.well-known/carddav {
  return 301 https://$server_name/remote.php/dav;
}
location = /.well-known/caldav {
  return 301 https://$server_name/remote.php/dav;
}

Cela est lié à cette règle dans le script d’installation du package Nextcloud pour Yunhost :

# Check if .well-known is available for this domain
if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.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

Si l’on n’y prend pas garde, lors de l’installation d’une seconde application Nextcloud sur une même instance Yunohost, on a donc ce message qui dit 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.

Mon conseil est pour ne pas rencontrer de soucis, si l’on souhaite utiliser les fonctionnalités d’Agenda / Contact des différentes instances (pour des synchronisations sur son smartphone), d’installer chaque instance Nextcloud sur plusieurs sous-domaines et non sur un même domaine (dans des sous-répertoires).

Il est possible de bouger / migrer une application NextCloud déjà installé d’un domaine à un sous-domaine, par exemple d’une url ondomaine.org/2èmenextcloud/ vers 2èmenextcloud.mondomaine.org mais les fichiers de configuration ne sont pas tous modifiés et il faudra donc faire la correction des fichier Nginx à la main.