6197 comments
2357 subscribers
Follow me on Twitter (@sachac)
Subscribe! Feed reader E-mail

Drupal: Testing multisite/domain-access Drupal locally and on a testing server

We’re using Domain Access to manage a number of related subdomains on a single server. I prefer to develop and test locallly, then push my changes out to a testing server so that other people can try the system. I use the same domain names on my computer and on the test server so that I don’t have to make any changes in the database. To switch between them, I comment or uncomment a line like

127.0.0.1 example.com sub1.example.com sub2.example.com

in my /etc/hosts file.

However, Firefox caches the domain name information, and it can be confusing to figure out which server I’m on. The following setup makes this much easier:

  1. Install Domain Details to show the IP address of the server in your status bar. Good for a quick check – am I on 127.0.0.1 or elsewhere? (NOTE: I started with ShowIP, but it looks like ShowIP caches the information.)
  2. Install the Clear Cache Button extension.
  3. Restart your browser and customize your toolbar. Add the Clear Cache button. Click on this before switching sites.

In an ideal world, I’ll have a plugin that automatically twiddles my DNS entries, too. =)

Short URL: http://sachachua.com/blog/p/4974
  • http://bmannconsulting.com Boris Mann

    You could also manually edit your settings.php to override local settings. For instance, you could set the footer variable to echo the IP….

    I always edit the settings.php to set the site name to ” BETA”

  • http://sachachua.com Sacha Chua

    Oh, that’s even better. =) Thanks for the tip!

  • http:/malvese.com/ elv

    I usually use a different favicon for local/test/live sites. I add a 2px red border for the local site, an orange one for the test site, and the regular favicon for the live site.

  • http://notreallypeople.com Devlon Duthie

    Throw in some sym links for different sub-sites, or even different versions of modules and themes and local development is a dream.

  • http://jazzymarketing.com drupal rocks

    hi, I would like help on how to best to do all development on remote server as I use multiple pcs and web access is not an issue.

    say i have 3 sites I am working on, I would like to do all testing and design on one test domain and then move them to the appropriate domain when done.

    mainsite.com/site1
    mainsite.com/site2
    mainsite.com/site3

    then when the sites are ready to go live

    site1.com
    site2.com
    site3.com

    issues I run into are relative hyperlinks breaking due to site sturcture being different on test vs live.

    Any ideas would be much appricated.

  • http://sachachua.com Sacha Chua

    Always use url(..) for hyperlinks instead of hardcoding them directly.

    Also, you can make your test environment more like your production environment by using domain names. For example, I like mapping qa.site1.com, qa.site2.com, and qa.site3.com to my test environment. Use Apache virtual hosts to make this happen.

  • http://jazzymarketing.com drupal rocks

    Hi Sacha,

    thanks for the info. I also found this drupal module that helps with deployment – aptly name http://drupal.org/project/deploy

    checkout this youtube video
    http://www.youtube.com/watch?v=7PjwT0HWHxw

  • http://sachachua.com Sacha Chua

    Yup! Greg Dunlap was telling me about Deploy at DrupalCon 2009. It’s good stuff too, and something you can probably use along with this everything-in-code approach. =)

  • Wai Wong

    I’m planning to learn domain access module. Do you know of any good source or info on how to set it up?

    thanks

On This Day...

  • 2012: Things I would like to see fixed — I brainstormed a list of things I would like to see fixed. Of this list, there are probably quite a [...]
  • 2011: Starting piano again — J- and I have started piano lessons at a nearby music school. The teacher evaluated her as Grade 3-4, and [...]
  • 2010: Technology evangelists: What we do, how to find and hire one, how to become one — I had a great chat with Simon Law yesterday about technology evangelism. A startup approached him looking for a tech [...]
  • 2009: Weekly review: Weeks ending July 12, 2009 and July 19, 2009 — So behind! Catching up… From the previous week’s plans: travel to Ottawa for planning meeting sort out more Transition2-related bugs July 6-12: Flew to Ottawa [...]
  • 2008: Weekly review: week ending July 20, 2008 — Oops. I’m a bit late. =).There wasn’t much else to report besides the GBS Learning Week and my feedback from [...]
  • 2007: Weekly review: 2007.07.16 – 2007.07.21 — Last week After six revisions this week, my thesis is almost in a defensible form. Yay! Will defend my thesis on August [...]
  • 2006: The best birthday gifts — What do you give people on their birthdays? People struggle so much with that question, often giving up and grabbing the [...]
  • 2006: Google Trends — Interesting conversation on the plug-misc mailing list. Mark Anthony C. Delfin wrote: On 7/22/06, Daniel Escasa wrote: Steven J. Vaughan-Nichols plays with Google [...]
  • 2006: Think! Friday — One of the things I like about IBM is the Think! Friday initiative, which encourages people to use their Friday afternoons [...]
  • 2006: I’ve got music… – Hosting dinner parties — Apologies to Gershwin: I’ve got music, I’ve got rhythm, I’ve got my plates – who could ask for anything more? Some former [...]
  • 2005: Yay! Network at home, too! — My network connection in the dorm has been activated, too! Yay! Yay! Yay! Hmm. 1.5 gigabit weekly bandwidth limit, though. I [...]
  • 2005: Happy days are here again! — I can send and receive text messages! Yay! Yay! Yay! Non-Filipinos may not understand precisely how important text messaging is. Heck, even [...]
  • 2004: Talked to Doc V about BlueJ today — Got (mildly) scolded about the use of BlueJ. My class is doing fine (or at least I think so), but other [...]
  • 2004: “IBM to Help Train Students for IT Work” — The new IBM Academic Initiative is a program to aid academic institutions that support open-source software and open standards by contributing hardware [...]