mattermost-plugin-remind
mattermost-plugin-remind copied to clipboard
Remove dependence on os.Hostname
The current code depends on os.Hostname, presumably to avoid multiple servers in a high-availability environment from triggering the same reminders. Unfortunately, this assumes the hostnames are both stable and unique, which may not be true in a k8s/containerized environment.
Using KVCompareAndSet, it should be possible to use a special key value as a cluster-wide mutex for any plugin instance to claim the right to trigger reminders. If all plugins did this on their periodic poll, it would enable any instance to service any reminder without worrying about dual processing. This will be even easier to model with https://github.com/mattermost/mattermost-server/pull/10960, since we can let the lock "expire" automatically vs. having to manage that part ourselves ala the nps plugin.
It is good to know that hostname isn't a stable/unique solution for HA. I had only tested a two node cluster with docker containers in prep for running on community.mattermost.com with success, and I appreciate the broader view.
KVCompareAndSetWithExpiry looks appealing and easy, and as it is slated for v5.16.0 , I will pick this ticket back up as that release gets closer.
Does the current release of the plugin support HA in a non-k8 environment? I looked around and didn't really find info confirming that remind can operate in a 2-node HA environment without duplicate reminders across both nodes.
Hi @variablenix , I have tested in a docker-compose 2 node HA setup with success, though it isn't documented anywhere.
Hi @scottleedavis. That is great to know. For context I will also be testing this in a 2-node AWS environment with an ALB. I will report back. Thank you for Reminder bot!
@variablenix how did it go in the AWS env w/ALB?