What's the best way to bring down an apache2/tomcat6 setup for maintenance? Specifically, apache2 can stay running, but tomcat needs to restart to accomplish a number of tasks. My initial thought is to change the root directory in the httpd.conf
VirtualHost
entry to point to a new location, then issue a force-reload
command to direct traffic away from the actual tomcat application. After some period of time, I perform tomcat maintenance, switch the VirtualHost
entry, and force-reload
to begin directing traffic back.
Is there a better way to do this? I'm looking to start work on a rather extensive web application, and my deployment procedure right now involves shutting everything down and bringing everything back up. Is there a better way to do this than what I've proposed?
It's either what you described above or if you have a load balancer and a second server somewhere you can re-route the traffic at the LB to point at the spare server (serving a static "Hey, we're doing maintenance! Come back later!" page).
The advantage of handling the maintenance window on a load balancer (or by IP-swapping the second server) is that you can test your Tomcat stack end-to-end before pointing live traffic at it again, which avoids unpleasant surprises where some bit of configuration from the dev environment snuck into production.
I see somewhere a rewrite to do so :
The IP 111.222.333.444 is your IP adress to access to your site. All other users will be redirect to 503 ErrorDocument. Put all of this in a .htaccess at the root of your virtualhost.
I don't know if it works with tomcat, but it works with static or PHP pages. Of course, Apache must be configured to read .htaccess file