mjl- / mox

modern full-featured open source secure mail server for low-maintenance self-hosted email
https://www.xmox.nl
MIT License
3.55k stars 100 forks source link

How to switch the main domain? #174

Closed ally9335 closed 3 months ago

ally9335 commented 4 months ago

A year ago I set Mox up with the main main-domain1.com, MX - mail.main-domain1.com

along with 3 ordinary email domains:

sub-domain1.com (MX -> mail.main-domain1.com)
sub-domain2.com (MX -> mail.main-domain1.com)
sub-domain3.com (MX -> mail.main-domain1.com)

Now that main-domain1.com has expired, I want to migrate or rather switch Mox onto main-domain2.com which I've just bought. This email isn't important, and I haven't prolonged it, therefore this approach will do.

Namely, now it'll become:

sub-domain1.com (MX -> mail.main-domain2.com)
sub-domain2.com (MX -> mail.main-domain2.com)
sub-domain3.com (MX -> mail.main-domain2.com)

What will I have to edit or add into the config? How to command to Mox to use main-domain2.com as the main domain from now on? Apart from the DNS settings in the dashboard of my domain.

The emails of main-domain1.com may remain.

RobSlgm commented 4 months ago

As I understand the basic configuration, two config files are involved.

domains.conf:

mox.conf :

Have you considered to create a new server under main-domain2.com and simply move the email domains to it?

ally9335 commented 4 months ago

Thanks

Have you considered to create a new server under main-domain2.com and simply move the email domains to it?

Why? How would that be any easier considering that I'd have to move over there the emails (files) of sub-domain1-3.com as well?

RobSlgm commented 4 months ago

Let's assume that main-domain1.com is not yet expired, but you want to move your server to the new main-domain2.com. A further goal would be to minimize the down-time of the mail subdomains (sub-domain[1-3].com).

Doing it with one server poses the challenge, that while most of the DNS entries can be set before-hand (with no interruption on the operation of mail-domain1.com while waiting for propagation of DNS) the RDNS can't.

With two server you can take your time setting up the mail-domain2.com, including generating a new private key and all the DNS entries. After this setup works you rsync the mail data and append manually the configuration for the sub-domains to your new server. You still have to set the DNS entries for the sub-domain and face the issue of undetermined DNS propagation time, but the risk is much smaller as your main setup is already verified. As unfortunately most DNS provider I know don't provide an API to change the entries, the DNS setup remains a manual step with high potential of mistakes.

Secondly you didn't mention the version of your installation. It could be beneficial to create a new setup and potentially gain insight on features with the new default configuration. You will still need - if you are not already on the newest version - to migrate your data first in-place. I'm just referring to the default configuration mox quickstart.)

ally9335 commented 4 months ago

1) Ok. But the downtime isn't an issue, is it? It's been down for several days already and after I finallly will have it switched, all the emails for this period will still arrive. There're no users but myself.

2) the latest one