How to backup/restore Yunohost in full?

Hello everybody,
I am setuping a new Yunohost installation and I want to design a backup procedure for it.

Which folders and files should I backup in order to be able to restore my Yunohost in full after a reinstall please?
Also in the Backup section of the admin web interface it says it hasn’t been implement yet, but I saw this was made in 2.2 ?

Thanks

i’ll say;
if you backup /etc, /home, /var/www, /usr/share/yunohost and you dump your mysql you’ll pretty safe

  • /etc for your server config and ./yunohost config
  • /home for your user datas, yunohost.app and your vmail
  • /usr/share/yunohost
  • /var/www for the obvious web

did I forget something ?

but if you mean full, like you stop or reboot in recovery mode your server, do a DD over SSH

Thanks, good advice. I have to learn about rsync now then :blush:

duplicati or rsnapshot might be better than just a rsync because they will help you to manage versionning and rotation

Duplicity is pretty good since it supports encryption and has a ton of backends, like WebDAV, Google Drive, Dropbox and Amazon S3. You can encrypt everything on your server (it’s just gnupg under the hood) and then upload to a cloud storage of your choice.

It’s pretty hard to set up properly, though. And beware of old versions, they’ve changed their command line syntax recently.

How to backup mails ?
I’ve got 2 yunohost servers and want to use each one to backup the other one using duplicity.

I’m on a debian, no conflicts installing duplicity with Yunohost ?

Is /var/mail the only directory to backup ?
I could just copy /var/mail files to a fresh new Yunohost instance and have all my mails (after creating same domain and same users) ?

Now i’m using larch on my PC but want to automate this task.

Hi :slight_smile: I am trying to find a solution to make a copy of my YunoHost server on a 4TB HDD, but everytime when I try to execute rsync, there is nothing on the HDD that has been copied! Could someone please tell me how he did it?

Hi
Did you check the logs ? What does the CLI displays ?

I have copied my server files soon using the following command:
sudo rsync -avH sourceFolder destinationfolder
(you can remove the ‘v’ (from ‘-avH’ options) if you don’t want a verbose feedback)

I ran that command with the server hard drive mounted (physically!) on another computer. Else, (if you want to run that command directly on your server) you must mount the folder to be copied in read only.

I set up backup today with duplicity.
The goal was, to backup to an ftp server in the internet i have access to.

Here is what i did:

  • apt-get install duplicity ncftp
  • create backup script “doBackup.sh”, content see below, chmod 700 doBackup.sh
  • mkdir /var/log/duplicity
  • add a crontab entry: “0 3 * * * /root/scripts/doBackup.sh” to backup daily at 3 am

thats it.

What i didn’t to up to now is, stop servers to have no open files, and really think about the directories to backup. should include mysql somehow, maybe dump locally to /root and have it backed up from there.

–Pangu

------ doBackup.sh ------------

#!/bin/sh
export PASSPHRASE=<Passphrase-to-encrypt-backup>
export FTP_PASSWORD=<password for FTP-Server>

export BCKHOST=<FQDN of FTP server>
export BCKUSER=<FTP Username>
export BCKROOT=<directory where to put the backups>

export BCKDIRS="/root /etc /home /var/mail"    # list of dirs to backup

for i in $BCKDIRS; do
        BCKNAME=\`echo $i | sed -e "s/\//+/g"\`
	echo "******** " Backing up: $i " ** " \`date\` " *********" >> /var/log/duplicity/$BCKNAME.log
	duplicity $i ftp://$BCKUSER@$BCKHOST$BCKROOT$i >> /var/log/duplicity/$BCKNAME.log
	duplicity verify  ftp://$BCKUSER@$BCKHOST$BCKROOT$i $i >> /var/log/duplicity/$BCKNAME.log
done

unset PASSPHRASE
unset FTP_PASSWORD

---- end of doBackup.sh -----------

1 Like

Hi Yunorasp :wink:
Your idea is similar to mine. Did you find a solution yet?
Cheers, Tiger

Nope, I save my emails sometimes with larch YunoHost • index

To backuping Mail, base on that tuto : https://www.howtoforge.com/tutorial/installing-a-web-email-and-mysql-database-cluster-on-debian-8.4-with-ispconfig-3/

rsync or unison such as in the tuto of /var/vmail is the good way to do it
but you also need to sync of your dovecot mysql.

if you follow the tuto you could skip the page 3 it’s specific to ISPConfig.

You’re DNS configuration must look like
NAME TYPE TTL PRIORITY DATA
main.yunohost.me MX 86400 10 server1.chez.vous
backup.yunohost.me MX 86400 20 server2.chez.vous

so your second yunohost with a bigger priority.

I Hope i’m clear and that will help you !