EDIT from ljf: Since this tuto a lot of apps have received a backup/restore script, so you can simply use the yunohost backup create
and yunohost backup restore
feature
I (almost) accidentatly ruined my YNH server yesterday by trying an upgrade from Wheezy to Jessie. (don’t do that)
It was a dedicated server hosted by ovh, and it was so messy that at the end i couldn’t even connect through ssh … my only access was by rebooting in rescu mode, so i had access to my files but YNH was not running anymore, snif.
So i started what i should have done from the beginning : migrating my server (and all his data : 10 users, arround 10 apps) to an other server (with Jessie on it).
Here is all the details of what to do in such a case.
backups
Fortunatly i had a fresh backup of two important things :
- the ldap base (thanks to josue see Debian 8.0 Jessie compatibility)
- and a dump of each mysql dbs.
Every YNH maintainers should have this tow things backuped.
every thing is ran as root, you may need to add sudo in front of commands
install YNH
Install Yunohost as usual on your new server
https://yunohost.org/#/install_manually_fr
post install
run the yunohost configuration as usual with the very same domain.tld as your previous server but do not create the users
https://yunohost.org/#/postinstall_fr
certificats migration
on your new server, backup your certificats
$ mv /etc/yunohost/certs/yourdomain.tld /root/yourdomain.tdl.back
get back your certs, run from your old server
$ rsync -av /etc/yunohost/certs/yourdomain.tld root@yo.ur.new.ip:/etc/yunohost/certs/
again on your new server
$ service nginx reload
see https://yunohost.org/#/certificate_fr
get back your users
fortunatly i previously made an ldap backup
see this post : Debian 8.0 Jessie compatibility
so i could restore it
# backup
$ slapcat -v -l /chemin_vers_ma_sauvegarde/nom_de_ma_sauvegarde.ldif
# restore
$ service slapd stop
$ mv /var/lib/ldap /var/lib/ldap.old
$ mkdir /var/lib/ldap
$ chown openldap:openldap /var/lib/ldap
$ chmod go-rwx /var/lib/ldap
$ slapadd -v -l /chemin_vers_ma_sauvegarde/nom_de_ma_sauvegarde.ldif
$ chown openldap:openldap /var/lib/ldap/data.mdb
$ chown openldap:openldap /var/lib/ldap/lock.mdb
$ service slapd start
migrate your emails
if the old mail server is still running
https://yunohost.org/#/email_migration_fr
if not (like mine)
from the old server
$ rsync -av /var/mail/ root@yo.ur.new.ip:/var/mail/
be carrefull with trailing slashes (see man rsync)
Apps
roundcube
from the new server
install the app from ynh admin
then import de bdd
$ mysqldump -u root -p roundcube > roundcube.sql
$ mysql -u root -p
mysql> drop database roundcube;
mysql> create database roundcube;
mysql> exit
$ mysql -u root -p roundcube < roundcube-old.sql
baikal
from the new server
install the app from ynh admin
then import de bdd
$ mysqldump -u root -p baikal > baikal.sql
$ mysql -u root -p
mysql> drop database baikal;
mysql> create database baikal;
mysql> exit
$ mysql -u root -p baikal < baikal-old.sql
agendav
from the new server
install the app from ynh admin
then import de bdd
$ mysqldump -u root -p agendav > agendav.sql
$ mysql -u root -p
mysql> drop database agendav;
mysql> create database agendav;
mysql> exit
$ mysql -u root -p agendav < agendav-old.sql
ttrss
from the new server
install the app from ynh admin
then import de bdd
$ mysqldump -u root -p ttrss > ttrss.sql
$ mysql -u root -p
mysql> drop database ttrss;
mysql> create database ttrss;
mysql> exit
$ mysql -u root -p ttrss < ttrss-old.sql
then get back your favorites themes
from the old server
$ rsync -av /var/www/ttrss/themes/ root@yo.ur.new.ip:/var/www/ttrss/themes/
jirafeau
from the new server
install the app from ynh admin
then from the old server rsync the uploaded files
$ rsync -av /home/yunohost.app/firafeau/ root@yo.ur.new.ip:/home/yunohost.app/jirafeau/
opensondage
from the new server
install the app from ynh admin
then import de bdd
$ mysqldump -u root -p opensondage > opensondage.sql
$ mysql -u root -p
mysql> drop database opensondage;
mysql> create database opensondage;
mysql> exit
$ mysql -u root -p opensondage < opensondage-old.sql
etherpadlite
from the new server
install the app from ynh admin
then import de bdd
$ mysqldump -u root -p etherpadlite > etherpadlite.sql
$ mysql -u root -p
mysql> drop database etherpadlite;
mysql> create database etherpadlite;
mysql> exit
$ mysql -u root -p etherpadlite < etherpadlite-old.sql
owncloud
from the new server
install the app from ynh admin
then from the old server rsync each user OC folder
# be carefull with trailing slashes (see man rsync)
$ rsync -a /home/yunohost.app/owncloud/data/$USER root@yo.ur.new.ip:/home/yunohost.app/owncloud/data/
then
$ chown -R owncloud:owncloud /home/yunohost.app/owncloud/data/$USER
and finally re-import your old db
$ mysqldump -u root -p owncloud > owncloud.sql
$ mysql -u root -p
mysql> drop database owncloud;
mysql> create database owncloud;
mysql> exit
$ mysql -u root -p owncloud < owncloud-old.sql
jappix
from the new server
install the app from ynh admin
then backup this metronome folder
$ mv /var/lib/metronome /var/lib/metronome.old
then from the old server
$ rsync -a var/lib/metronome root@94.23.13.169:/var/lib/
again from the new server
$ chown -R metronome:metronome /var/lib/metronome
$ service metronome reload