nixos/stalwart-mail: rocksdb as default storage
This sets RocksDB as the default storage backend for `stateVersion` >= 24.11. For previous `stateVersion`s, the structured data and blobs remain on SQLite and the filesystem respectively. This is closer to the suggested upstream configuration for fully local storage.
This commit is contained in:
parent
0ef99565a9
commit
0174aa1c56
@ -23,6 +23,10 @@
|
||||
before changing the package to `pkgs.stalwart-mail` in
|
||||
[`services.stalwart-mail.package`](#opt-services.stalwart-mail.package).
|
||||
|
||||
- The `stalwart-mail` module now uses RocksDB as the default storage backend
|
||||
for `stateVersion` ≥ 24.11. (It was previously using SQLite for structured
|
||||
data and the filesystem for blobs).
|
||||
|
||||
## Other Notable Changes {#sec-release-24.11-notable-changes}
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
@ -7,6 +7,7 @@ let
|
||||
configFormat = pkgs.formats.toml { };
|
||||
configFile = configFormat.generate "stalwart-mail.toml" cfg.settings;
|
||||
dataDir = "/var/lib/stalwart-mail";
|
||||
useLegacyStorage = versionOlder config.system.stateVersion "24.11";
|
||||
|
||||
in {
|
||||
options.services.stalwart-mail = {
|
||||
@ -38,14 +39,22 @@ in {
|
||||
};
|
||||
queue.path = mkDefault "${dataDir}/queue";
|
||||
report.path = mkDefault "${dataDir}/reports";
|
||||
store.db.type = mkDefault "sqlite";
|
||||
store.db.path = mkDefault "${dataDir}/data/index.sqlite3";
|
||||
store.blob.type = mkDefault "fs";
|
||||
store.blob.path = mkDefault "${dataDir}/data/blobs";
|
||||
store = if useLegacyStorage then {
|
||||
# structured data in SQLite, blobs on filesystem
|
||||
db.type = mkDefault "sqlite";
|
||||
db.path = mkDefault "${dataDir}/data/index.sqlite3";
|
||||
fs.type = mkDefault "fs";
|
||||
fs.path = mkDefault "${dataDir}/data/blobs";
|
||||
} else {
|
||||
# everything in RocksDB
|
||||
db.type = mkDefault "rocksdb";
|
||||
db.path = mkDefault "${dataDir}/db";
|
||||
db.compression = mkDefault "lz4";
|
||||
};
|
||||
storage.data = mkDefault "db";
|
||||
storage.fts = mkDefault "db";
|
||||
storage.lookup = mkDefault "db";
|
||||
storage.blob = mkDefault "blob";
|
||||
storage.blob = mkDefault (if useLegacyStorage then "fs" else "db");
|
||||
directory.internal.type = mkDefault "internal";
|
||||
directory.internal.store = mkDefault "db";
|
||||
storage.directory = mkDefault "internal";
|
||||
@ -59,8 +68,10 @@ in {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "local-fs.target" "network.target" ];
|
||||
|
||||
preStart = ''
|
||||
preStart = if useLegacyStorage then ''
|
||||
mkdir -p ${dataDir}/{queue,reports,data/blobs}
|
||||
'' else ''
|
||||
mkdir -p ${dataDir}/{queue,reports,db}
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
|
Loading…
Reference in New Issue
Block a user