CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Multi Site Install Questions
Pages: [1]

Author Topic: Multi Site Install Questions  (Read 4089 times)

cgrapski

  • Guest
Multi Site Install Questions
November 20, 2007, 04:35:59 pm
Hi - forgive me if anything I say is naive or irrelevant but I am hoping someone can give me some guidance regarding setting up a multi-site install.

Here is the scenario:

I have a Drupal 5.3 install.  I have multiple domains each with a site running off of this install.  Each site has its own MySQL database.  The module is located in the sites/all/modules directory.  The sites will each have their own content (and thus their own database) but will share the CiviCRM database (to share the contacts across the sites).

I have installed successfully several times with sites that are strictly unitary.

Can I accomplish the install in the following way successfully and is there anything that I am missing or should do differently or should be concerned about.

Lets say I install successfully CiviCRM on one of the multiple sites.  Thus the module is uploaded properly and I have the settings.php file (for CiviCRM) in that sites folder under the sites directory.  I also have the CiviCRM database set up and with an initial population.  So its working fine on the one site.

Would it be possible to set up the other sites with the CiviCRM module sharing that database in the following SIMPLE way?  If not is there another simple way - or is it just something missing or done incorrectly?

1. Copy the existing working site's civicrm.settings.php file and place it into the other sites directories under the sites directory.

2. Change the settings for the particular site in each of the particular copies of the civicrm.settings.php file.

3. Enable the module in the administration of each site.

[Now I will lay out what changes I would make in (2) - but in general does this seem like it would work fine and be sufficient and not cause any problems - or is there something else missing that is essential or advisable?]

For Step 2:

And this is where I am really concerned to make all of the right decisions (the rest seems to make sense logically).  What I am most concerned here is to make sure that I make ALL necessary changes to the file and make them CORRECTLY.

[Remember this is the civicrm.settings.php file generated from the first install on one site in this multi-site setup - it is then copied to each of the other sites directories where there is a similar copy of the settings.php file (in which I made changes to indicate the particular $db_url for the particular site [each being different] and the particular $base_url.  EFFECTIVELY this is how I set up my multi-sites prior to trying to set up CiviCRM.  And I am trying to adopt a similar simple method for this task now - hoping it will be as simple as that.]

a) As there is only one civicrm database nothing should be changed with regard to it in the civicrm.settings.php file.  Am I correct?

b) Question: Is there also a change needed for the settings.php file (not the civicrm.settings.php) file?  I was reading the documentation for multi-install and this was not very clear.  Does the install of civicrm add a $db_url[CRM: 'civicrm'] line - and if so do I therefore need to edit each of the sites settings.php file to have that SAME line?  Is this a particular line for CiviCRM or is this simply a reference to the $db_url (pointing not to the CiviCRM database but the Drupal database) [and if the latter doesn't that mean that this is part of my installation of a multi-site drupal rather than the additional installation of a multi-site CiviCRM?  And if so then it seems it is something that I don't need to change anything as this was already done - or am I mistaken?]

So far this seems intuitive.  Its the next part that has really got me confused.  Remember I am setting up a mulit-site install in which there is one codebase for drupal and it contains the CiviCRM module.  Each site has its own drupal database.  But I want it to share the single civicrm database.

c) What to do regarding the CIVICRM_DOMAIN_ID in the civicrm.settings.php file?  Do I leave this the SAME in each one - or do I have to give each one a separate one?  I am inclined to think the former but want to be certain.  My concern is how then will CiviCRM know which domain is accessing it - and whether or not this makes a difference.

NOW from what was really confusing in the documentation:

d) The issue of "$db_url[CRM:'default'] and $db_prefix in each site's settings.php file." 

The instructions [for this kind of multi-site setup - the third type] say "create separate content for each site by storing its information in unique tables [it says CivicSpace but I assume this can be substituted with Drupal] ...

QUESTION: Isn't this already done in my setup of the multi-site drupal installation PRIOR TO installing CiviCRM?  Haven't I done this by having a separate Drupal database for each and the settings.php file (necessarily) pointing to its exclusive Drupal database?  If so does this bit not apply in my scenario - or am I missing something?

It then goes on ... BY EITHER
(i) "changing the prefix on the tables between the domains"

QUESTION: Is this not relevant here - as I am using separate Drupal databases and not a single one with a different prefix per site?

AND/OR

(ii) "changing the database that each [Drupal] CivicSpace site stores its data in"

QUESTION: Isn't that what I have already done in setting up my multi-site drupal installation?  And thus can I also disregard this?

One of the really confusing bits in the documentation here is this "and/or" because at the moment (as I have interpreted this part so far - but that might be the problem) it would seem that this would normally just be an OR situation (EITHER have multi-sites with ONE Drupal database serving ALL sites distinguished by a prefix in the tables OR having multi-sites with MULTI Drupal databases (one for each)).

It then continues: "In other words, make sure to have a different combination of values for $db_url[CRM:'default'] and $db_prefix in each site's settings.php file."

As I currently don't have any $db_prefixes (and here we get the AND suggesting, perhaps unintentionally in the wording of the instructions, that this is a NECESSARY thing for me to have - for some reason - for CiviCRM) do I need to be concerned about that part. 

And the $db_url[CRM:'default'] - what exactly is this? [See Question (b) above - same issue]  I guess it is the [CRM:'default'] part of this that is confusing me.  Is this simply the Drupal database location or something specific to CiviCRM?

I hope this wasn't too confusing or long - I was trying to be as clear and thorough as I could.  I don't want to knock down a functioning multi-site drupal install.

Thanks
Charlie

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Multi Site Install Questions
November 21, 2007, 09:35:43 am
I'm pretty sure that what you want to do is possible - and that others have configured sites in a similar manner. However, I don't have direct knowledge of this - so my input is theoretical. Hopefully others who have direct experience setting up and running multi-site installs will also chime in. In any case, I would strongly recommend that you implement this first on a set of test sites before modifying your working production sites.

Drupal Sites Must Have a Common Users Table
If multiple Drupal sites share a CiviCRM database, they also need to use a shared users table. CiviCRM includes logic for creating contact records whenever a Drupal user record is created, as well as a batch "synchronize users to contacts" admin function. A 1:1 relationship is established (in the civicrm_uf_match table) between a Drupal User ID (users.uid) and a CiviCRM Contact ID (civicrm_contact.id). Hence there can only be one user table per CiviCRM DB instance.

This means that your Drupal settings.php files will need to be configured to share the users table. There are several articles online describing how to do this.

Assuming this isn't a show-stopper for you... the CiviCRM part of the setup should be straightforward. Each copy of civicrm.settings.php can be the same except for the CIVICRM_UF_BASEURL value. This must point to the home URL for each Drupal site/domain.

In your test setup, I would have at least 2 Drupal sites - and then test the following:
* drupal new user registration
* drupal my account user update
* CiviCRM Admin "Synchronize Users to Contacts"


Protect your investment in CiviCRM by  becoming a Member!

Matt2000

  • I post frequently
  • ***
  • Posts: 288
  • Karma: 27
    • http://www.ninjitsuweb.com
Re: Multi Site Install Questions
December 02, 2007, 07:23:16 pm
I am attempting something similar.

I'm adding a second Drupal site that uses the same CiviCRM installation as the first site (codebase & database).

However, for the end-users, CiviCRM is only accessed via the first site. The only reason the Second site has the module enabled ( and it's own civicrm.settings.php file ) is to be able to use profiles & Contribution pages, etc, and have them feed into the first site.

So far in setting things up, I have not found any need to share the Drupal Users table. Am I asking for trouble? 

Drupal #2 never needs to get any user info from CiviCRM.  I never expect to run "Synchronize USers to Contacts". I just enabled the module & copied over civicrm.settings.php and changed CIVICRM_UF_BASEURL . So far I've had no problems....

-Matt
Drupal/CiviCRM micro-blogging http://twitter.com/matt2000

Ninjitsu Web Development http://www.NinjitsuWeb.com/

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Multi Site Install Questions
December 02, 2007, 09:16:04 pm

not sure i understand why you have a second site for profile and contrib pages instead of them being part of the first site?

If you are not using any of the user <-> contact match stuff, and your admin user is the one who deals with civicrm on both sites, then i suspect its not a problem.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Matt2000

  • I post frequently
  • ***
  • Posts: 288
  • Karma: 27
    • http://www.ninjitsuweb.com
Re: Multi Site Install Questions
December 02, 2007, 09:24:03 pm
The second site has it's own theme & other content.

Each site is essentially a separate organization, but they share 1 fundraising entity.

I've customized CiviCRM to allow the two organizations to have separate groups, etc, but share contacts by default.

Is there another way to get CiviCRM pages inside of an external Drupal site?
Drupal/CiviCRM micro-blogging http://twitter.com/matt2000

Ninjitsu Web Development http://www.NinjitsuWeb.com/

Matt2000

  • I post frequently
  • ***
  • Posts: 288
  • Karma: 27
    • http://www.ninjitsuweb.com
Re: Multi Site Install Questions
April 17, 2008, 08:20:02 pm
Thought I should follow up here for posterity:

The sites in question have had problems due to mismatched entries in civicrm_uf_match table. So I do NOT recommend attempting to do this unless you do in fact have a shared users table, as Dave suggested.
Drupal/CiviCRM micro-blogging http://twitter.com/matt2000

Ninjitsu Web Development http://www.NinjitsuWeb.com/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Multi Site Install Questions

This forum was archived on 2017-11-26.