1

I am essentially trying to build is a poor mans server failover solution.

The non-profit organization I am part of is planning to host several web applications. In order to save on hosting costs we have decided to have the site hosted in-house. As a holdover until we can raise funds for a proper server room we have setup two desktop servers with virtual machines running the applications.

In terms of performance, the machines and the FiOS Business connection they are hosted on more than meet our current needs and they are in a colder dry area so cooling hasn't been an issue. The biggest problem going forward is a lack of any Battery Backup. The applications themselves are not mission critical and have been designed to be fairly robust and restore cleanly in the event of a power failure. However, our organization's website is also hosted on this server and is important enough to have some sort of redundant backup.

What I would like to build is a system where in the event of a power failure a UPS would provide emergency power to the servers and networking equipment and notify the servers of the power event. The servers would then make API calls to Amazon Route 53 DNS Service and reroute traffic away from the servers experiencing power failure and to a Heroku or Pagoda Box instance. These instances would run a Lite version of our website using content which is periodically pushed to them.

We are running a Linux environment. So how would a consumer-level UPS trigger a custom script on a power failure which puts the failover chain into effect?

LawrenceC
  • 73,030
  • 15
  • 129
  • 214
Dan
  • 11
  • 1
  • Unfortunately shopping questions are off topic, so as this stands the question will likely be closed. You may be better off asking "can I configure Linux Z to run a script when UPS make X model Y detects a power failure?", which is much more answerable. – user Aug 14 '13 at 12:58
  • 1
    Welcome to Super User. Edited out shopping recommendation. I shouldn't do this either but APC is a well-known brand (in U.S. anyway) and works well with Linux in my experience. One point to take away from this is that I don't believe there is a standard way for a UPS to communicate power events to a host. You will likely need to install software specific to the brand of UPS. – LawrenceC Aug 14 '13 at 13:08
  • A proper server room? Will it have redundant power, cooling, disks, network connectivity, 99.999% uptime, secure access, etc? Colo hosting might *appear* pricey, but you get what you pay for. – Keltari Aug 14 '13 at 19:15

1 Answers1

2

You can configure apcupsd to run a custom script whenever an APC-brand UPS detects a power failure or return of mains power (along with many other UPS-related events). Those scripts can then perform any other actions which you are able to automate.

APC has various offerings in different price ranges; if something like this is an important factor in your purchase, make sure to check compatibility before you purchase the UPS.

Of course, I'm sure there are other alternatives as well; this is just one possibility, and one that I have some personal experience with.

Also consider whether your ISP's network will be functional in the event of a large power outage. You may be able to provide emergency power to your own networking equipment, but that might not necessarily be sufficient -- if you don't have Internet connectivity, your attempts to make DNS changes will fairly obviously fail. Depending on your specific reliability needs, it may be worth considering some sort of "are you still online?" test running on a host external to your own network (which would also take care of the situation when e.g. someone cuts the cable either accidentally or intentionally) as a secondary fallback mechanism.

user
  • 29,449
  • 11
  • 99
  • 144