ERPNext Two production setup

We’re having erpnext production setup in our machine, but the issue is it is getting down for various reasons like power cut, system overload, network disconnection etccc

So we are planning to have two setups one on the machine and another one in the cloud, the machine is primary and in case of any failure the cloud one automatically has to work, the main goal is to sync the database Incase primary machine goes down the secondary(cloud) has to run with recent data(base).

Have any of you guys done like this? or do I need to do something different?