Tom Harrison
Tom Harrison

Reputation: 14018

How to stop Rails (close DB connection) with Apache still running

Rails 3 on Apache with Passenger: I need to take down Rails so that the DB connection(s) are closed -- this is necessary to perform some regular database maintenance -- but I want Apache up so that it can respond to requests with a static maintenance page.

I am using Capistrano and have seen the threads on how to invoke maintenance mode, but I need to know where to hook my DB tasks, and cannot figure out where.

Any links, or even pointers to where to look in the Capistrano code would be greatly appreciated.

TIA

Upvotes: 0

Views: 485

Answers (1)

Dylan Markow
Dylan Markow

Reputation: 124419

You can use capistrano's deploy:web:disable task to block access to your site, allowing you to do database maintenance, etc:

cap deploy:web:disable REASON="a Database Upgrade" UNTIL="in a few minutes"

Then, once you're done:

cap deploy:web:enable

Upvotes: 1

Related Questions