komlenic / drubs

A command-line tool tool for building, deploying, and managing Drupal sites across multiple servers and environments.
http://drubs.org
GNU General Public License v2.0
0 stars 0 forks source link

Explore methods of disabling site during build #10

Closed komlenic closed 8 years ago

komlenic commented 8 years ago

It has been observed previously that it is possible for a user to visit a site during the course of a build and see a partially built site, or (in the case of the users table and auto-creation of users) even interfere with the successful building of the site.

We don't necessarily need to require Apache in order to achieve this, however the easiest method seems to be placing a .htaccess file into the site_root. This has the disadvantage of not really disabling the site for the whole build, indeed, after drush make is run, the .htaccess file is overwritten with the new one.

A second thought would be changing the permissions or ownership temporarily of the site_root location such that the build can complete, but such that apache refuses to serve the site. This may also even have the advantage of working under different webservers... nginx etc.

Neither of these solutions are ideal (though if the second is possible, it may suffice).

komlenic commented 8 years ago

Third option: build site in something like env.node['site_root']/tmp and then move/rename/copy to actual site root dir... this doesn't feel awesome, and has the potential to create additional problems with pathing etc?

komlenic commented 8 years ago

The most graceful solution so far appears to be to set AccessFileName in apache like so:

AccessFileName .htaccess.drubs .htaccess

... which will of course parse a file named .htaccess.drubs if present, before parsing a normal .htaccess file.

So, if drubs can place a file named .htaccess.drubs into the site root location, containing redirect/rewrite directives (503 Header is best), then the site can be made unavailable during a build. At the end of the build, simply removing this file re-enables the site.

This also has the added benefit of not failing if a node is not configured with the AccessFileName directive as shown above -- the site will simply continue to be available during portions of the build.