It looks like:
- Redis would be the most stable coordination layer for distributed systems (still)
- Writing a lockfile is an option
- One implementation ([proper-lockfile](https://www.npmjs.com/package/proper-lockfile)) uses `mkdir` and changes the last modified date periodically to demonstrate that the process is still running. Consumers can consider a lock stale if the modified date isn't updated in enough time
- Requires some coordination but is a straightforward implementation
- A dedicated lock/unlock broker is another option
- [live-mutex](https://github.com/ORESoftware/live-mutex) is a locking broker that works over [[Unix Domain Sockets]] and TCP. The broker can be included in one of the existing client processes or can be run as a standalone server process.