Skip to main content

Move a domain to another account

A domain moves from one account to another, on this server or on another Elpan server, with everything in it: mailboxes with their mail and passwords, websites, DNS records, certificates, and the folders and databases you choose. You don't need your provider. A tool you run, elpan-migrate, does the work, and you approve it in each of the two accounts.

The two accounts can be yours, or the domain can go to somebody else: each account's owner approves their own side.

How a move works​

A domain name can exist in several accounts of one server, but only one copy is active: the one that takes mail and serves websites. A move uses that:

  1. The receiving account gets an inactive copy of the domain: the same services, mailboxes and records, serving nothing.
  2. The tool fills the copy with the mail, files and databases while the domain keeps working in the giving account. You can repeat this as often as you like; each run copies what changed.
  3. At the switch, the giving copy stops for a few minutes, the tool copies what changed once more, and the two copies change places: the receiving one is active, the giving one is inactive.

The giving account keeps its inactive copy, its folders and its databases until you remove them. The tool never deletes anything in the giving account, which is also what makes the way back possible. Inactive and unavailable domains says what each state looks like on the Domains page.

To another server, a move also needs a proof that you control the domain and a change in the DNS; see Move a domain to another server.

Who can move a domain​

Your provider decides. Both accounts need:

  • moves allowed on the server ("Account owners can move domains between accounts"), and adding and removing domains too: giving a domain is removing one, and receiving one is adding one;
  • a domain limit other than 0;
  • an account that isn't suspended or being deleted.

The receiving account also needs room: its inactive copy counts against its domain limit from the moment it's made, and the mailboxes, files and databases count against its storage. If anything is missing, the approval page says why and offers only Deny.

What goes with the domain​

Everything a domain removal would take goes to the receiving account:

  • the DNS zone and your own records; the receiving copy makes its generated records (SPF, DKIM, the mail and service names) itself;
  • websites, aliases, browser verification and directory and port mounts;
  • the mail service with its settings, and every domain account: mailboxes, send-only accounts, forwarders, groups, rejectors, relayers, and mailing lists with their members and archive;
  • in each mailbox: the mail with its folders and flags, the sieve filters, the calendars and address books, and the webmail's settings and contacts;
  • the identity provider and its applications, and shares;
  • certificates, with their private keys, so HTTPS works from the first request.

Credentials go too: each mailbox's password (as a hash), authenticator app, backup codes, app passwords and passkeys, the applications' client IDs and secrets, and the secrets of the mail gateway, relays, lists and DNS provider. Your email users sign in with the passwords they have, and their mail apps keep working with their app passwords.

Mail apps don't download the mail again: each message keeps its IMAP UID and POP3 UIDL. Applications that sign their users in through the domain's identity provider still know them: each user keeps the same subject (sub).

From the account, the domain takes what you choose when you approve the move: folders (the websites' document roots are preselected) and databases (those of the web applications found on its websites are preselected).

Databases get a new name​

A database name starts with the account's name, so acme_shop becomes newacme_shop in the account newacme, with the login newacme_shop and the host newacme_shop.db.internal. The password stays the same.

Each copy of a folder rewrites the settings files of the applications the tool recognizes: WordPress wp-config.php, .env, Joomla configuration.php, Drupal settings.php, Nextcloud config/config.php, Magento app/etc/env.php and PrestaShop app/config/parameters.php. A value that is exactly the old database name, login or host, or a path in the old home directory (/home/acme/…), becomes the new one. Nothing else in them changes, and the password isn't touched.

Check what the tool lists

sync lists the other text files in the copied folders that still name the old database or home directory, e.g. an .htaccess file or the settings of an application the tool doesn't know, and plan the cron lines that do. Change those by hand after the switch; until then such a site can't reach its database.

What doesn't go​

WhatWhy
Sessions, signed-in devices and consentsEverybody signs in again: webmail, the sign-in portal, applications.
Sign-in logs, mail logs, bounce historyThey're the giving account's history.
App servers, containers, cron jobs, webhooks, spam filter rulesThey're the account's, not the domain's. A mount of an app server on a moved website is left out.
BackupsThe giving account's backups stay with it.
Web application recordsThe receiving account finds the installations again by a scan of the copied folders at the switch.
Valkey databasesTheir keys expire anyway.
Your provider's settings, e.g. rate limitsThe receiving server's provider sets them.
The identity applications' logos, mailbox pictures, list posts awaiting moderationNot carried yet.

plan lists all of these for your domain before anything is changed.

The steps​

On one server, name the panel once; to another server, name the giving panel and then the receiving one. Each command first makes sure both approvals are there, and asks for them if not.

elpan-migrate plan control.example.com
elpan-migrate prepare control.example.com
elpan-migrate sync control.example.com
elpan-migrate switch control.example.com
CommandWhat it does
planReads the domain and says what would be carried, what is renamed, what is left out and why, and what stands in the way: a folder or database name the receiving account has already, a full domain limit, a database engine the receiving server lacks. Changes nothing.
prepareMakes the inactive copy and carries the configuration and credentials into it.
syncCopies the content: mail, folders, calendars and contacts, webmail data, list archives, databases. The domain keeps working. Run it again whenever you like.
switchThe downtime: below.

A command works on every domain the giving approval names; to work on one, put --domain example.com after the command's name: elpan-migrate sync --domain example.com control.example.com.

Every command can be run again: it finds what the last run did, in the tool's state directory, and goes on from there. status says where each domain stands.

During the switch​

The switch makes the giving copy unavailable and its databases read-only, copies what changed since the last sync, checks that the databases' tables and rows match, and activates the receiving copy. It waits until the server confirms that the giving copy has stopped, rather than for a fixed time. How long it takes depends on what changed since the last sync, and on the databases: they are copied in full every time. Run sync right before switch to keep the downtime short.

While it runs:

WhoWhat they get
Servers sending mail to the domain450 4.3.2 Mailbox temporarily unavailable, retry later. They try again later and the mail arrives in the receiving copy. Nothing bounces.
Mail appsOpen sessions end. A sign-in with the right password gets a temporary failure: IMAP NO [UNAVAILABLE], POP3 -ERR [SYS/TEMP], sending 454 4.7.0. Apps retry by themselves. A wrong password still gets "Authentication failed".
VisitorsA maintenance page with status 503 and Retry-After, on websites and webmail. /.well-known/ keeps working, so certificates renew.
The sign-in portal, accounts.<domain>"Temporarily unavailable": nobody signs in, and applications that sign their users in there are told to try again later (temporarily_unavailable). An email user of the domain signing in at another of your domains' portals is told "The domain of this account is temporarily unavailable" once the password is right. If the switch stops and the domain is active here again, sessions and remembered sign-ins work again.
Applications writing to a moved databaseAn error: the database is read-only.
YouThe domain is read-only in both accounts.

FTP sign-ins with a mailbox address are refused as if the password were wrong until the switch ends.

If the switch stops

Stopped with Ctrl-C, or by a failed copy, the giving copy stays unavailable and its databases read-only, under a lease the tool keeps renewing. Run switch again to finish, or abort. If you do neither, the lease runs out within half an hour and the domain is active again in the giving account by itself, its databases writable.

After the switch, the giving databases are writable again: they stay the giving account's, as do the folders. Remove them, and the inactive copy, in the giving account once the domain works in the receiving one.

Abort​

elpan-migrate abort control.example.com

Before the receiving copy is active, abort makes the giving copy active again and its databases writable. The receiving copy stays inactive: try again later, or remove it. Without the tool, Make available again on the giving Domains page makes the domain active at once, and the databases are writable again when their lease runs out, within half an hour.

Move it back​

elpan-migrate back control.example.com

After a switch, back moves the domain back to the account it came from, with whatever mail, records and mailboxes arrived since. It needs both approvals again, with the roles swapped: the account that received the domain gives it now. The original account's inactive copy is used again, not a new one.

The original account still has its old folders and databases. To have them overwritten with the current content, tick them on the original account's approval under Replace what this account has already; without the ticks, back stops before writing anything and names what to tick. --approve-again withdraws the receiving approval and asks for a new one. back --abort aborts a way back before its activation.