Is there any way in Erlang to run only one instance of application on one physical server even if there multiple nodes started on this server? Trying to find Erlang in-box solution to ensure that application started once on physical server.
Got tested solution with system wide variable in environment. It works but there are ability to change it outside of Erlang and brake the logic. Is there any chance to use epmd for this case?
If the nodes are connected and thus can talk to each other using Erlang distribution, then you can implement whatever consensus protocol you want to ensure this. Both application and global have some support for this that may or may not fit your purposes.
As usual with distributed systems the devil is in the details, in particular race conditions and fault tolerance.
One method that comes to mind is to limit the node names. When starting the service, use the specified node name, and then check in the code whether the node name is a special one.