Implement automatic upgrades

Mostly just in theory right now, but at least there's the capability.
And now the site will (should) stop running if there's an upgrade.lock
file present.