Database Reset, start fresh

Your question

I have been testing Stalwart for several weeks now using a test domain. I want to now reset the database, and remove all of the configuration options so I can start to reconfigure the mail server for my production domain. What is the best way to accomplish this if I am using the built in RocksDB?

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 cleanest way to start completely fresh with RocksDB is to stop the service, delete the RocksDB data directory, and restart so that Stalwart triggers the setup wizard again. Here is the full procedure:

  1. Stop the service (e.g. sudo systemctl stop stalwart on systemd Linux).
  2. Delete the RocksDB data directory. The default path is /var/lib/stalwart/ (the path field of your DataStore). Removing that directory wipes all stored data: email metadata, settings, user accounts, mailbox state, blobs, etc. Back up anything you want to keep first.
  3. Restart the service (sudo systemctl start stalwart). With no existing data present, Stalwart will present the setup wizard again on first boot at http://<hostname>:8080/admin, exactly as it did during the original installation. You can then go through the five-step wizard to configure your production domain from scratch.

Note: All four stores (data, blob, search, in-memory) default to the same RocksDB directory, so deleting that one directory clears everything unless you had configured them to separate paths.

References: RocksDB backend docs and the Bootstrap reference.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong. If you found it useful, mention @helpbot in any reply to ask follow-up questions and the bot will respond again.

@helpbot

I know deleting the database that would be mounted at /var/lib/stalwart is supposed to force Stalwart back to the bootstrap mode, but this is not what is happening. I deleted everything in the mounted volume (which for me is (/opt/stacks/stalwart/data:/var/lib/stalwart) in my docker compose yaml file, but when I access the /admin portal I am presented with the standard login prompt instead of the initial configuration wizard process.

@svandive Not 100% what triggers the initial setup wizard but you might want to delete the config file at /etc/stalwart/config.json if you didn’t already. Otherwise check your env_file.