Hi,
There's a thread on this mailing list from 2022 called "The end of Dovecot Director?". I lost that email, hence the new conversation. Sorry about that.
TL;DR: Is anyone else needing to migrate from Director interested in adding support for 2.x-style tags to the Lua script on https://doc.dovecot.org/3.0/configuration_manual/howto/director_with_lua/? Others on this list know Lua better than I.
Background:
Director is being removed from 2.4 (CE) / 3.x (Pro). After some notes from the community, the following manual entry popped up: https://doc.dovecot.org/3.0/configuration_manual/howto/director_with_lua/. It provides a Lua script that serves as a kind-of replacement for Director. It expects a list of backends, and maps users to a backend at connection time.
The gotcha is in the last sentence: "There are no built-in tools in Dovecot to manage the database (such as adding backends, kicking users, monitoring backends, etc.). You need to build your own tooling."
So, I built a CLI tool that provides the following functionality:
- CRUD backends.
- CRUD user-to-backend mappings.
- Health-checking backends (replacing
poolmon
). - Swapping backends (move all users on backend X to backend Y).
There's one to-do, though. Director had the concept of 'tags'. This is useful when one has multiple mail clusters, and users should be routed to a specific mail cluster. The Lua script does not know this concept. If a user does not have a mapping, it simply maps the user to any backend. Which could cause users to end up on the wrong backend.
Therefore, it would be useful to add tag support to the Lua script: add
user_to_tags
and tags
tables. Add a tag_id
column to the
backends
table. Let the Lua script create a mapping to a backend with
the same tag_id
as the user entry in user_to_tags
. Same logic as the
director_tag
passdb field (Director on 2.x). Alternatively, drop the
'tags' term: create a user_to_backends
table with a JSON column taking
multiple backend IDs (no foreign key relations = bad consistency).
Alternatively, one could ensure that the Lua script never creates a mapping itself by manually creating it before the user connects. Pretty fragile in the real world, obviously.
After this final to-do, I'd be happy to open-source my CLI.
With kind regards,
William Edwards