I've struggled with the best way to establish dev, stage and prod too http://groups.drupal.org/node/24196. I like the idea of specify environment specific variables via a module, but I think for this module to be useful it will need a way to modify/override the definitions in both .htaccess and settings.php. The module would need to facilitate management of the RewriteCond, and RewriteBase and error logging levels in .htaccess and the database connect strings in settings.php. I think the ultimate solution would also allow for migration of db tables from one environment's db to another as well.
The big hangup I have is if the environment settings are stored in the database how do those settings get shared across environments not using the same database?
Comments
Comment #1
jerodfritz commentedAfter looking at the code i see the environments are defined via a hook and not stored in the database, but I would still like to see a way to alter the settings.php and .htaccess files.
Comment #2
thebuckst0p commentedThanks jerodfritz, that's definitely the direction I'd like to go in. A prerequisite for settings.php overrides would be knowing which environment/site you're in, so this lays the groundwork for that. (In that sense Envts is currently just an API.) The module should definitely have a UI which stores the sites in the DB, and it should (at the very least) allow a line to be added to settings.php to invoke Envts-generated settings. You're welcome to code these additions if you'd like! My time is limited so it'll be a while until I can add them.
Comment #3
jerodfritz commentedI check into the possibility of writing settings.php or .htaccess from a module and this is not possible, nor is allowing a module to specify a specific db connect string during the bootstrap. Drupal does allow you to specify multiple databases, but that would need to have those db connect string entered manually in settings.php file http://drupal.org/node/18429.
I'm thinking for a module project to really aid in achieveing dev, stage and prod it needs three things at minimum to work:
I'll work up a usage scenario and post it when I get a spare minute.
Comment #4
thebuckst0p commentedThe purpose of Envts for now isn't to manage deployment between multiple environments, but rather to manage content between the environments, and more generally to have code- and user-level context awareness of each environment. (I'm going to add this last sentence to the project page.)
Even for the limited function just mentioned, however, the module is currently a barebones API, to be expanded upon for various use cases. I'm interested in hearing what use cases people have; controlling .htaccess and settings.php are two excellent ones which you've brought up. I think asking savvy users to add an
includeline in their settings.php files might be the best way to go about that. And I think securesite that overrides .htaccess somehow, so I need to look into that.The next step before these is probably a UI module, I think. And finishing the TODO's in the current revision. (I have a day job too, like yourself I assume, so my time to do this is limited.)
- Ben
Comment #5
thebuckst0p commented