During the running of my OpsWorks deploy recipes, there is a period of time when the app needs to be inaccessible by the public. Is there a recommended way to achieve this?
It's a Magento site, and I created two recipes. One to create maintenance.flag
and one to delete it again. This tells Magento to serve a holding page with an HTTP 503 response code.
Two problems with this:
- Since I'm running the recipes at the start and end of the custom recipes, the maintenance mode is only in place for a few seconds - not long enough.
- Serving the 503 from the app servers is probably the wrong way to go. It'd be better to switch to maintenance mode on the load balancer, probably? Otherwise the load balancer (and OpsWorks?) will see the app instances as offline.
Is there a way to run my maintenance mode recipe before the code is pulled from git, or immediately after? Or some way to use an undeploy
recipe? Or something better?