Migration Owncloud Nextcloud

J’ai suivi à la lettre la migration , ça marche très bien :slight_smile: .

Bon, un seul truc : le répertoire reste example.org/owncloud :wink:

1 Like

Je viens aussi de migrer et la procédure fonctionne parfaitement (avec une mise à jour de owncloud 8 vers nextcloud 11).

Une idée de comment changer l’URL ? (owncloud --> nextcloud)
Merci !

Juste pour signifier que la procédure de migration fonctionne toujours au poil, je viens de migrer, avec l’environnement suivant :

  • Owncloud 9.x
  • YunoHost 2.5.6

… Et j’ai maintenant un nextcloud 11 tout beau :slight_smile: Merci à @tostaki

@aoz Je pense qu’il doit être possible de gérer ça via GitHub - YunoHost-Apps/redirect_ynh: Redirection app for YunoHost

Perso, je ne m’y risque pas pour ce petit changement cosmétique, autant la redirection ne posera pas de souci aux navigateurs, autant j’ai un doute sur les apps clientes de calendrier (davdroid, evolution, california…)

Je viens aussi de migrer et la procédure fonctionne parfaitement (avec une mise à jour de owncloud 8 vers nextcloud 11).

Salut @aoz,

Je suis en train de tenter la même mise à jour, de mon owncloud 8.2.0 vers nextcloud 11.

Je bloque dès les mises à jour d’owncloud, qui foirent malgré différentes tentatives.

Je voulais donc savoir quelle procédure as-tu suivi pour mettre à jour ton owncloud ? Mise à jour manuelle avec les archives d’owncloud ? Mise à jour avec les paquets Yunohost ? Un mix des deux ?

Merci d’avance :slight_smile:

Salut @SiM,

J’ai utilisé la procédure expliquée là (il faut lire le paragraphe “Migrate from ownCloud”) :

Salut @aoz merci pour ta réponse.

Je parlais surtout de la mise à jour d’owncloud depuis la version 8, car pour passer à NextCloud il faut avoir Owncloud à jour (version) 9.0.5 si j’ai bien suivi.

Je ne me souviens pas de cette contrainte. Peut être étais-je déjà en v9 lorsque j’ai migré sur Nextcloud.

Salut à tou-te-s,

Enfin je me suis lancé dans cette migration :slight_smile: à l’aide de GitHub - YunoHost-Apps/nextcloud_ynh: Nextcloud package for YunoHost

root@:mamachine:~$ yunohost app upgrade -u GitHub - YunoHost-Apps/nextcloud_ynh: Nextcloud package for YunoHost owncloud --verbose

  1. J’ai rencontré un premier souci : un dossier /home/yunohost.app/nextcloud existait déjà. J’avais installé Nextcloud en parallèle de Owncloud il y a quelques mois puis désinstallé : il semble que la suppression de l’app Nextcloud via l’interface d’admin graphique n’avait pas supprimé le dossier. Du coup je l’ai renommé :

mv /home/yunohost.app/nextcloud /home/yunohost.app/nextcloud_backup

  1. Ensuite le script déroule bien, jusqu’à une erreur lors de l’application des patchs. On dirait qu’il ne trouve pas un fichier (log complet à partir de l’endroit où ça semble bugger en fin de post)…

Quelques infos supplémentaires :

  • si je fais un yunohost app list le retour m’indique que Nextcloud est installé (id: nextcloud / installed: True). Pourtant on dirait que Owncloud marche toujours et Nextcloud n’est pas dispo dans la liste des mes app.
  • dans /var/log/php5-fpm.log j’ai des infos à l’heure où ça a buggé
[07-Apr-2018 11:47:06] WARNING: [pool nextcloud] child 12365 said into stderr: "NOTICE: PHP message: PHP Warning:  fopen(/var/www/nextcloud/config/config.php): failed to open stream: Permission denied in /var/www/nextcloud/lib/private/config.php on line 187"
[07-Apr-2018 11:47:06] WARNING: [pool nextcloud] child 12365 said into stderr: "NOTICE: PHP message: PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /var/www/nextcloud/lib/private/config.php on line 197"
[07-Apr-2018 11:47:06] WARNING: [pool nextcloud] child 12365 said into stderr: "NOTICE: PHP message: PHP Fatal error:  Call to a member function getRequest() on null in /var/www/nextcloud/lib/private/response.php on line 77"
  • sur GitHub - YunoHost-Apps/nextcloud_ynh: Nextcloud package for YunoHost il était question d’un cron, je sais pas si c’est celui là mais je redirigé la sortie de /etc/cron.d/owncloud vers un fichier de log et je récupère Could not open input file: /var/www/owncloud/cron.php ce qui s’explique vu qu’il n’y a qu’un dossier nextcloud dans /var/www
  • j’héberge Yunohost chez un hébergeur professionnel, j’ai fait un snapshot juste avant de démarrer et je peux le restaurer au besoin pour revenir à l’état initial.

Si quelqu’un a une petite piste … J’ai un autre Owncloud à migrer sur une autre instance Ynh pour une asso derrière. Merci d’avance !
Lops

+ wget -nv -O app.tar.bz2 https://download.nextcloud.com/server/releases/nextcloud-10.0.2.tar.bz2
Warning: 2018-04-07 11:47:40 URL:https://download.nextcloud.com/server/releases/nextcloud-10.0.2.tar.bz2 [34843051/34843051] -> "app.tar.bz2" [1]
+ sha256sum -c --status
+ echo 'a687a818778413484f06bb23b4e98589c73729fe2aa9feb1bf5584e3bd37103c app.tar.bz2'
+ mkdir -p /tmp/tmp.AXgNS0eqqA
+ '[' tar.bz2 = zip ']'
+ local strip=
+ true
+ strip='--strip-components 1'
+ [[ tar.bz2 =~ ^tar.gz|tar.bz2|tar.xz$ ]]
+ tar -xf app.tar.bz2 -C /tmp/tmp.AXgNS0eqqA --strip-components 1
++ wc -l
++ find /var/cache/yunohost/from_file/nextcloud_ynh-master/scripts/../sources/patches/ -type f -name 'app-*.patch'
+ ((  2 > 0  ))
++ pwd
+ local old_dir=/var/cache/yunohost/from_file/nextcloud_ynh-master/scripts
+ cd /tmp/tmp.AXgNS0eqqA
+ for p in '$YNH_CWD/../sources/patches/${src_id}-*.patch'
+ patch -p1
patching file core/Controller/LoginController.php
+ for p in '$YNH_CWD/../sources/patches/${src_id}-*.patch'
+ patch -p1
(Stripping trailing CRs from patch; use --binary to disable.)
can''t find file to patch at input line 9
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
| lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php | 4 ++++
| lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php    | 3 ++-
| 2 files changed, 6 insertions(+), 1 deletion(-)
|
|diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
|index 85ae127f5f..91618a09fc 100644
|--- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
|+++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
1 out of 1 hunk ignored
(Stripping trailing CRs from patch; use --binary to disable.)
patching file lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php
Hunk #1 succeeded at 353 (offset -24 lines).
Warning: Unable to apply patches
Warning: !!
Warning:   nextcloud''s script has encountered an error. Its execution was cancelled.
Warning: !!
+ ynh_die 'Unable to apply patches'
+ echo 'Unable to apply patches'
Warning: 
+ exit 1
+ ynh_exit_properly
+ local exit_code=1
+ '[' 1 -eq 0 ']'
+ trap '' EXIT
+ set +eu
+ echo -e '!!\n  nextcloud'\''s script has encountered an error. Its execution was cancelled.\n!!
+ type -t ynh_clean_setup
+ ynh_die
+ echo ''
+ exit 1

Bon ça ressemble pas mal à ce souci [RESOLU] Update owncloud vers nextcloud echoue : le problème arrive au moment de mettre à jour Nextcloud, l’install est déjà terminée. Mais ce n’est pas résolu pour autant :slight_smile: je creuse

Ton problème ressemble à un problème qui a été corrigé en testing (voir ici)… As-tu les moyens d’essayer l’upgrade en testing ?

Ah super merci @JimboJoe !
Après avoir restauré le snapshot pour revenir à l’état initial d’avant la tentative échouée de migration, j’ai relancé la migration avec l’URL de la branche testing :

root@:mamachine:~$ yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh/**tree/testing** owncloud --verbose

Et là ça déroule jusqu’au bout ! Je finis sur Nextcloud 13.0.1. J’ai juste une erreur à la fin du script bien que j’ai l’impression que tout se soit bien passé

>     Warning: 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.
>     + echo '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.'
>     + script_post_migration=owncloud_post_migration.sh
>     + ynh_replace_string __OLD_APP__ owncloud ../conf/owncloud_post_migration.sh
>     + local delimit=@
>     + local match_string=__OLD_APP__
>     + local replace_string=owncloud
>     + local workfile=../conf/owncloud_post_migration.sh
>     + match_string=__OLD_APP__
>     + replace_string=owncloud
>     + sudo sed --in-place s@__OLD_APP__@owncloud@g ../conf/owncloud_post_migration.sh
>     + ynh_replace_string __NEW_APP__ nextcloud ../conf/owncloud_post_migration.sh
>     + local delimit=@
>     + local match_string=__NEW_APP__
>     + local replace_string=nextcloud
>     + local workfile=../conf/owncloud_post_migration.sh
>     + match_string=__NEW_APP__
>     + replace_string=nextcloud
>     + sudo sed --in-place s@__NEW_APP__@nextcloud@g ../conf/owncloud_post_migration.sh
>     + cp ../conf/owncloud_post_migration.sh /tmp
>     + chmod +x /tmp/owncloud_post_migration.sh
>     + cd /tmp
>     + at now + 2 minutes
>     + echo '/tmp/owncloud_post_migration.sh > /tmp/owncloud_post_migration.sh.log 2>&1'
>     Warning: ./upgrade: line 377: at: command not found
>     + ynh_exit_properly
>     + local exit_code=1
>     + '[' 1 -eq 0 ']'
>     + trap '' EXIT
>     + set +eu
>     + echo -e '!!\n  nextcloud'\''s script has encountered an error. Its execution was cancelled.\n!!'
>     + type -t ynh_clean_setup
>     Warning: !!
>     + ynh_die
>     Warning:   nextcloud's script has encountered an error. Its execution was cancelled.
>     Warning: !!
>     + echo ''
>     Warning: 
>     + exit 1
>     Error: Unable to upgrade owncloud
>     Error: No app to upgrade

Le script /tmp/owncloud_post_migration.sh existe bien mais je ne suis pas sûr qu’il se soit correctement executé : il y a une commande ynh_secure_remove "/etc/yunohost/apps/$old_app" alors que /etc/yunohost/apps/owncloud/ existe toujours.

En tout cas l’URL https://domain.tld/owncloud redirige bien vers Nextcloud, il y a bien tous les utilisateurs, les droits sur les dossiers etc. Et le client Owncloud fonctionne toujours, j’ai eu une Notification de la part de Nextcloud (du genre “voulez-vous partager vos rapports de bug avec l’équipe Nextcloud ?”). Génial :smiley:

Donc il reste quelques questions :

  • la migration s’est elle vraiment complètement terminée ?
  • cela vous paraît OK d’un point de vue stabilité d’avoir fait la migration depuis la branche de testing ? A priori lors des futurs upgrade de l’application, mon instance de Yunohost utilisera bien la branche master ? A priori la seule différence notable c’est d’être passé à la version majeur 13 de Nextcloud, sinon les différences semblent minimes Comparing master...testing · YunoHost-Apps/nextcloud_ynh · GitHub

Merci pour l’aide, pour ce script de migration et puis pour Yunohost en général :smiley: !
Lops

Curieusement, il te manque le paquet at ; tu peux l’installer avec apt-get install at.
Ensuite, at était utilisé pour lancer le script dont tu parles (/tmp/owncloud_post_migration.sh) 2 minutes plus tard (cf ceci).
Donc, tu peux le lancer à la main directement pour finaliser la migration.

Ah je n’avais pas pensé que at était un paquet, ça y est c’est finalisé, merci pour l’aide @JimboJoe !
Si jamais quelqu’un a une idée à propos de l’autre question … :

  • cela vous paraît OK d’un point de vue stabilité d’avoir fait la migration depuis la branche de testing ? A priori lors des futurs upgrade de l’application, mon instance de Yunohost utilisera bien la branche master ? A priori la seule différence notable c’est d’être passé à la version majeur 13 de Nextcloud, sinon les différences semblent minimes https://github.com/YunoHost-Apps/nextcloud_ynh/compare/testing

Re-salut,

NextCloud tourne bien depuis la migration depuis Owncloud il y a 3 semaines, merci :slight_smile: je viens de tenter ma première mise à jour (bien qu’il n’y ait pas eu de nouvelle version depuis, juste pour voir si tout se passe bien) mais tout ne se passe pas comme prévu :

  1. il semble que NextCloud fasse toujours référence à un package ‘owncloud-deps’ que le processus d’upgrade n’arrive pas à trouver. Il y a un problème similaire sur ce post
    [Nextcloud] Echec de la mise à jour expliqué par @Siklaris et résolu avec l’aide de @JimboJoe. J’ai essayé sans succès d’appliquer la solution avec “equivs-control nextcloud-deps” (le message d’erreur reste le même)

root@ma-machine:/tmp# yunohost tools upgrade
Warning: Upgrading app jirafeau…
Warning: Upgrading app nextcloud…
Warning: dpkg-query: package ‘owncloud-deps’ is not installed and no information is available
Warning: Use dpkg --info (= dpkg-deb --info) to examine archive files,
Warning: and dpkg --contents (= dpkg-deb --contents) to list their contents.
Warning: Unable to back up the app ‘nextcloud’
Warning: There is nothing to save
Warning: Backup failed, the upgrade process was aborted.
Error: Unable to upgrade nextcloud
Warning: Upgrading app opensondage…
Warning: Upgrading app owncloud…
Warning: You must provide a URL to upgrade your custom app owncloud
Warning: Upgrading app wallabag2…
Warning: Upgrading app zerobin…
Warning: unable to upgrade apps: [Errno 61] No app to upgrade

  1. l’application OwnCloud est toujours installée avec la même URL d’accès (/owncloud) qui est également celle par défaut de NextCloud lorsque le script de migration est appliqué. Je voudrais supprimer l’app OwnCloud mais est-ce que je risque de casser quelque chose ?

Pour rappel j’avais eu quelque soucis ci-dessus lors de la migration et avait finalement fait l’upgrade depuis la branche testing. Je me demande si c’est au niveau du script de post-migration qu’il y a eu souçi. Et ne n’arrive plus à retrouver ce “owncloud_post_migration.sh” dans le dépôt Github.

Merci d’avance pour votre aide !

The owncloud_post_migration.sh script is located here.
In your case, it seems like the current nextcloud backup script isn’t up-to-date and wants to deal with the dep package.
Could you please dump the backup script somewhere (it’s location here: /etc/yunohost/apps/nextcloud/scripts/backup) in order for us to look at it? Is there any occurrence of dpkg in it?

Thank you for your answer. It seems that there is an occurence of dpkg and owncloud at the last line :

root@ma-machine:/tmp# cat /etc/yunohost/apps/nextcloud/scripts/backup
#!/bin/bash

set -eu

# Get multi-instances specific variables
app=$YNH_APP_INSTANCE_NAME

# Set app specific variables
dbname=$app
dbuser=$app

# Source app helpers
. /usr/share/yunohost/helpers

# Retrieve app settings
domain=$(ynh_app_setting_get "$app" domain)
path=$(ynh_app_setting_get "$app" path)
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)

# Copy the app source files
DESTDIR="/var/www/$app"
ynh_backup "$DESTDIR" "www"

# Copy the data directory
DATADIR="/home/yunohost.app/${app}/data"
ynh_backup "$DATADIR" "data" 1

# Copy the conf files
mkdir ./conf
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf"
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf"
ynh_backup "/etc/cron.d/${app}" "conf/cron"

# Dump the database
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./db.sql

# Copy the control file of the dependency package
# FIXME: find a way to retrieve package name from _common.sh?
dpkg-query -s owncloud-deps > ./owncloud-deps.control

Do you think I should re-execute the post_migration script ? I’m not sure anymore that I’ve given the old_app and new_app arguments when I run manually this script last time …

What it shows is that your app scripts (in /etc/yunohost/apps/nextcloud) are the old ones…
And re-launching the migration script will only clean the old ones (normally in /etc/yunohost/apps/owncloud) and remove the old owncloud application… but that may be a good start.

Nice ! It’s done :slight_smile: thank you @JimboJoe.
I just got some warnings during upgrade, don’t know if it’s a real problem …

  1. Execute manually the owncloud_post_migration.sh script : just execute each command line replacing old_app and new_app respectively by owncloud and nextcloud (don’t know why but the hooks were already moved)
  2. Get the new scripts in /etc/yunohost/apps/nextcloud/scripts/

cd /etc/yunohost/apps/nextcloud/
cp -R scripts/ old_scripts
rm -rf scripts/* && cd scripts
git clone GitHub - YunoHost-Apps/nextcloud_ynh: Nextcloud package for YunoHost
mv nextcloud_ynh/scripts/* ./
rm -Rf nextcloud_ynh/

  1. Upgrade with yunohost tools upgrade

Warning: Upgrading app jirafeau…
Warning: Upgrading app nextcloud…
Warning: Data dir will not be saved, because backup_core_only is set.
Warning: dpkg-gencontrol: warning: File::FcntlLock not available; using flock which is not NFS-safe
Warning: Note that if you’ve installed some third-parties Nextcloud applications, they are probably disabled and you’ll have to manually enable them again.
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
> Success! nextcloud has been upgraded
Warning: Upgrading app opensondage…
Warning: Upgrading app wallabag2…
Warning: Upgrading app zerobin…
Success! The SSOwat configuration has been generated
Success! Upgrade complete
Success! The system has been upgraded

1 Like

Salut,

Ayant eu à refaire une migration sur une autre instance de Yunohost hébergée chez Gandi, et ayant rencontré les mêmes problèmes, voilà finalement les grandes étapes ci-dessous, ça sera peut être utile à quelqu’un d’autre. Et merci pour ce fix sur le script de migration Upgrade from an old version fails because the patches can’t be applicated :slight_smile:

apt-get update && apt-get dist-upgrade
yunohost tools upgrade

  • prévoir le bug [1] en supprimant la ligne “memcache.locking”: “\OC\Memcache\APC” de /var/www/owncloud/config/config.php
  • s’assurer que le paquet at est bien installé

at-get install at

  • lancer la migration (à la fin attendre 5min que la tâche cron en arrière plan tourne)

yunohost app upgrade -u GitHub - YunoHost-Apps/nextcloud_ynh: Nextcloud package for YunoHost owncloud --verbose

  • tenter une mise à jour des applications pour s’assurer que tout va bien (si le bug décrit ici [2] apparait, regarder le point n°2 de ce post [3])

yunohost tools upgrade

[1] Upgrade to Nextcloud 12.0 fails: "PHP Fatal error: Class '\OC\Memcache\APC' not found in /var/www/nextcloud/lib/private/Memcache/Factory.php on line 116" · Issue #50 · YunoHost-Apps/nextcloud_ynh · GitHub
[2] Migration Owncloud Nextcloud - #21 by lops
[3] Migration Owncloud Nextcloud - #25 by lops