[support] Best practices for simple dev/prod site mirroring or staging?

Jubal jubal-drupal-20090418 at cheeze.org
Sat Apr 18 17:57:37 UTC 2009


I have slowly been going insane trying to find a coherent way to set up 
a simple mirroring setup for a staging vs. production site. I am really 
hoping someone out there has solved this problem in a general way, and 
can tell me how I can improve my process.

My requirements are:

Content creators use the production site (let's say www.domain.com) for 
adding and editing stuff.

I (as the developer) need to test modules and theme changes on a copy of 
the production site. In order to do so, I must have a relatively 
faithful snapshot of the production site at another hostname (let's say 
dev.domain.com).

I am also using the same MySQL instance, so the production and 
development databases must use different names.

So, I need to be able to mirror the drupal files AND database content 
FROM www.domain.com TO dev.domain.com. Obviously, some things in the 
database that are hardcoded with "www.domain.com" need to be changed to 
"dev.domain.com".

I also need to change the dbsettings.php file, and perhaps any reference 
in the db dump to the database name itself.

I've created a script that (1) dumps the production database, (2) 
effectively search-and-replaces any instance of "www.domain.com" to 
"dev.domain.com"  in the database dump, (3) NUKES any cache tables, and 
(4) restores the much-reduced dump to the dev database. Also (5), copies 
over the modules and files directories in a safe manner.

I'm now seeing generally weird behavior in the dev database. I'd really 
like to find out if there's a better way to do this. I am amenable to 
changing some fundamental things about my current approach.

Thanks in advance,

Jubal



More information about the support mailing list