Question

Im running a Drupal Multisite environment on a lamp (debian, apache, php, mysql) server.

My current workflow for a new project is:

  1. Activate a subdomain on my company site (let's say the project will be foo.com, i activate foo.example.com)
  2. Becose of plesk (that's a bit drupal unfriendly) my step are:
    1. Create the new subdomain in plesk, php running in fastcgi mode
    2. Create the database
    3. Delete httpdocs folder, recreate it and make the sites folder
    4. Make a simbolic link to every file into /var/www/vhosts/drupal folder (drupal code base) excapt of sites and tmp folders, robots.txt and .htacces files (that usually will be customized per domain)
    5. Make the folder foo.example.com inside sites, symbolic link to /var/www/vhosts/drupal/sites/all folder, and then back a symbolic link from sites/foo.com to /var/www/vhosts/drupal/sites/foo.example.com (in order to make drush see all the domains to some multisite tasks, like crontab)
  3. Install, configure drupal in the subdomain, doing everythings needed to complete the project

At this point, i need to switch the project from the subdomain to the final domain, foo.com, that will reside o my server too.

I dont like much some kind of other hacks like domain redirects, i want the final project to be a 'clean' (for what clean mean in a multisite environment).

Actually i do those steps:

  1. Creating the domain (via plesk) and database;
  2. Copy the subdomain httpdocs to the full domain httpdocs (cp -a /var/www/vhosts/example.com/subdomains/foo/httpdocs /var/www/vhosts/foo.com/httpdocs)
  3. Change owner and group of httpdocs to match the domain's owner and group
  4. Login into drupal, change webiste info, and filesystem paths.

This let me do what i want, but i have some trouble with node's html contents; espacially for those that contain links, images, and files, that (even if IMCE is configurated to use relative path), will point to /sites/foo.example.com/files/[...] instead of /sites/foo.com/files/[...].. this happen for cck filefields too.

As i said, i need a clean solution, i know i could make a symbolic link from /sites/foo.example.com to /sites/foo.com but i really dont like this way.

So far, i tryed to search/replace all the occourrence into the database sql dump:

sed 's/foo.example.com/foo.com/g' dump.sql > foo.com.sql

But this seem to brake somethings; I get many errors in boostrap file (in the cache unserialize step, even if i cleared all the cache before and after the db export/import) and looks like some utf-8 encoding get broken.

I know the best deal will be to set the development area on a local server, but i need my customer to reach it from outside.. and our adsl situation (static IP and so on) is a bit wired.

Any idea?

p.s: sorry for my bad english, if my question is not clear enought let me know and i'll provide more details)

Was it helpful?

Solution

Your steps are basically what I do, but I am not using Plesk or doing a multisite installation. I just create a new vhost in a VPS instance, and cp -a the docroot, and reconfigure for a new database DSN.

Regarding the SQL problems, I typically edit the SQL dump in a UTF-8 clean editor to prevent that problem. On Windows, I use Notepad++.

I then restore the database, clean all caches, edit settings, and run cron. I will also typically rebuild the search index.

This sequence normally works.

The bootstrap problem likely has to do with the variables table. When you serialize a string (or something with an string), the length gets stored, too. I will do the search and replace, then open up MySQL Query Browser, and search for rows in variable table with the domain name, and fix the lengths by hand. The other option is to determine which option is being stored, and then recreate the setting.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top