Ubuntu 10.04 Step-by-Step for Multi-Drupal Instances Same Server (not Multi-site)

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!

Notes:

As of 10.9.2010, Does not work. For some reason will get a WSOD if cron runs twice in a row without the site being hit.
As of 10.8.2010: (later in the day!) Seems to be working, get a white screen of death, run update.php from the browser

As of 10.8.2010: I am sure this document will need to change, but this is where I am at currently with this install.

My Goal is to have two or more Drupal Installs with Pantheon, on Ubuntu 10.04.

I want my document root to be /var/www/www.example.com/htdocs/

This is based off the steps here:
http://groups.drupal.org/node/70268

Any questions or comments here:
http://groups.drupal.org/node/104779

In the Step-by-Step, Steps 1 ~ 6 are all good.

Here are my adjusted steps. (Please note don't do this on production yet as this is my first try at getting this right and then documenting it).

7) Install Mercury:
You should not have to remove anything as you should only have /var/www set in your default install anyways.

You should not have to remove anything
sudo drush make --working-copy /etc/mercury/mercury.make /var/www/site1/htdocs/

8) Install ApacheSolr:

Step8:

wget http://apache.osuosl.org/lucene/solr/1.4.0/apache-solr-1.4.0.tgz
tar xvzf apache-solr-1.4.0.tgz
sudo mkdir /var/solr
sudo mv apache-solr-1.4.0/dist/apache-solr-1.4.0.war /var/solr/solr.war

sudo mv apache-solr-1.4.0/example/solr /var/solr/default

Repeat for each site that you have

sudo cp -a /var/solr/default /var/solr/site1 

sudo mv /var/www/site1/htdocs/sites/all/modules/apachesolr/schema.xml /var/solr/site1/conf/

sudo chown -R tomcat6:root /var/solr/

Repeat for each site that you have

cp -a /etc/tomcat6/Catalina/localhost/default.xml /etc/tomcat6/Catalina/localhost/site1.xml
sed -i 's#/var/solr/default#/var/solr/site1#g' /etc/tomcat6/Catalina/localhost/site1.xml

/etc/init.d/tomcat6 restart

Make sure that you add this to settings.php after pressflow gets installed, NOT NOW, Later.

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

9) Prepare Pressflow files and dirs:

sudo mkdir /var/www/site1/htdocs/sites/default/files
sudo cp /var/www/site1/sites/htdocs/default/default.settings.php /var/www/sites/default/settings.php
sudo chown -R root:www-data /var/www/*
sudo chown www-data:www-data /var/www/site1/htdocs/sites/default/settings.php
sudo chmod 660 /var/www/site1/htdocs/sites/default/settings.php
sudo chmod 775 /var/www/site1/htdocs/sites/default/files

10) Add hudson to sudoers and restart hudson:

Repeat for each site:

sudo cp /etc/mercury/init.sh /etc/mercury/site1_init.sh
sudo nano /etc/mercury/site1_init.sh

find two cases of:
bash /usr/local/bin/update_pressflow.sh


change to:
bash /usr/local/bin/site1_update_pressflow.sh



Find: if [ -e /etc/mercury/incep ]; then
Change to: if [ -e /etc/mercury/incepsite1 ]; then


Find: echo "CREATE DATABASE IF NOT EXISTS pantheon;" | mysql -u root ${MYSQL_ROOT_PASSWORD}
Change to: echo "CREATE DATABASE IF NOT EXISTS site1databasename;" | mysql -u root ${MYSQL_ROOT_PASSWORD}

sudo chmod 755 site1_init.sh

Now we need to add each new file name in the next line of code: (/etc/mercury/site1_init.sh, /etc/mercury/site2_init.sh)

echo "hudson ALL = NOPASSWD: /usr/local/bin/drush, /etc/mercury/init.sh, /etc/mercury/site1_init.sh, /etc/mercury/site2_init.sh, /usr/bin/fab, /usr/sbin/bcfg2" | sudo tee -a

You can always edit /etc/sudoers after the fact and add the init.sh of your new site to it later.

sudo usermod -a -G shadow hudson
sudo /etc/init.d/hudson restart

Now we need to copy and edit the script that updates pressflow

sudo cp /usr/local/bin/update_pressflow.sh /usr/local/bin/site1_update_pressflow.sh
nano /usr/local/bin/site1_update_pressflow.sh

Find: cd /var/www/; bzr pull –overwrite;
Change to : cd /var/www/site1/htdocs/; bzr pull –overwrite;

11) Run the Mercury Init Hudson job

Backup the default settings for your /etc/sites-available/default file

mkdir ~/backups
cp /etc/sites-available/default

Now we are going to edit the default file

nano /etc/apache2/sites-available/default

Comment out, #, or remove:

        <Directory /var/www/>

                Options Indexes FollowSymLinks MultiViews

                AllowOverride All

                Order allow,deny

                allow from all

        </Directory>

Example would be:

        #<Directory /var/www/>

                #Options Indexes FollowSymLinks MultiViews

                #AllowOverride All

                #Order allow,deny

                #allow from all

        #</Directory>

Now create new records for each of your sites.

nano /etc/apache2/sites-available/www.site1.com
</code.

Add
<code>
#

# site1.com (/etc/apache2/sites-available/www.site1.com)

#

<VirtualHost *:8080>

        ServerName  www.site1.com

        ServerAlias site1.com

        DocumentRoot /var/www/www.site1.com/htdocs/

</VirtualHost>

Now we need to add a symbolic link the sites that are enabled, /etc/apache2/sites-enabled.

Do this for each new site

sudo a2ensite www.site1.com

Now we need to tell the server that we are running virtual hosts

sudo nano /etc/apache2/conf.d/virtual.conf

Add

#
#  We're running multiple virtual hosts.
#
NameVirtualHost *

Now restart Apache2

/etc/init.d/apache2 restart

You will see some warnings, I am working on this, but things seem to work fine.

Login to Hudson: example.com:8081 Username: root | password: your root password

Select New Job

Job name: site1_mercury_init

Copy existing job: mercury_init

Command:


Change : sudo /etc/mercury/init.sh --headless 2>&1
to: sudo /etc/mercury/site1_init.sh --headless 2>&1

Do the same for the cron:

Select New Job

Job name: site1_mercury_cron

Copy existing job: mercury_cron

Change:
/usr/bin/sudo /usr/local/bin/drush -r /var/www cron
to: /usr/bin/sudo /usr/local/bin/drush -r /var/www/site1/htdocs cron

Disable the default mercury_cron in the configure area.

Now we can run the site1_mercury_init

12) Configure Pressflow:

The only step that we need to change here is the name of the database that we set in step10

Change to: echo "CREATE DATABASE IF NOT EXISTS site1databasename;" | mysql -u root ${MYSQL_ROOT_PASSWORD}

To follow the steps here on 12
http://groups.drupal.org/node/70268

After this is done, you need to edit one more part of the settings.php

At the very bottom of the settings.php file you will find

$conf['memcache_key_prefix'] = 'default';

Change the default to what we decided in step 8.

You might get the name of your first install showing up after you setup and worse, once you add the memecache key, you can get a white screen of death error. Run, the update.php from the browser, example.com/update.php and things should be fixed after that

Mercury

Group organizers

Group categories

Post Type

Group notifications

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