Skip to main content

The elpan-migrate tool

elpan-migrate is the program that moves domains. It runs on a machine of yours, not on the server, and reaches each panel the way you do: over HTTPS, with an approval you give it in the account. It never signs in as root, has no password of its own, and stores no credential but the approvals.

Get it​

It's a container image for Linux (x86-64 and ARM64) that also carries the programs it needs:

ghcr.io/elpan-panel/elpan-migrate

Give it a volume for its state directory, and run it interactively so it can ask for a passphrase:

podman run --rm -it -v elpan-migrate:/state ghcr.io/elpan-panel/elpan-migrate plan control.example.com

Docker takes the same arguments. For export and import, mount the folder that holds the file, e.g. -v "$PWD":/work, and name the file under /work. From a container the tool can't open a browser on your machine, so approve with the device code it prints.

What it needs​

ForThe machine needs
Every commandHTTPS to each panel (control. of each server).
A live move (sync, switch, back)ssh, and to reach the receiving server's SSH port. The receiving server itself reaches the giving server's SSH port; see The copies go server to server.
export and importssh, rsync and Dovecot 2.4's doveadm, and the SSH port of the server. Room for the largest mailbox or folder at a time.

The container image has all three programs, and the Dovecot configuration the tool runs doveadm with.

Your provider may have moved the server's SSH port away from 22; the tool learns the right one from the panel.

Commands​

Name the giving panel, and the receiving one when it's another server. A panel is named by its host, e.g. control.example.com.

Command
inspect <giving> [<receiving>]Ask for the approvals, or reuse them, and show what each covers.
plan, prepare, sync, switchThe steps of a move; see The steps.
abortBefore the activation: the giving domain active again, its databases writable.
statusWhere each domain's move stands, and both copies' state.
backThe domain back to the account it came from; see Move it back.
watchKeep a stand-in current until the registrar names the new server.
forgetEnd both approvals of a move, and forget them.
export <panel> <file.zip>The approval's domains to a file; see Export a domain to a file.
import <file.zip> <panel>A file's domains into an account, as inactive copies.
activate <file.zip> <panel>Make imported copies active.
account plan, prepare, sync, switch, abort, status, back, releaseA whole account; see Move your account to another server.
version, help

A command that changes something can be run again: it picks up where the last run stopped. --domain example.com after the command's name limits it to one domain, and can be given more than once.

Options before the command:

Option
--state DIRThe state directory.
--jsonJSON instead of text, for scripts.
--watch-every DHow often watch reads the new copy's records; 5m by default, at least 10s.

The environment can set ELPAN_MIGRATE_STATE (the state directory), ELPAN_MIGRATE_PASSPHRASE (an export's passphrase) and ELPAN_MIGRATE_DOVEADM_CONFIG. SSL_CERT_FILE replaces the trusted certificate authorities, for a server whose certificate isn't from a public one.

The state directory​

Between runs the tool keeps its notes in a directory: for each move, the two approvals' tokens, what each domain's run has done (the copy it made, which giving item became which receiving one, the databases' new names) and a journal. That's how switch finds what prepare made, and how a run picks up after an interruption.

It's /state in the container image, else ~/.local/state/elpan-migrate, or what --state names. Keep it until the move is finished, and keep it private: the tokens in it act for the two accounts until the approvals end. It never holds a password, a hash, a second factor or a private key.

What it never does​

  • It never deletes anything in the giving account. Removing what a move leaves behind is yours to do.
  • It never touches what the receiving account had before, except a folder or database you ticked to be replaced.
  • It never reaches more than the approvals name: the panels check every call against them, whatever the tool says.
  • It never writes credentials to its state directory or its output. Only an export's file holds them, encrypted with your passphrase unless you chose none.