UPGRADING/v0_15.md
v0.14.x to v0.15.xStalwart v0.15.x introduces breaking changes to both the database schema and some configuration options.
Upgrading to this version requires a schema migration, which is performed automatically when Stalwart starts for the first time on v0.15.x.
Because this migration modifies how data is stored and indexed, it is important to understand what will change, what will be migrated, and how the upgrade may impact your deployment—especially for larger installations.
Version 0.15.x introduces significant internal improvements focused on performance, storage efficiency, and accuracy:
The migration process runs automatically at startup and will migrate the following data:
NUM_THREADS=<number>Note: If you do not require any of the features introduced in
v0.15.x, consider waiting for the next major release, which will introduce a proxy-based architecture allowing zero-downtime upgrades.
Stop Stalwart in every single node of your cluster. If you are using the systemd service, you can do this with the following command:
$ sudo systemctl stop stalwart
Backup your data following your database system's instructions. For example, if you are using RocksDB or SQLite, you can simply copy the data directory to a backup location. If you are using PostgreSQL or MySQL, you can use the pg_dump or mysqldump commands to create a backup of your database.
Download the latest binary for your platform from the releases page and replace the binary in /opt/stalwart/bin.
Start the service. In a cluster, you can speed up the migration process by starting all nodes at once.
$ sudo systemctl start stalwart
Stop the Stalwart container in every single node of your cluster. If you are using Docker, you can do this with the following command:
$ docker stop stalwart
Backup your data following your database system's instructions. For example, if you are using RocksDB or SQLite, you can simply copy the data directory to a backup location. If you are using PostgreSQL or MySQL, you can use the pg_dump or mysqldump commands to create a backup of your database.
Pull the latest image and restart the container:
$ docker pull stalwartlabs/stalwart:latest
$ docker start stalwart
After the upgrade and migration complete, several follow-up steps are required or recommended:
Upgrade the webadmin: Upgrade the webadmin interface by navigating to Manage → Maintenance → Update Webadmin
Update the spam rules: Download and apply the latest spam rules from the webadmin Manage → Maintenance → Update Spam rules
Update search settings: Review the updated documentation for search settings, as some configuration options have changed. In particular, the Elasticsearch backend now uses different authentication settings than previous versions.
Rebuild search indexes: All search indexes must be rebuilt to take advantage of the new indexing strategy. This can be done from the webadmin interface Manage → Maintenance.
Recalculate disk quotas for all accounts: This step is not required immediately, but it is recommended to perform it at some point after the upgrade. The new version includes additional metadata in quota calculations, so recalculating ensures accurate disk usage reporting.
$ curl -X DELETE https://myserver.org/api/store/quota/<account_name> -u <admin_user>:<admin_pass> -k
Delete deprecated spam classifier keys: Remove deprecated spam classifier keys from the memory store. These are the keys starting with the integer prefixes 12 to 16 and 17 to 18:
If you are using Redis:
$ for code in {12..18}; do
char=$(printf "\\x$(printf '%02x' $code)")
redis-cli --scan --pattern "${char}*" | xargs -r redis-cli DEL
done
If you are using your database as the in-memory store:
$ /opt/stalwart/bin/stalwart --config /opt/stalwart/etc/config.toml --console
Stalwart Server v0.15.2 Data Store CLI
> delete y\x0c\x00 y\x12\xff
> delete m\x0c\x00 m\x12\xff
> exit
If you are using your database as the in-memory store with Docker:
$ docker stop stalwart
$ docker run -it --rm \
-v <STALWART_DIR>:/opt/stalwart \
--entrypoint /usr/local/bin/stalwart \
stalwartlabs/stalwart:latest \
--config /opt/stalwart/etc/config.toml --console
Stalwart Server v0.15.2 Data Store CLI
> delete y\x0c\x00 y\x12\xff
> delete m\x0c\x00 m\x12\xff
> exit
$ docker start stalwart
If the migration process is interrupted or stopped, it can be resumed automatically by simply restarting Stalwart.
Data corruption detected errorIf you see an error message similar to: Data corruption detected. This indicates that another node wrote data using the old format while the migration was in progress. This usually happens when the cluster was not fully stopped before starting the upgrade.
In order to resolve this issue, follow these steps:
v0.15.x.If the migration does not resume because the node responsible for it already marked it as completed, you can force migration using environment variables:
FORCE_MIGRATE_QUEUE=4FORCE_MIGRATE_BLOBS=4FORCE_MIGRATE_ACCOUNT=<account-id>FORCE_MIGRATE=4Use these options with care and only when necessary.