API Ensure that flush and dev/build are performed correctly on multi-node instances

In environments (such as a 3-node cluster) DB operations should not be performed on all nodes simultaneously. This fix uses :once to limit this to one server, but ensures that all servers are still adequately flushed.

This fix was made a while back in a development branch in the old deploynaut repo but wasn't finished.