Setting up Sandbox?

Hi: I’m curious about the ways people out there have dealt with the “sandbox” issue. I’ll be delving into setting up Drupal for myself and another person, and I want the ability to be developing on a sandbox while the live site is unaffected. Also, when the time comes to reveal the new features, is there an easy way to do this?

Here’s some other things I’m wondering:

  • Do people usually use subdomains for this purpose? If so, does the subdomain have its own DB that is a copy of the live one? How would the switch take place when you wanted to release the next version? Is it a control panel DNS bit where you can just switch the pointers?

  • I have alternate registered domains that I could play with, and use as a sandbox, but again the issue is that I wonder if I need to copy everything over (and if so, how is that done), or can I just do a switch?

thanks a lot for any comments about how you handle this.

Personally, I’d use a subdomain with an unusual name, not or a regular domain – you don’t want people stumbling onto your test site and messing with it.

Basically, when you set up a subdomain (or a regular domain, for that matter) you can choose what directory inside your home dir it will point to. By default this will be something like – but you should point it to or something like that (or however you want to organize it). Then set up a second database with a name that also makes sense in production later – this isn’t connected directly to your domain either, you can name it appv2 and give it a secure user/password (not just test/testpw since you’d have to remember to change that later!).

When the day comes to roll out the new version, it’s easy:

  • Deactivate the subdomain
  • Point the real domain to that version2 directory

That’s it! You don’t even have to touch the database (besides clearing out your test data), since you didn’t name it “test” in the first place.

Thanks, J. Excellent advice, very clean. Also, wrt to names, I could password protect the root dir of the subdomain just to be safe, right? Then, when switching happens, just remove the pw protection.

I have one other question though… in using Drupal, I’m concerned about how to merge the two databases so that I don’t lose any user-contributed content but can still upgrade to the new features. Since I haven’t done this before, I think my clue is in the fact that you mentioned “clearing out test data.” I’m thinking there’s a way to dump user-contributed/new data from the production db to a file that I can import to v2 DB before the switch? thanks again, -patricia

Oh, right – I forgot about importing the old user data.

I don’t know enough about Drupal in particular to answer properly… but I’m guessing they have a script that will upgrade your old production DB to work properly with the newer version. Check the upgrade instructions before you decide how to proceed.

If you aren’t comfortable mucking around in the database (and figuring out which tables you’ll need to backup/alter/etc. for a manual merge) the safest approach might be to start out your version2 with a copy (export prod DB, import to empty version2 DB) of the production database – then run the Drupal upgrade script, and document the configuration changes you make after that (since those will likely also be stored in the database). When you’re done testing and are happy with your setup walk-through, the go-live process would be to stop production, and recreate the version2 setup, running the same steps (with the databse import and upgrade, and config). It’s a little more work than my previous suggestion, but you still get to practice the conversion, test the new version, and easily revert back to the old version if things get ugly.

Drupal might even offer a method for exporting/importing just the user data, which would make this all easier – ask on their forums about it.

Ah, this is great info. I never thought about the idea that the upgrade script could help me with my own versioning, but only thought of it as a tool to upgrade different versions of Drupal itself. I will definitely check it out.

I’m thinking maybe a wiki on this would be helpful others…I’m going to try to copy this stuff and clean it up and put it out there for others! Thanks!