Scalability & Cost Efficiency through Multisite Installations

gizra // Adam Stewart // @adamhstewart
gizraOrganic Groups // Message Stack // RESTful // Entity Reference//Commons 3.3 // Commerce Kickstart // OpenScholar

Definition of success

    On Time

    On Budget

    Users Are Happy

The Types of Multisite Installations:
"Native" Drupal Multisite

Multisite graphic images from Larry Garfield (@crell) - https://www.palantir.net/blog/multi-headed-drupal

The Types of Multisite Installations:
Domain Access

Multisite graphic images from Larry Garfield (@crell) - https://www.palantir.net/blog/multi-headed-drupal

The Types of Multisite Installations:
Organic Groups (OG)

Multisite graphic images from Larry Garfield (@crell) - https://www.palantir.net/blog/multi-headed-drupal

Organic Groups is the only way you should be doing multisite

Multisite graphic images from Larry Garfield (@crell) - https://www.palantir.net/blog/multi-headed-drupal

well maybe not really, but probably.

What are the Organic Group benefits?

  • “One Database to Rule Them All”
  • Sensible defaults
  • Streamlined maintenance
  • System-wide stats and reporting
  • Complex permissions and access

But really it's about permission

            
function og_user_access($group_type, $gid, $string, $account = NULL, $skip_alter = FALSE, $ignore_admin = FALSE) {
 global $user;
  $perm = &drupal_static(__FUNCTION__, array());
  // Mark the group ID and permissions that invoked an alter.
  $perm_alter = &drupal_static(__FUNCTION__ . '_alter', array());
  
  if (!og_is_group($group_type, $gid)) {
    // Not a group.
    return NULL;
  }
  
  
  if (empty($account)) {
    $account = clone $user;
  }
  
  // User #1 has all privileges.
  if ($account->uid == 1) {
    return TRUE;
  }
  
  // Administer group permission.
  if (user_access('administer group', $account) && !$ignore_admin) {
    return TRUE;
  }
  
  // Group manager has all privileges (if variable is TRUE).
  if (!empty($account->uid) && variable_get('og_group_manager_full_access', TRUE)) {
    $group = entity_load_single($group_type, $gid);
    if (!empty($group->uid) && $group->uid == $account->uid) {
      return TRUE;
    }
  }
  
  $identifier = $group_type . ':' . $gid;
  
  // To reduce the number of SQL queries, we cache the users permissions
  // in a static variable.
  if (!isset($perm[$identifier][$account->uid])) {
    $roles = og_get_user_roles($group_type, $gid, $account->uid);
    $role_permissions = og_role_permissions($roles);
  
    $perms = array();
    foreach ($role_permissions as $one_role) {
      $perms += $one_role;
    }
    $perm[$identifier][$account->uid] = $perms;
  }
  
  if (!$skip_alter && empty($perm_alter[$identifier][$account->uid][$string])) {
    // Let modules alter the permissions. since $perm is static we create
    // a clone of it.
    $group = !empty($group) ? $group : entity_load_single($group_type, $gid);
    $temp_perm = $perm[$identifier][$account->uid];
    $context = array(
      'string' => $string, 
      'group_type' => $group_type, 
      'group' => $group, 
      'account' => $account,
    );
    drupal_alter('og_user_access', $temp_perm, $context);
  
    // Re-assing the altered permissions.
    $perm[$identifier][$account->uid] = $temp_perm;
  
    // Make sure alter isnt called for the same permissions.
    $perm_alter[$identifier][$account->uid][$string] = TRUE;
  }
  
  return !empty($perm[$identifier][$account->uid][$string]) || (!empty($perm[$identifier][$account->uid]['administer group']) && !$ignore_admin);
}
            
          

Users are users and groups are content.

Instantaneous site creation with OpenScholar.
It's Wix for universities!

Try it: http://dev-os-install.pantheonsite.io - Username/Password: osdemo/osdemo

A Closer Look: The Case of a University

For one, cost alone is enough of a motivation to explore a more unified web presence. Bearing small, but significant costs for similar development tasks, sometimes hundreds of times over, can cost a large university in the millions of dollars.

A Closer Look: The Case of a University

More complex CMS sites come with more inherent security risks, and while the number of sites (and codebases) grow, the technical knowledge to apply security patches and other updates does not necessarily grow with it.

A Closer Look: The Case of a University

As the competition for high-caliber students grows more fierce, web presence plays a crucial role in attracting applicants.

A Closer Look: The Case of a University

Providing a solid and universal user experience for content editors across the entire campus allows for a better adoption rate and a more streamlined education and training.

Harvard OpenScholar

  • OpenScholar runs over 7,000 websites at Harvard on a single database.
  • It has an estimated value of $7M and was built at a fraction of the cost.
  • A comprehensive test suite cut release cycles in half.

Harvard OpenScholar

Other use cases for multisite

  • Knowledge/Data sharing platforms that have lots of content and many editors (e.g. C4D and P4D of the European Commission).
  • Non-profits/NGOs that need more than a handful of sites - provides cost efficiency and low maintenance overhead.
  • Law-Firms/Large practices to provide distributed access and content editing permissions.

Project Sharing: P4D (European Commission)

Knowledge Sharing: C4D (European Commission)

Large NGO: Sierra Club

gizra
slides available at:

gizra-presentations.github.io/multisite