I'm writing a deployment script that works like this:
Copy the current document root
site.currentin a new folder at the same level.
Update the new folder. Meanwhile, visitors still see the current site.
- When it's ready, switch folders :
The only problem is that there is no way to make this switch atomic. It's therefore, in theory, possible that someone (visitor or web crawler) tries to access the website during the few milliseconds where the document root
site.current doesn't exist.
- Given that I have roughly 1000 unique visitors per day, should I consider highly unlikely that anyone ever happens to visit at this precise moment, and stop worrying about it?
- Apache seems to raise a 500 error when the document root doesn't exist. I figured it's better than a 404 for web crawlers, hence not penalizing SEO. Am I right?
Note: I have already spent countless hours trying different methods (from RewriteRules to ErrorDocuments to MultiViews) to display a maintenance page to the user if the document root isn't there, so this isn't the point of my question. I'll be glad to hear a new solution as a comment, but now I highly doubt there is (especially given that I can't edit my vhost config, only .htaccess files).
Note 2: I'm not using a symlink switch (that would be atomic) because Apache uses some sort of cache on symlinks, and I can't install
mod_realdoc to fix the issue.