Migrating nethsever between cloud vps servers


(Nitram Oneito) #1

NethServer Version: Current Version
Module: Mail, webtop/sogo, Nextcloud, onlyoffice, Ldap

Hello everyone,

I have a nethserver setup on a public cloud vps, it hosts LDAP, mail, Nextcloud with onlyoffice and some of the security features like rspamd, fail2ban activated.

I am wondering if there is a safe way to move the installation with the data to another cloud provider retaining the settings, as well as the data on nethserver.
Especially for Emails, as for nextcloud we could just re-upload some of the files.


(Dan) #2

Hotsync is probably the best way, but I think you’d need to manually reconfigure the network at the CLI.


(Nitram Oneito) #3

I am looking at the tutorial for hotsync, but I do not see how to connect two servers. Like , where is the setting or option that will know where the ip address of the salve server lives in.

or is there something that I am not following clearly.
http://docs.nethserver.org/en/v7/hotsync.html


(Dan) #4

There must be, because the documentation page you linked to describes it pretty clearly. On the master machine, config setprop hotsync SlaveHost <SLAVE_IP>.


(Nitram Oneito) #5

another question before I embark on this journey this night.

Do I need to install all the modules on the slave server or will the move install the softwares and configure them.


(Filippo Carletti) #6

A cron job installs all modules during the night. You will find all modules installed the day after the first sync. Installation can be forced with /usr/sbin/hotsync-slave


(Nitram Oneito) #7

where is this run. from the master or from the slave


(Nitram Oneito) #8

I ran this on master

[root@my ~]# hotsync
===== Report for configuration backup =====

Backup started at 2018-09-08 19:14:55
Event pre-backup-config: SUCCESS
Action backup-config-execute: SUCCESS
Event post-backup-config: SUCCESS
Backup status: SUCCESS
Backup ended at 2018-09-08 19:14:56
Time elapsed: 0 hours, 0 minutes, 1 seconds
hotsync error: rsync returned 12. rsync output:
rsync: safe_read failed to read 1 bytes [sender]: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(276) [sender=3.1.2]

is there something wrong


(Markus Neuberger) #9

An alternative to hotsync would be the backup/restore process like backup the old server and restore to the new one.
You should have console access to your VPS because hotsync and backup/restore may change the IP address of the new server to the old one.

Can the master reach the slave on rsync port 873?
Please recheck your configuration (master/slave - role/IP/password).

You need to do hotsync on the master and hotsync-slave on the slave. To promote the slave do hotsync-promote on the slave.

Devel docs:

http://docs.nethserver.org/projects/nethserver-devel/en/v7/nethserver-hotsync.html


(Nitram Oneito) #10

I installed nethserver on a new vps,

then installed hotsync on both the master and the slave, and did the relevant configurations of the ip as per the documentation.

the challenge was every time I tried to force the sync, it would not happen.

what could I have missed.

and could anyone assist on how to enable the relevant ports on the servers so as to make sure I am able to move the servers well enough.


(Nitram Oneito) #11

anyone?


(Ralf Jeckel) #12

Did you follow this guide, that Markus posted?
I tried it some time ago and had some issues with it. I had to remove all unsupported modules and all customizations on my machine to get it working.
But after that, every thing worked fine.


(Markus Neuberger) #13

It seems like hotsync is intended for internal use. The service stunnel opens port 273 to green on slave by default.
You may enable access in “Network services” in web UI or on command line but it’s not intended and signal-event nethserver-hotsync-update will reset it. VPN may be another solution.

config setprop stunnel access green,red
signal-event firewall-adjust

At slave promotion hotsync will restore the original IP which may make your VPS unreachable. Maybe simple rsync would be the better solution for VPS migration…

http://docs.nethserver.org/en/v7/migration.html#migration-with-rsync


(Nitram Oneito) #14

if moving everything may seem such a challenge. what about moving only the emails, for the accounts they belong to.so as to deploy nethserver on another host, re-mapp the dns records to the new server, and re-create the ldap accounts.
and then import the emails.etc


(Markus Neuberger) #15

I think this would be the better method in this case.

Mails are stored in /var/lib/nethserver/vmail/. You may use rsync to migrate files from one VPS to another.

Another method would be to transfer mails with a mail client like thunderbird or a mail sync tool like imapsync or dsync.

yum -y install imapsync
imapsync --host1 providerimapserver --port1 993 --user1 name@provider.at --password1 PASSWORD1 --ssl1 --host2 localhost --port1 993 --user2 name@domain.local --password2 PASWORD2 --ssl2

(Nitram Oneito) #16

let me try the imap sync way. as my current vps provider, am just not happy.
all my other servers on the other provider have never had an issue.

if am unable ill happily pay someone to help me move.


(Markus Neuberger) #17

Imapsync should do the job.

At least it should always work to copy mails from /var/lib/nethserver/vmail/user1@server1 to /var/lib/nethserver/vmail/user1@server2. You may try it with a test user first.
The vmail folder has to be owned by vmail so you may have to chown -R vmail:vmail /var/lib/nethserver/vmail after the transfer.