Wizard-skip via CLI-only deploy

Your question

For a v0.16.6 deployment automated via configuration management (Ansible) where I want to skip the interactive /admin setup wizard entirely, can I pre-populate everything (admin Account, Domain, SystemSettings including defaultDomainId and defaultHostname, NetworkListeners, Certificates) via stalwart-cli apply --file plan.ndjson while running with STALWART_RECOVERY_ADMIN authentication? Does the wizard perform any irreplaceable steps not exposed via stalwart-cli apply?

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

The answer is yes, and the docs explicitly describe exactly this pattern.

The wizard performs no irreplaceable steps. Everything the wizard does is accessible through the JMAP API / stalwart-cli apply. The documented fully-automated workflow is:

  1. Write config.json onto the host - it only needs to contain the DataStore object pointing at your database.
  2. Start Stalwart with STALWART_RECOVERY_MODE=1 and STALWART_RECOVERY_ADMIN=admin:<password> (from your secrets manager). This suspends all mail services and exposes only the management API on port 8080 (configurable via STALWART_RECOVERY_MODE_PORT).
  3. Run stalwart-cli apply --file plan.ndjson against the recovery listener to load your full configuration - accounts, domains, SystemSettings (including defaultDomainId / defaultHostname), NetworkListeners, Certificates, etc.
  4. Restart without the recovery variables to bring the server up in normal operation.

From that point forward, every subsequent change is another apply against the running server. The STALWART_RECOVERY_ADMIN credential also works against a normally-running server, so you don’t need to cycle through recovery mode for post-initial changes.

One thing to be aware of: apply is not inherently idempotent for create operations. To make your plan re-runnable, prefix each create block with a matching destroy for that object type (which is the shape stalwart-cli snapshot emits). On re-runs, the destroy pass clears existing objects and the create pass rebuilds them.

Relevant docs:

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.