mattermost-plugin-remind icon indicating copy to clipboard operation
mattermost-plugin-remind copied to clipboard

Remove dependence on os.Hostname

Open lieut-data opened this issue 6 years ago • 5 comments

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.

lieut-data avatar Aug 01 '19 18:08 lieut-data

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.

scottleedavis avatar Aug 02 '19 04:08 scottleedavis

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.

variablenix avatar Nov 26 '19 01:11 variablenix

Hi @variablenix , I have tested in a docker-compose 2 node HA setup with success, though it isn't documented anywhere.

scottleedavis avatar Nov 26 '19 20:11 scottleedavis

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 avatar Nov 27 '19 08:11 variablenix

@variablenix how did it go in the AWS env w/ALB?

scottleedavis avatar May 02 '20 17:05 scottleedavis