Skip to content

Server migration

A server migration moves every selected account of one source system into a Stalwart deployment, together with the domains, aliases, groups, mailing lists and DKIM keys that the source holds. It is the procedure for replacing a mail server, a hosted tenant or a mail platform with Stalwart. A single account moved into an existing Stalwart account follows the shorter Account migration instead.

The procedure is a Vandelay project with the scope “Whole server”. The project, its plan, the runner that executes the work, the states an account passes through and the reason a switch cannot be undone are introduced in Concepts; this page assumes them. The decisions to take before starting, such as the cutover strategy, the password policy and the Stalwart limits, are discussed in Planning.

The steps below follow the order of the Vandelay wizard. Each step is shown for the three front ends: the web UI (vandelay serve), the terminal UI (vandelay tui) and the command line (vandelay migrate). All three edit the same plan and drive the same runner, so a project can be started in one and continued in another. On every form step, the web UI and the TUI show the equivalent vandelay migrate command for the values entered so far: the “CLI command” tile at the bottom of the web page, and the c key in the TUI. A step can therefore be filled in interactively and repeated later in a script.

The first step creates the project directory, which holds the plan (plan.toml), the project state, the encrypted secret store, the logs, the reports and one archive per account. Vandelay creates these directories readable by their owner only, and pre-flight warns when the project directory is readable by other local users, because the archives hold complete copies of every mailbox. The volume needs room for the archives of the accounts being migrated, which pre-flight also estimates.

The scope is chosen here and is fixed for the life of the project: a project created with “Whole server” cannot later become a single-account project, or the other way round. A different scope needs a new project.

The secret store is created when the runner first needs it, protected by a passphrase or a key file. It holds the temporary passwords that Vandelay sets on the accounts it creates in Stalwart; the answers to ask prompts are kept by the runner in memory only, until it stops. Unlocking is described in Web UI and TUI.

  1. Start the web UI with vandelay serve --root /srv/migration, open the sign-in URL it prints, and sign in, as described in Web UI and TUI.
  2. In the “New project” tile, enter the Project directory (a new directory name under the root) and set Scope to “Whole server”.
  3. Click Create project.
  4. In the page head, open Unlock the secret store, choose a passphrase, repeat it and click Unlock. The project’s runner starts in the web UI once the store is unlocked.

Vandelay web UI: the Unlock the secret store panel of a new project, with the passphrase typed twiceVandelay web UI: the Unlock the secret store panel of a new project, with the passphrase typed twice

The “Target (Stalwart)” step tells Vandelay which Stalwart deployment receives the accounts and how to sign in to it as an administrator. Vandelay creates domains, accounts, groups and lists through this login and writes every account’s data, so the administrator needs the permissions to provision objects; pre-flight names any permission that is missing. The target must run Stalwart 1.2 or later. An older deployment is refused at pre-flight with Stalwart is older than 1.2: upgrade Stalwart, or migrate account by account with vandelay import and vandelay export, which work with any JMAP server.

The decisions on this step are:

  • Stalwart URL and Sign in with: the base URL of the deployment, and either “User and password” (an Admin user and Admin password) or an “API token”.
  • Certificate pin (SHA-256) (Advanced): the fingerprint of a self-signed target certificate. Vandelay does not turn certificate verification off; a certificate that does not verify is accepted only through its pin, and only over HTTPS.
  • Allow vandelay’s address (Advanced): adds the Vandelay host to Stalwart’s allowed IPs for the duration of the migration, so that the bulk import is not throttled or banned by Stalwart’s rate limits and ban thresholds. The entry is removed when the project is finished.

Passwords, tokens and every other secret are never written to the plan. A secret field holds a reference instead: env:NAME reads an environment variable of the runner, file:PATH reads a file (a relative path is resolved against the project directory), and ask makes the runner ask for the value and keep it in memory until it stops. Every front end accepts all three forms.

The target is bound to the project once the first copy or provisioning has been admitted. After that point, the URL can no longer be changed, and a plan that names another server is refused with the target cannot change after the migration has started.

  1. Fill in Stalwart URL, Sign in with and the credentials. Open Advanced for the certificate pin and Allow vandelay’s address.
  2. Click Save, then Test the connection. The test runs the target checks of pre-flight: reachability, version, permissions and limits.
  3. Click Next.

The optional “Find the server” box above the form detects the Stalwart URL from a domain or an email address.

Vandelay web UI: the Target (Stalwart) step with the Stalwart URL, the admin user, the admin password reference and the certificate pin filled inVandelay web UI: the Target (Stalwart) step with the Stalwart URL, the admin user, the admin password reference and the certificate pin filled in

The “Source: detect” step names the kind of server the accounts are on now. The Source system decides which connector reads the source and which fields the next step asks for: “Dovecot and Postfix (generic)”, “docker-mailserver”, “iRedMail”, “mailcow”, “Modoboa”, “Mailu”, “Mail-in-a-Box”, “Zimbra”, “Exchange Server (on-premises)”, “Microsoft 365”, “Google Workspace”, or “Other IMAP server” for any server that offers IMAP. Each system has its own page under Sources. A previous Stalwart release has no connector; it is migrated account by account as described in Stalwart.

Detection is optional. Given a domain or an email address, Vandelay probes the domain’s MX and SRV records, autoconfig and autodiscover, the .well-known JMAP, CalDAV and CardDAV locations, the IMAP and ManageSieve greetings, HTTP fingerprints and the Microsoft and Google sign-in realms. It reports what each probe found with a confidence of low, medium or high, shows a probe that found nothing as “Not found”, and pre-selects the system when the confidence is medium or above. Found endpoints, such as the IMAP and ManageSieve URLs, pre-fill the fields of the next step. The operator can always change the choice.

The same step holds the migration proxy for a zero-downtime migration. When a migration proxy answers for the probed domain, detection says so. For a one-shot migration, or a copy without cutover, the Migration proxy admin URL stays empty and the other proxy fields do not appear. The proxy fields and their meaning are described in Zero-downtime migration.

The source system can be changed until accounts are discovered. After that, a change is refused with The source system is fixed once accounts are discovered. To migrate from another system, create a new project., and once work is admitted the source server is bound to the project like the target.

  1. Optionally, enter a domain or an email address in Find the server (optional): domain or email address and click Detect. Detection runs only while no runner holds the project, so in the web UI it is available before the secret store is unlocked; otherwise the step says Detection runs only before the secret store is unlocked, while no runner holds the project.
  2. Under “Migrating from”, pick the Source system. A pre-selected system carries a “detected” badge with its confidence.
  3. For a zero-downtime migration, fill in the proxy fields.
  4. Click Save, then Next.

Vandelay web UI: the Source: detect step with Dovecot and Postfix (generic) chosen as the source systemVandelay web UI: the Source: detect step with Dovecot and Postfix (generic) chosen as the source system

The “Source: access” step gives Vandelay what it needs to read every account: the source’s endpoints and an administrative credential, such as a Dovecot master user, an admin API key, an Exchange service account with impersonation, a Microsoft 365 app registration or a Google service account with domain-wide delegation. The fields differ per system and are described on the system’s page under Sources, together with what to prepare on the source. The step also shows the system’s setup guide, which vandelay migrate guide <name> prints as Markdown.

Some mechanics are shared by every system:

  • Read-only access. Vandelay only reads the source. Where the connector needs configuration files or password hashes, Server file access reads them “On this machine” (with a Server root directory) or “Over SSH” (with an SSH destination, and optionally an SSH key file and SSH known hosts file). Over SSH, Vandelay runs only a fixed set of read-only commands.
  • TLS. Credentials without TLS stays at “Never send credentials without TLS” unless the source offers no TLS at all. A self-signed source certificate is accepted through Source certificate pin (SHA-256), which covers the source host on every port.
  • Files on the Vandelay host. Paths, such as an SSH key, a known hosts file or an accounts CSV, and file: references are read on the host that runs Vandelay, whichever front end sets them. The web UI accepts every field, which is one of the reasons it must never be reachable by anyone other than the administrator, as described in Installation.

Test the connection checks that the source answers, lists its accounts, and signs in to one enabled user from that listing to list its folders. When the listing holds no enabled user, it reports the account listing names no enabled user account to test the source login on. For a system whose first connection is made by discovery, such as Exchange Server, the test reports the source server was not contacted: for this system the first connection is made by Discover (next step). Pre-flight later tests the access to every selected account. A passing test reads, for example, [email protected]: signed in as the master user (login separator), 12 folders listed, INBOX among them.

  1. Fill in the fields of the chosen system, including Server file access and its root directory or SSH settings when the system reads files from the server. The guide for the system is shown beside the form.
  2. Click Save, then Test the connection.
  3. Click Next.

Vandelay web UI: the Source: access step with the IMAP and ManageSieve URLs, the Dovecot master user and SSH file access to the source serverVandelay web UI: the Source: access step with the IMAP and ManageSieve URLs, the Dovecot master user and SSH file access to the source server

The Accounts step lists what the source holds and chooses which accounts take part. Discovery reads the source’s accounts, domains, aliases, groups, mailing lists and resources, and records what it cannot represent in Stalwart as losses, which pre-flight lists. Discovery can be repeated at any time; it reports new accounts, accounts that are gone and accounts that came back.

After discovery, the step shows four tables: “Accounts” (with each account’s size, item count, password scheme, login forms, conflicts and state), “Domains”, “Mailing lists and groups”, and “Conflicts”, which lists source addresses that clash with objects already on the target or with each other. Conflicts must be resolved before provisioning, by skipping or retargeting the account or by changing the conflicting object on the target.

Selection is either every discovered account (Select all accounts), the addresses listed in a CSV file under a header named address (Select from CSV), or individual rows of the table. Every address in the CSV must match a discovered account; if one does not, nothing is selected and the save names the address. Saving a new CSV path selects every account it lists, including accounts that were taken out of the migration on the table before. Saving the same path again after editing the file does not select again, so an edited list is saved under another path. Disabled accounts and accounts with no data are included by default, and left out when Include disabled accounts or Include accounts with no data (Advanced) is turned off. A disabled account is created on Stalwart with its login disabled, and is shown as “(disabled on the source)”. Taking an account out of the migration later stops its copy, and selecting it again starts it from the first step. Accounts that are already provisioned, copying or switching cannot leave this way: Clear selection asks Clear the selection: take out of the migration every account that can still leave it (<n> listed)? and names the accounts that stay.

Per-account overrides change one account without changing the plan for the others: a different target address, extra login forms for the proxy, folder filters, a forced temporary password, or skipping the account. They are set on the account detail screen or with vandelay migrate account-set.

  1. Click Discover accounts on the source. The notice above the tables shows when discovery is queued or running, and when it finished.
  2. Tick Select all accounts, or tick rows in the “Accounts” table. Select all N matching selects every row that matches the table filter, and Select the accounts listed in a CSV file selects from a file.
  3. Click Save the selection in the bar above the table. The notice confirms it with Saved. Accounts in the migration: <n>. Then click Next.

Vandelay web UI: the Accounts step after discovery: six accounts at example.org and example.com with their password schemes and statesVandelay web UI: the Accounts step after discovery: six accounts at example.org and example.com with their password schemes and states

The “Data to migrate” step decides which kinds of data are copied for every account: mail and folders, calendars, address books, files, Sieve scripts, other rules (converted to Stalwart mail rules), the vacation responder, sender identities and signatures, and forwarding. Each is a switch. Skip Junk, Skip Trash and Only subscribed folders narrow the mail copy, and Include folders and Exclude folders (Advanced) filter folders by regular expressions, one per line or per value.

What a source cannot provide for a kind of data is reported as a loss rather than silently dropped. The losses of each system are listed on its source page.

  1. Tick the kinds of data to copy, and open Advanced for the folder filters.
  2. Click Save, then Next.

Vandelay web UI: the Data to migrate step with mail, calendars, contacts, files, Sieve scripts, rules, vacation, identities and forwarding tickedVandelay web UI: the Data to migrate step with mail, calendars, contacts, files, Sieve scripts, rules, vacation, identities and forwarding ticked

The “Provisioning and passwords” step decides how Vandelay creates objects in Stalwart. Provisioning only adds: it creates domains, accounts, groups, lists and aliases, and adds memberships, list recipients and delegates, but never removes any of them from the target.

Passwords is the decision users notice most:

  • Keep existing passwords where possible; temporary password otherwise. Password hashes in a scheme Stalwart supports are carried, so those users keep their password. Every other account receives a temporary password. Passwords that the source stores in clear text are carried only with Carry clear-text passwords (Advanced), and are hashed before they reach Stalwart.
  • Temporary password for everyone. Every account receives a generated password.
  • No passwords: an external identity provider signs users in. No password is set, and the user list is exported for the identity provider with vandelay migrate export-users.

Pre-flight counts how many accounts fall into each case and why. Temporary passwords must reach the users before their accounts switch; they are downloaded in an encrypted file, as described in Reports and exports, and the “Mail merge for users” guide on the Cutover step shows a way to send them. In a zero-downtime migration, an account that gets a temporary password is locked out of its existing clients at its switch, which pre-flight points out.

The other decisions are:

  • DKIM keys: per domain, import the source’s key, generate a new one, or skip. A generated key must be published in DNS before mail is signed with it.
  • Accounts already in Stalwart: “Use them as targets and add missing aliases”, or “Skip those accounts”.
  • Carry quotas, Carry aliases, Carry lists and groups, Role for new accounts and Temporary password length (Advanced). Temporary passwords are between 12 and 64 characters long.
  • Catch-all addresses (Advanced): a server-scope project sets the source’s catch-all addresses at Finish, after the last switch. A catch-all set earlier would swallow the mail that split delivery must relay to the accounts still on the source.
  1. Choose Passwords, enter one DKIM keys line per domain, and choose how to treat Accounts already in Stalwart.
  2. Open Advanced for the other options.
  3. Click Save, then Next.

Vandelay web UI: the Provisioning and passwords step: keep existing passwords where possible, temporary password otherwiseVandelay web UI: the Provisioning and passwords step: keep existing passwords where possible, temporary password otherwise

The “Cutover strategy” step decides how users move to Stalwart once their data is copied. Cutover has three values, each with its own page:

  • Account by account through the migration proxy (proxy): each account switches on its own while the proxy routes logins, as described in Zero-downtime migration. It needs the proxy fields of the Source: detect step; without them the step warns Cutover: account-by-account cutover needs a migration proxy (Source step).
  • Whole domains by MX change (domain): all accounts of a domain move together when its MX record changes, as described in One-shot migration. This is the mode for hosted sources such as Microsoft 365 and Google Workspace.
  • Copy only, no cutover (none): Vandelay copies and verifies the data, and the operator moves users by other means.

The cutover mode is bound to the project once work is admitted, like the target and the source.

The remaining fields set the pace:

  • Switch automatically: switches each account as soon as its first copy is ready, instead of waiting for the operator. Starting a run with this setting in proxy mode asks Accounts switch to Stalwart as soon as their first copy is ready, without asking again. Run?
  • Hold logins for at most: the total time the proxy may hold an account’s new logins during its switch, at most 10 minutes.
  • Accounts copied in parallel and Threads per account (Advanced): how much work runs at once.
  • Delta passes: manual, or an interval such as 6h between delta passes until the switch. Catch-up passes after the switch (Advanced) does the same after it. Scheduled passes run only while a runner holds the project, as explained in Runner.
  • Stale delta after and Delta sweep lead time (Advanced): for domain cutover, how old an account’s last delta may be at the MX change, and how far ahead of it the checklist schedules the final sweep.
  • Max retries, Stop the idle runner after and Log level (Advanced): retries before an account needs a decision, the idle timeout of a background runner, and the detail of the account logs.

In proxy mode, Test the connection on this step tests the proxy: its management API, the token, both destinations and whether the mapping store accepts writes.

  1. Choose Cutover and set the pace fields; open Advanced for the rest.
  2. Click Save. In proxy mode, click Test the connection.
  3. Click Next to reach the Pre-flight screen.

Vandelay web UI: the Cutover strategy step with whole domains by MX change, four accounts in parallel and manual delta passesVandelay web UI: the Cutover strategy step with whole domains by MX change, four accounts in parallel and manual delta passes

Pre-flight checks the whole plan against the real systems before anything is written to Stalwart. Provisioning and copying are refused until a pre-flight has passed, and any change to the plan makes the last pre-flight stale, so it runs again after every edit. A refused action names the reason, for example the plan changed after the last pre-flight; run `vandelay migrate preflight` again.

The checks cover:

  • The target: reachability, the Stalwart version, the administrator’s permissions, whether the login is a superuser, and the upload and request limits that apply to it.
  • The source: a sign-in as selected accounts, with the reason when an account cannot be read, and a warning for each selected account that is disabled on the source, because a disabled mailbox often has no mail Vandelay can read.
  • The project: free disk space for the archives against an estimate from the source sizes, and the permissions of the project directory.
  • The plan’s consequences: how many accounts keep their password and why the others get a temporary one, shared mailboxes provisioned as groups, catch-all addresses, address conflicts, the migration proxy in proxy mode, the objects that provisioning will create, counted per kind with up to five names each, and “Items that cannot be migrated”, the inventory losses found by discovery, which the “Losses” table beside the checks lists one by one.
  • A dry run: a sample of selected accounts is read in full without writing anything, and each sample row shows what would be copied, for example [email protected]: Mailboxes 10, Emails 9, Sieve scripts 2.

A check with the status Error blocks provisioning and the run; warnings do not. The web UI and the TUI dry-run three sample accounts; the CLI’s --sample N dry-runs between 1 and 50, one after another, so each sampled account adds its own dry run to the time pre-flight takes.

From the Pre-flight screen, three actions move the project on. Create domains, lists and groups in Stalwart provisions the target objects without copying any data. Start copying the selected accounts starts the run described in the next section. Run the whole plan unattended chains discovery, selection, pre-flight, provisioning and the first copies in one go, and stops at the first stage that fails.

  1. Click Run the pre-flight checks. The page updates as each check completes.
  2. Fix every check reported as Error, save the step concerned, and run the checks again.
  3. Optionally, click Create domains, lists and groups in Stalwart.

Vandelay web UI: the Pre-flight screen after the checks: Stalwart and source checks passed, warnings for items that cannot be migrated and for temporary passwords, and the actions that start the migrationVandelay web UI: the Pre-flight screen after the checks: Stalwart and source checks passed, warnings for items that cannot be migrated and for temporary passwords, and the actions that start the migration

Starting the run copies the selected accounts. What a copy means depends on the cutover mode:

  • Proxy mode. Each account is read from the source into its local archive (Archiving, then Archived). Nothing is written to Stalwart for the account until its switch, so split delivery keeps relaying its mail to the source.
  • Domain and copy-only modes. The run provisions the accounts in Stalwart first (Provisioned), then reads each account and writes it into Stalwart (Copying, then Copied).

Delta passes then keep each account current until its switch, either on the schedule set in “Delta passes” or when the operator starts one. The copy is followed and controlled on the Run dashboard, described in Operations.

The run continues in the project’s runner when the front end that started it is closed or detached. In the web UI and the TUI the runner is embedded and stops when they stop; on the CLI, Ctrl-C detaches from a runner that another front end holds. Runner describes how long work keeps going in each case.

  1. On the Pre-flight screen, click Start copying the selected accounts, or Run the whole plan unattended.
  2. Open Run dashboard to follow the copy.

Vandelay web UI: the Run dashboard after the first copy: six accounts Copied and 92 MiB of copied dataVandelay web UI: the Run dashboard after the first copy: six accounts Copied and 92 MiB of copied data

The cutover moves users to Stalwart, and it is the step that cannot be undone. Its procedure depends on the mode:

  • In proxy mode, accounts are switched from the “Cutover: proxy, account by account” screen, a few at a time or all at once. Each switch runs the steps described in Account switch. Before the first switch, the proxy, the source and Stalwart must be prepared as Zero-downtime migration describes.
  • In domain mode, each domain is moved from the “Cutover: domain checklist” screen, which runs a final delta sweep, waits for the operator to change the MX record and confirm it, and then switches every account of the domain. One-shot migration describes the checklist.
  • In copy-only mode, there is no cutover; the accounts go straight to verification. Both cutover screens say so, with This project only copies and does no cutover (Cutover: Copy only, no cutover), so there is nothing to switch here.

A switch, like the MX confirmation, asks for a confirmation that names the number of accounts, as described in Confirmations. The switch also offers a confirmation that temporary passwords were delivered; it is optional, so the passwords must reach the users before the switch is started.

In proxy mode, open Cutover: proxy, account by account, select the accounts, tick The temporary passwords were delivered to the users when it applies, and click Switch now.

Vandelay web UI: the Cutover: proxy, account by account screen of a proxy-mode project: six accounts ready to switch, all selected, and the Switch now formVandelay web UI: the Cutover: proxy, account by account screen of a proxy-mode project: six accounts ready to switch, all selected, and the Switch now form

In domain mode, open Cutover: domain checklist, enter the domain, and use Delta sweep before the MX change and Confirm the MX change.

Vandelay web UI: the Cutover: domain checklist for example.org and example.com: every account has a recent delta, the MX change is still to doVandelay web UI: the Cutover: domain checklist for example.org and example.com: every account has a recent delta, the MX change is still to do

Verification compares each account’s archive with what Stalwart holds, item by item for a sample or for every item, and gives a verdict of “Passed”, “Passed with warnings” or “Failed”, with a detail line per data type, such as Emails: 3 missing on the target, 1 refused by the target. It runs at the end of every switch; in copy-only mode, or to check again with full depth, it is started by hand. A failed verify leaves the account waiting for a decision: a catch-up pass and a new verify, or accepting the result. The “Verify and report” screen also lists every loss of the project under “Items that could not be migrated”, with the account and the reason.

Once an account is verified and needs no further deltas, closing it (Complete) marks it Completed. Vandelay cannot undo completing an account: it gets no more delta or catch-up passes, so Complete asks for the number of accounts it affects. Closed accounts are what the finish steps act on.

The details of verification, accepting results and the reports are in Operations.

  1. Open Verify and report. Choose “Sample” or “Full” and click Verify to verify the open accounts again.
  2. Review the “Verification” and “Losses” tables, and use Accept the verify result where a failure is understood.
  3. Click Complete (no more delta passes) for the accounts that are done, and confirm with the number of accounts.
  4. Download the reports from the “Downloads” block.

Vandelay web UI: Verify and report after a sample verify of a single-account project: the account Passed with warnings, its losses, and the Complete (no more delta passes) actionVandelay web UI: Verify and report after a sample verify of a single-account project: the account Passed with warnings, its losses, and the Complete (no more delta passes) action

Finishing removes what the migration left in place. By default it runs the two steps that can be repeated without loss: it sets the catch-all addresses held back for split delivery, and removes Vandelay’s address from Stalwart’s allowed IPs. Two more steps are offered unticked, because they cannot be undone: deleting the local archives of completed accounts, after which a later fix copies those accounts from the source again, and wiping the project’s secret store, which loses the temporary passwords in it. The allowed-IP and secret-store steps run only once no account is still open.

Once Finish has run and every account is closed, the migration is finished: the runner stops and the project opens read-only on Verify and report, with the report and the downloads still available. A finished project no longer opens its secret store, so download the temporary passwords before Finish if they are still needed; a store left in place is removed later with vandelay migrate secrets wipe.

Finishing the Vandelay project does not remove the settings made on Stalwart, the proxy or the source for the migration itself. For a zero-downtime migration they are listed in Finishing, and for a one-shot migration in One-shot migration. Each finish step can also run on its own, as described in Finishing a project.

On Verify and report, click Finish migration, tick the finish steps to run, and confirm with the number of accounts. Finish refuses to start with no step ticked. The results of each step appear on the same screen.