migrate commands
vandelay migrate runs every part of a migration from the command line. Its commands fall into four groups: the step commands that set the plan, the action commands that start work in the project’s runner, the commands that report on the project, and a few maintenance commands. vandelay migrate <command> --help prints the options of each command, and the web and terminal interfaces show the step command that reproduces each form step.
Global options
Section titled “Global options”Every migrate command accepts these options:
| Option | Meaning |
|---|---|
--project <DIR> | The project directory; the current directory when omitted |
--key-file <FILE> | Unlock the secret store with this key file instead of a passphrase |
--color <WHEN> | auto, always or never; auto colours terminals only and honours NO_COLOR |
Without --key-file, the secret store is unlocked with the passphrase in VANDELAY_SECRETS_PASSPHRASE, and otherwise the passphrase is asked on the terminal. A key file holds 32 random bytes in base64, and Vandelay does not create one; any tool that produces them will do:
head -c 32 /dev/urandom | base64 > /root/acme.keyA store created with a passphrase cannot be opened with a key file, and the other way round.
Step commands
Section titled “Step commands”The step commands create the project and set its plan. Each sets the fields of one step, and prints the step’s current values and the equivalent command when run without flags:
| Command | Step |
|---|---|
init --scope server|account | Start: create the project with its scope |
target | Target (Stalwart) |
source | Source: detect and Source: access, including the proxy |
select | Accounts, or Account in account scope |
options | Data to migrate, Provisioning and passwords, Cutover strategy and its advanced settings |
set <key=value>... | Any plan key, by its name in the plan file |
account-set <address> <key=value>... | A per-account override |
plan reload, plan discard | Apply or discard a hand edit of plan.toml |
Two commands help to fill the source step. detect <domain-or-address> probes the domain and pre-selects the fields it can, and --target probes for the Stalwart target instead. test target, test source and test proxy connect with the current plan and print one line per check, and exit with 1 when any check fails.
Action commands
Section titled “Action commands”Action commands start work in the project’s runner, and follow the tasks they started until they end, printing their progress. When no runner holds the project, the command runs one for its own work; Ctrl-C then asks it to stop after the current step, and a second Ctrl-C exits at once. When a web or terminal interface holds the project, the command hands its request to that runner, and Ctrl-C only detaches, leaving the work running. Runner describes both cases.
| Command | Action |
|---|---|
discover | List the accounts, domains, aliases, groups and lists of the source |
preflight [--sample <N>] | Run the pre-flight checks, with a dry run of N sample accounts (1 to 50) |
provision | Create the domains, lists and groups on Stalwart |
run | Start copying the selected accounts |
run --retry-failed | Retry failed accounts |
run --rerun | Copy the named accounts again from scratch, before their switch; needs --accounts or --all |
run --plan <FILE> | Load a plan into the project, creating the project when needed, and run the whole migration unattended |
delta | Copy what changed on the source since the last pass |
delta --sweep --domain <D> | Bring every account of a domain up to date before its MX change |
pause, resume | Hold or release accounts |
stop [--wait] | Stop the runner after the current step of each task |
switch [--passwords-delivered] | Switch accounts to Stalwart through the proxy |
retry-step | Retry the failed step of a switch |
continue-anyway | Continue a switch past a failed step where this is offered |
skip, unskip | Leave accounts out, or take them back in |
cutover-check [--domain <D>] | Show the MX checklist of a one-shot migration |
cutover-check --confirm-mx --domain <D> | Confirm a domain’s MX change and start its final pass |
verify [--full] | Compare accounts between their archive and Stalwart, on a sample or in full |
accept-verify | Accept a failed verification |
complete | Close accounts: no more delta or catch-up passes |
finish [--only <STEPS>] | Close the project: catch-all addresses, allowed IP, archives and the secret store |
--only takes a comma-separated list of the finish steps catch-all, allowed-ip, archives and vault. Without it, finish runs only catch-all and allowed-ip, the two steps that can be repeated without loss. complete, accept-verify, retry-step, switch and finish ask for the number of accounts they affect, as described below. Operations describes when each action is used.
A plain run also retries, once per run, the failed step of each account whose switch stopped on a failure, as retry-step does; it never continues past a failure.
Account selection
Section titled “Account selection”Actions that apply to accounts take --accounts <ADDRESS>,... or --all. An address can be prefixed with source: or target: to match only that side when a source address and a target address are the same. run, run --retry-failed, delta, pause, resume and verify apply to the open selection when neither is given; the other actions require one, and are refused with <action> needs --accounts or --all.
Confirmations
Section titled “Confirmations”Actions that cannot be undone, or that apply to many accounts at once, ask for confirmation: switch, continue-anyway, retry-step, cutover-check --confirm-mx, run --rerun, finish, complete and accept-verify. On a terminal, the command shows the number of accounts it will act on and asks for that number to be typed. Without a terminal, it prints a token and exits with 1:
type 3, the number of accounts this action affects, to confirm; add --confirm 3:<token>For switch, the line also says Vandelay cannot undo a switch once its first step has run before the --confirm hint, and for cutover-check --confirm-mx it says Vandelay cannot undo the MX change once it is confirmed.
Running the command again with --confirm 3:<token> confirms it. The token is derived from the action and the state of each account it applies to, so it stops matching as soon as the set of accounts changes, and the command then asks again. A bare count is refused with a bare count is not a confirmation: run the command without --confirm and pass back the N:TOKEN it prints.
Report commands
Section titled “Report commands”These commands read the project and change nothing:
| Command | Output |
|---|---|
status [--json] | The runner and the state of every account and domain |
inventory [--format csv|json] | The discovered accounts |
inspect --account <ADDRESS> [<TYPE>] | The contents of an account’s archive |
report [--format json|html] | The migration report, with copy results, verification and losses |
export-users [--format csv|json|ldif] | One row per account, group and list, for a mail merge or an identity provider; LDIF needs --base-dn |
export-temp-passwords | The temporary passwords, in a file encrypted with age |
audit | The audit log, as JSON lines |
guide <NAME> | A setup guide, as Markdown |
Reports and exports are written to the project’s reports/ directory, named after the time they were made. export-users --include-temp-passwords adds the temporary passwords to the user list; keep such a file private. export-temp-passwords asks for a passphrase of at least 12 characters, or reads it with --passphrase-file, and the file opens with age -d. The guide names are dovecot-master, docker-mailserver, iredmail, mailcow, modoboa, mailu, mail-in-a-box, zimbra, exchange, m365, google, imap, csv, stalwart-source, proxy, split-delivery and mail-merge.
Maintenance commands
Section titled “Maintenance commands”secrets unlock unlocks the secret store of a runner that is already running, such as the runner of a web interface started without a passphrase. secrets wipe destroys the store, also on a finished project; the vault step of Finish does the same. After either, on a project that is not finished, the next command that starts a runner creates a new, empty store and asks for a new passphrase.
Finished projects
Section titled “Finished projects”A finished project is read-only, and no runner starts for it. inspect, report and export-users still work, without a passphrase, and stop stops a runner that is still running. export-temp-passwords works as long as the secret store was not wiped, because the passwords are read from it. Every other command, including test, secrets unlock, plan reload, plan discard and any command with --plan, fails with Migration finished: this project is read-only. No secret store is created for a finished project.
Exit codes
Section titled “Exit codes”Every command exits with one of these codes, shared with the per-account import and export commands:
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Usage error, invalid plan, refused or unconfirmed action, or a failed test |
| 2 | Connection failure, including TLS failures and an unreachable proxy |
| 3 | Account error, such as an unknown account or a proxy lockout |
| 4 | The source changed in a way that source-change protection refuses |
| 5 | Partial result: some items failed, or accounts wait for a decision; running again retries |
| 6 | A prune was aborted |
| 7 | Archive, project or I/O error |
| 8 | Interrupted, or the runner was stopped with work left; running again continues |