CMP

Migrate a server

Move a Linux server from AWS, Google Cloud, Azure, DigitalOcean, another VPS provider or your own hardware onto one of your instances. Your applications, websites, databases, users and settings come along. Open Migrations in the menu.

A small agent runs on the source (and, unless the portal prepares it, on the destination). The source copies its files straight to the destination over SSH; nothing passes through this portal, which only coordinates and shows progress. The copy uses rsync, so:

Owners, Admins and Developers can start and manage migrations; everyone in the organization can follow them.

The portal can do most of the work for you; each part is optional and chosen when you start the migration:

With all of them on, you only fill in the form and select Finish migration.

Move a server to another cloud (one click)

For a server that is already in the portal, on any connected cloud (your own DigitalOcean, Vultr, Akamai, Hetzner, AWS, Google Cloud, Azure or Virtualizor account, or a server you ordered here), the portal does every step itself. Open the server and select Move to another cloud, or Migrations › Move a server to another cloud.

  1. Server to move: pick it.

  2. Where it goes: one of your cloud accounts that can create servers (the provider bills it), or this platform's servers (charged hourly from your balance). Only clouds connected in the current organization are listed. Providers you haven't connected there yet are shown below them with a Connect link. Then:

    • Region.
    • Size: sizes with at least the source's memory and disk are marked Fits; the cheapest one that fits is chosen for you.
    • Operating system: only images of the same distribution and major version as the source can be picked (e.g. Ubuntu 22.04 for an Ubuntu 22.04 server). The portal checks it again against what the source agent reports before creating anything.
    • Name of the new server (optional; <source>-migrated by default).
  3. How it moves: Live (recommended) or One pass, and three switches, all on by default:

    • Stop the applications for the last pass: every application on the source (web servers, databases, mail, Docker…) is stopped right before the last pass, so nothing changes during it. If that pass fails or you cancel, the source starts them again. When the migration completes they stay stopped on the source and start on the new server when it reboots.
    • Fix the old IP address in copied files: see The old IP address.
    • Reboot and check the new server after the finish.
  4. Starting the agent on the source. How depends on where the source runs:

    Source What you enter
    Microsoft Azure Nothing: Azure's Run Command starts the agent (the VM needs its Azure agent, which Azure's Linux images have).
    Google Cloud Nothing: the portal adds a temporary SSH key to the instance's metadata, logs in with it once and removes it. Not with OS Login turned on.
    AWS Nothing: the portal pushes a temporary key with EC2 Instance Connect (valid for 60 seconds). The image needs ec2-instance-connect (Ubuntu and Amazon Linux have it), SSH must be open to the portal, and the IAM user needs ec2-instance-connect:SendSSHPublicKey.
    DigitalOcean, Vultr, Akamai, Hetzner, Virtualizor The source's root password or SSH private key (or a user with passwordless sudo). It is used once to start the agent and is never stored.

    You can also choose I run a command on the source: the next page shows one command to paste there.

  5. Tick the confirmation and select Move server.

The page that follows shows each step under Done for you: starting the agent, creating the destination (once the agent has reported, so it gets exactly the source's operating system), the copy, the finish and the checks. If the agent can't be started, Try again lets you enter a login. Cancel migration can also delete the server the portal created.

The old IP address

Configuration and website files often contain the server's own IP address (a web server's listen 203.0.113.7:443, an application's .env, DNS zone files). After each pass the agent looks for the source's addresses in /etc, /opt, /srv, /var/www, /usr/local/etc, DNS and control-panel directories and /home/*/public_html, in text files up to 1 MB. Ready to finish lists the files it found.

With Replace them during the finish ticked, the last pass replaces each old address with the new server's address of the same kind (public for public, private for private) in those files, on the new server only. Each changed file's original is kept next to it as <file>.cmp-bak. Files the destination keeps its own version of (network settings, /etc/hosts, SSH) are never touched.

Licences tied to the address

Control panels such as cPanel/WHM, Plesk, DirectAdmin, CloudLinux, Webuzo and Softaculous are licensed for the server's IP address. The migration page warns you when the source has one: move the licence to the new address with its vendor or your licence provider, or the panel stops working on the new server.

Verification and the old server

After the reboot the portal checks every port the source served to the internet on the new server's address, and asks the web ports (80, 443) for a page; the results are in the Verification table. When everything checks out and DNS points at the new server, Power off the source from the same page (nothing is deleted; delete it later from its page).

When servers can't reach the portal's address

The agents call the portal from the servers being migrated. If those servers reach the portal by a different address than the one you use, for example over a private network, your provider sets that address for the agents. Ask your provider if agents report Could not reach the portal.

Before you start

  1. Create the destination instance with a disk larger than the data on the source. See Create an instance. Its operating system should be the same, and the same major version, as the source (for example Ubuntu 22.04 to Ubuntu 22.04); if the portal prepares the destination, it installs the right one for you.
  2. Back up the destination if anything on it matters: its files will be replaced. See Backups.
  3. The source needs Python 3 (almost every Linux has it). You need root on it (or a user with sudo), either to run the command or for the portal to log in.
  4. The source must be able to reach the destination on its SSH port (usually 22). Allow it through any firewall.

Start a migration

Select Start a migration:

  1. Source: where the server runs now, and a name for it (its hostname or IP). This is only a label; the agent needs no access to that cloud's account.
    • How the agent starts on the source:
      • I run a command (default): you get one command to paste on the source. The portal never holds a login for it.
      • The portal logs in and starts it: enter the source's public IP address or hostname, SSH port, user (root, or a user that can use sudo without a password) and its password or private key (without a passphrase; for a DigitalOcean droplet, the key you log in with). The portal connects over SSH from the internet, so the source's firewall must allow it. The login is stored encrypted and deleted when the copy completes or the migration is cancelled or expires.
  2. Destination: the instance it moves onto.
    • Install the source's operating system on it for me: available for instances created in this portal on our clouds. As soon as the source agent reports, the portal reinstalls the destination with the same operating system and version and lets the source in: there is no destination command. If no image matches, or the destination's disk is too small for the source's data, it stops and says why.
  3. Method:
    • Live (recommended): the source keeps running. After the first copy you can copy the changes again as often as you like, and finish when you are ready. Downtime is only the last, short pass.
    • One pass: one copy, then the migration finishes by itself. Stop your applications and databases on the source before you start.
  4. After the copy (optional):
    • Reboot the destination and check it: after the migration the portal reboots the destination, then checks that every port the source served on the internet (SSH, web, mail, …) answers on it, for up to 10 minutes.
    • Point my DNS at the destination: choose Cloudflare or DigitalOcean DNS, and enter the domain, the records (names in the domain separated by spaces; @ is the domain itself, e.g. @ www) and an API token (Cloudflare: Zone › DNS › Edit for that domain; DigitalOcean: write access). The token is checked when you create the migration. Once the checks pass, the portal points those A records at the destination's IP address (and creates any that don't exist), then deletes the token. If you don't choose the reboot, a Switch DNS now button appears when the migration completes.
  5. Confirm that the destination's files will be replaced, and select Create migration.

Run the agents

The migration's page shows the commands you still need. Copy them with Copy and run each as root:

  1. On the destination first (not shown when the portal prepares it). It lets the source in, for this migration only, and finishes within seconds. Its SSH key is limited to this migration and expires with it.
  2. Then on the source (only if the portal does not start it, or could not). It starts copying straight away. Run it inside screen or tmux, so it keeps going if you disconnect.

Each command shows Agent connected in the portal while it runs. Keep the commands private: anyone who has them can take part in this migration until it ends.

The destination agent also sends the destination's SSH host keys through the portal, and the source only connects to a server presenting one of them. If you reinstall the destination during a migration, run the destination command again: the source then trusts the new keys. When the portal prepares the destination, it reads the keys itself right after the install.

Done for you

When the portal does any of the steps, the Done for you panel on the migration's page shows each one: not started, running, done, or failed with the reason.

Follow the copy

The page updates by itself: percentage, data copied, speed and time left. If both servers have reported, it also warns you when:

If the copy stops (the network dropped, the source rebooted, you pressed Ctrl+C), the page shows Interrupted and why. Fix the cause and run the source command again; files already copied are not sent again.

Limit the bandwidth

By default the copy uses as much of the source's network as it can, which can slow its websites while the copy runs. To prevent that:

A change reaches the source agent within seconds. A pass that is running restarts with the new limit, and files already copied are not sent again. The page shows the limit next to the current speed.

Finish

Live migrations stop at Ready to finish after the first copy. The source is still running, so its data keeps changing:

  1. Select Sync changes as often as you like. Each pass is quick, because it only sends what changed.
  2. Under Stop on the source before the last pass, tick the applications to stop (web servers, databases, Docker… — the agent lists what runs on the source; system services such as SSH are never offered). The agent stops them right before the last pass, so nothing changes during it. They stay stopped on the source and start on the destination when it reboots.
  3. Choose Now, or At a date and time (in your browser's time zone, before the migration expires), and select Finish migration or Schedule finish. A scheduled finish shows on the page; to change it, finish now or pick another time.
  4. The source agent copies the last changes. Then the destination takes over the source's SSH host keys, so your SSH clients don't warn about a changed server, and root's SSH keys.

One-pass migrations finish by themselves after the copy.

When the migration shows Completed:

  1. Reboot the destination so it starts the copied services: the portal does it if you chose Reboot the destination and check it; otherwise use the button on the page.
  2. Check it. Log in over SSH: the source's root password and keys now work. Make sure your services run and test your sites.
  3. Point your DNS at the destination's IP address, unless the portal does it for you. Lower the records' TTL a day before to make the switch quick.
  4. Keep the source for a few days as a fallback, then delete it.

What is copied and what is kept

Copied from the source: everything on its local disks, including:

Files on the destination that the source doesn't have are deleted.

Kept on the destination, so it starts and reaches the network on its new cloud:

Not copied:

After the migration, the destination runs the source's programs on its own kernel. Install the latest updates once it's running (apt upgrade or dnf upgrade).

Cancel or remove

Notifications

Notification channels can announce Migration started, Migration completed, Migration interrupted and Migrated server failed its checks. See Notifications and webhooks.

Troubleshooting