Instructions for setting up multi-site on Mercury

Events happening in the community are now at Drupal community events on www.drupal.org.
You are viewing a wiki page. You are welcome to join the group and then edit it. Be bold!

These instructions are for any Mercury 1.1 Beta created after 6/1/10 (including the Mercury 1.1 Beta2 AMIs we released on 5/29/10).

For this example, we're going to call the second site "site2". This example assumes you have 2 hostnames pointed at the IP of your server.

1) Mysql:

Create a mysql database for the second site

echo "create database site2;" | mysql -u root -p

2) ApacheSolr:

Make a second instance of Apache Solr and restart tomcat6

cp -a /var/solr/default /var/solr/site2
cp -a /etc/tomcat6/Catalina/localhost/default.xml /etc/tomcat6/Catalina/localhost/site2.xml
sed -i 's#/var/solr/default#/var/solr/site2#g' /etc/tomcat6/Catalina/localhost/site2.xml
/etc/init.d/tomcat6 restart

3) Drupal:

Copy the sites/default dir for the second site

mv /var/www/sites/default /var/www/sites/site1.hostname.com
ln -s /var/www/sites/site1.hostname.com /var/www/sites/default
cp -a /var/www/sites/site1.hostname.com /var/www/sites/site2.hostname.com

4) Varnish:

Add a second backend to Varnish

vi /var/lib/bcfg2/TGenshi/varnish/vcl/template.newtxt.G50_lucid

# Alternative backend(s)
backend otherdomain {
  .host = "example.com";
  .port = "8080";
  .connect_timeout = 600s;
  .first_byte_timeout = 600s;
  .between_bytes_timeout = 600s;
}

Use this backend in your sub vcl_recv*:

if (req.http.host ~ "^(www.)?example.com$") {
  set req.backend = otherdomain;
  return (lookup);
}

*See /etc/mercury/server_tuneables or an example of custom Varnish default vcl configuration on Mercury.

Now you can:

1) install site1 (if you haven't done so already. If you have, you'll need to remove the DB (and Mercury info) from sites/site2.hostname.com/settings.php.
2) install site2 (using new db name), change solr path from "/default" to "/site2" and the memcached prefix name in settings.php:

# Key Prefix: edit this for multisite use.
$conf['memcache_key_prefix'] = 'site2';

Mercury

Group organizers

Group categories

Post Type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week