I use the machine name as MY_ID
, so the scripts on all the servers are identical. Each server has two shortcuts, one that pulls from the git repository and one that runs the uplink script.
I also have 3 uplink servers intended to manage long running (hours) processes responding to the same function call. In this case the 3 servers register the function with the same name, and the last one that registers the function responds to the call. The callable function creates a file on a network drive and returns the control to the Anvil server immediately. Then all the three servers keep polling the network file every half second, and the first that finds the file starts the process.
I could have done the Anvil server adding a row to a queue table and the three servers polling the table every half second, but it felt like too much traffic.
The three scripts do poll the table once a minute, just in case the registered callable function is not responding, and if they find there is a pending row on the queue table when the network drive file does not exist, they send me an email so I can stop and restart one of them.
This solution is easily scalable: I can add uplink servers without changing anything.