Ok. Assuming I dont have access to the source code of the said tool or don't want to change the code in that tool, what are my other options?From what I'm seeing, when I do consul lock on a foreground service on all 3 machines, it runs on the first machine and block on the rest..which means the lock is acquired by the first instance and not necessarily by the leader of the cluster (I thought that would be the case initially).Is there a consul command I can call to check if the current machine got the lock or not and wrap my service start call in a simple bash script that does something like if (consul lock-holder) { ./start.sh }
ATM, this seems to work very well (in my limited testing), except I can see there being one problem I am not sure how to address. Maybe @armon or other gurus will have feedback: The lock is ephemeral, and eventually it will be released.. even if my client does not explicitly release it (I set the timeout high in my example, 3600 seconds / 1 hour). Conceptually, I guess the solution is to retrieve a new lock before the existing one is released. Does Consul (or python-consul / consul-lock) have a recommended method for addressing this?