SlideShare una empresa de Scribd logo
1 de 101
Descargar para leer sin conexión
Demystifying
Multisite Architecture
    John VanDyk and James Walker
   Do It With Drupal, December 2008




                                      1
What is Multisite?



                               How Multisite Works



                    Sharing Information Between Sites




                                                                  2

three sections to this presentation, lots of time for questions
http://www.example.com

                                         http://banana.example.com

                                         http://www.example.com/apple

                                         http://pancakeblog.net




                                                                                        3

You can always have multiple Drupal sites on a server, with multiple copies of Drupal
http://www.example.com

                                        http://banana.example.com

                                        http://www.example.com/apple

                                        http://pancakeblog.net




                                                                       4

We’re talking about having multiple sites on ONE copy of Drupal.
Why?



       5
6
• Only one copy of the codebase




                                  6
• Only one copy of the codebase
• Only one codebase to upgrade




                                  6
• Only one copy of the codebase
• Only one codebase to upgrade
• Only one set of files to debug



                                  6
• Only one copy of the codebase
• Only one codebase to upgrade
• Only one set of files to debug
• Still have flexibility for site-specific modules


                                                   6
7

Drupal has three essential components.
The filesystem contains the files that make up the Drupal codebase.
$db_url = 'mysqli://joe:secret@localhost/example';




                                                                            8

The database contains content and most configuration settings.
example




                       $db_url = 'mysqli://joe:secret@localhost/example';




                                                                            8

The database contains content and most configuration settings.
example




                       $db_url = 'mysqli://joe:secret@localhost/example';




                                                                            8

The database contains content and most configuration settings.
9

The files directory contains uploaded files.
10

If using private files, the files directory can be outside of the web root.
<?php
require_once './includes/bootstrap.inc';
drupal_bootstrap(FULL);




                                           11
CONFIGURATION: initialize configuration.
EARLY PAGE CACHE
DATABASE: initialize database layer.
ACCESS: identify and reject banned hosts.
SESSION: initialize session handling.
LATE PAGE CACHE
LANGUAGE: identify the language
PATH: path handling
FULL: Drupal is fully loaded




                                            12
CONFIGURATION: initialize configuration.
EARLY PAGE CACHE
DATABASE: initialize database layer.
ACCESS: identify and reject banned hosts.
SESSION: initialize session handling.
LATE PAGE CACHE
LANGUAGE: identify the language
PATH: path handling
FULL: Drupal is fully loaded




                                            13

Multisite happens here.
We’ve got a request for http://www.example.com/
 That’s from host www.example.com, path /
 Let’s look for a settings file at




                                                   14

What normally happens.
We’ve got a request for http://www.example.com/
 That’s from host www.example.com, path /
 Let’s look for a settings file at

          sites/www.example.com/settings.php




                                                   14

What normally happens.
We’ve got a request for http://www.example.com/
 That’s from host www.example.com, path /
 Let’s look for a settings file at

          sites/www.example.com/settings.php
          sites/example.com/settings.php




                                                   14

What normally happens.
We’ve got a request for http://www.example.com/
 That’s from host www.example.com, path /
 Let’s look for a settings file at

          sites/www.example.com/settings.php
          sites/example.com/settings.php
          sites/com/settings.php




                                                   14

What normally happens.
We’ve got a request for http://www.example.com/
 That’s from host www.example.com, path /
 Let’s look for a settings file at

          sites/www.example.com/settings.php
          sites/example.com/settings.php
          sites/com/settings.php
          sites/default/settings.php




                                                   14

What normally happens.
http://www.example.com

                                        http://banana.example.com




                                                                    15

We’re talking about having multiple sites on ONE copy of Drupal.
$db_url = 'mysqli://jdoe:secret@localhost/banana';




                                   $db_url = 'mysqli://moe:shhhh@localhost/www';




                                                                                             16

Now banana.example.com will get a site using the banana database; everything else gets the
www database.
$db_url = 'mysqli://jdoe:secret@localhost/banana';




                                                              banana




                                   $db_url = 'mysqli://moe:shhhh@localhost/www';




                                                                                             16

Now banana.example.com will get a site using the banana database; everything else gets the
www database.
$db_url = 'mysqli://jdoe:secret@localhost/banana';




                                                              banana




                                                             example


                                   $db_url = 'mysqli://moe:shhhh@localhost/www';




                                                                                             16

Now banana.example.com will get a site using the banana database; everything else gets the
www database.
$db_url = 'mysqli://jdoe:secret@localhost/banana';




                                                              banana




                                                             example


                                   $db_url = 'mysqli://moe:shhhh@localhost/www';




                                                                                             16

Now banana.example.com will get a site using the banana database; everything else gets the
www database.
$db_url = 'mysqli://jdoe:secret@localhost/banana';




                                                              banana




                                                             example


                                   $db_url = 'mysqli://moe:shhhh@localhost/www';




                                                                                             16

Now banana.example.com will get a site using the banana database; everything else gets the
www database.
Edge case
                 http://www.example.com/something




                                                    17

Need a symlink
http://banana.example.com/fanclub




                                    18
CCK and Views
available for all sites
 porcupine theme
available for all sites




                          19
20
fivestar module
     only available
on banana.example.com




                        20
fivestar module
     only available
on banana.example.com

  bananator module
     only available
on banana.example.com




                        20
fivestar module
      only available
 on banana.example.com

   bananator module
      only available
 on banana.example.com

   gobananas theme
     only available
on banana.example.com



                         20
21

Each site has its own place to put uploaded files.
http://www.example.com/sites/www.example.com/files/
                         image.jpg




                                                         22

mod_rewrite can help make your URLs more friendly
http://www.example.com/sites/www.example.com/files/
                         image.jpg


RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]




                                                         22

mod_rewrite can help make your URLs more friendly
http://www.example.com/sites/www.example.com/files/
                         image.jpg


RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]



                http://www.example.com/files/image.jpg




                                                         22

mod_rewrite can help make your URLs more friendly
Summary So Far
• Single codebase
• Everything in sites/all is shared: modules,
  themes
• Site-specific modules and themes go in
  sites/sitename/
• Each site has its own file uploads directory

                                                23
Cron!



        24
Updating Multisite



                     25
Updating a Drupal Site




                                                                example




                                                                          26

The database contains content and most configuration settings.
Updating a Drupal Site




                                                                example




                                                                          26

The database contains content and most configuration settings.
Updating a Drupal Site




                                                                example




                                                                          26

The database contains content and most configuration settings.
Updating Multisite


                                                   banana




                                                   cherry




                                                            27

Running update.php once is not enough!
Updating Multisite


                                                   banana




                                                   cherry




                                                            27

Running update.php once is not enough!
Updating Multisite


                                                   banana




                                                   cherry




                                                            27

Running update.php once is not enough!
Updating Multisite


                                                   banana




                                                   cherry




                                                            27

Running update.php once is not enough!
Updating Multisite


                                                   banana




                                                   cherry




                                                            27

Running update.php once is not enough!
Updating Multisite


                                                   banana




                                                   cherry




                                                            27

Running update.php once is not enough!
What is Multisite?



      How Multisite Works



Sharing Information Between Sites




                                    28
Table Prefixing




                                                                 29

Prefixing originally for multiple Drupal sites on cheap hosting
Table Prefixing




                                                                 29

Prefixing originally for multiple Drupal sites on cheap hosting
Table Prefixing




                       $db_prefix = 'zoinks_';


                                                                 29

Prefixing originally for multiple Drupal sites on cheap hosting
$db_prefix = array(
                  'default' => 'main_',
                  'users' => 'shared_',
                  'sessions' => 'shared_',
                  'role'    => 'shared_',
                  'authmap' => 'shared_',
               );




                                             30

settings.php
$db_prefix = array(
                  'default' => '',
                  'users' => 'shared.',
                  'sessions' => 'shared.',
                  'role'    => 'shared.',
                  'authmap' => 'shared.',
               );

                       shared.users
                  databasename.tablename



                                             31

settings.php
access
                                               actions               example
                                               actions_aid
                                               authmap
                                               ...



                                                                                            32

What will happen with this arrangement? Nothing different! The location of the two tables has
just changed (users and authmap tables in the example database are unused).
users                 shared
                                               authmap



                                               access
                                               actions               example
                                               actions_aid
                                               authmap
                                               ...



                                                                                            32

What will happen with this arrangement? Nothing different! The location of the two tables has
just changed (users and authmap tables in the example database are unused).
users                 shared
                                               authmap



                                               access
                                               actions               example
                                               actions_aid
                                               authmap
                                               ...



                                                                                            32

What will happen with this arrangement? Nothing different! The location of the two tables has
just changed (users and authmap tables in the example database are unused).
access
                               actions       banana
                               actions_aid
                               authmap
                               ...
                               access
                               actions       example
                               actions_aid
                               authmap
                               ...
                                                       33

Still no change in behavior!
users         shared
                               authmap


                               access
                               actions        banana
                               actions_aid
                               authmap
                               ...
                               access
                               actions       example
                               actions_aid
                               authmap
                               ...
                                                       33

Still no change in behavior!
users         shared
                               authmap


                               access
                               actions        banana
                               actions_aid
                               authmap
                               ...
                               access
                               actions       example
                               actions_aid
                               authmap
                               ...
                                                       33

Still no change in behavior!
users         shared
                               authmap


                               access
                               actions        banana
                               actions_aid
                               authmap
                               ...
                               access
                               actions       example
                               actions_aid
                               authmap
                               ...
                                                       33

Still no change in behavior!
“Logged in” means

• Cookie containing session ID
• Entry in sessions table containing session
  ID
• Entry in users table


                                               34
users      shared
        authmap
$user


        sessions   banana
        role




                            35
users      shared
        authmap
$user

        sessions   banana
        role



        sessions   example
        role


                             36
Share user, authmap
Separate login on each site
Simultaneous logins!
User record shared
Roles are not shared
Role assignments are not shared




                                  37
Share user, authmap
Separate login on each site
Simultaneous logins!
User record shared
Roles are not shared
Role assignments are not shared




                                  37
Shared Logins



                38
users
        authmap    shared
        sessions
$user


        role       banana




                            39
users
                             authmap    shared
                             sessions
$user


$db_prefix = array(          role       banana
  'default' => '',
  'users' => 'shared.',
  'authmap' => 'shared.',
  'sessions' => 'shared.',
);




                                                 39
What happens?




                40
What happens?

• Log into http://banana.example.com




                                       40
What happens?

• Log into http://banana.example.com
• Go to http://www.example.com



                                       40
What happens?

• Log into http://banana.example.com
• Go to http://www.example.com
• We’re not logged in!


                                       40
What happens?

• Log into http://banana.example.com
• Go to http://www.example.com
• We’re not logged in!
• Huh?

                                       40
What’s wrong with this picture?


 SESS0787a3dbcceb3bde85599fd17a876fa8de:
     d977085b070ee1f8def0fa7c2fb26ada

SESS2611eb8d937302f9383947cd79a86d6888:
   26bd9e318d607b0581696431bcfb93b1




                                           41
$cookie_domain = ‘example.com’




                                 42
What happens?




                43
What happens?

• Log into http://banana.example.com




                                       43
What happens?

• Log into http://banana.example.com
• Go to http://www.example.com



                                       43
What happens?

• Log into http://banana.example.com
• Go to http://www.example.com
• We’re already logged in!


                                       43
What happens?

• Log into http://banana.example.com
• Go to http://www.example.com
• We’re already logged in!
• Yay!

                                       43
user, authmap, sessions +
         $cookie_domain

One login for all sites
User record shared
Roles are not shared
Role assignments are not shared




                                  44
users
        authmap    shared
        sessions
        role
$user


                   banana




                            45
users
                             authmap    shared
                             sessions
                             role
$user


$db_prefix = array(                     banana
  'default' => '',
  'users' => 'shared.',
  'authmap' => 'shared.',
  'sessions' => 'shared.',
  'role' => 'shared.',
);




                                                 45
46
user, authmap, sessions, role +
        $cookie_domain

One login for all sites
User record shared
Role names/ids shared
Role assignments are not shared




                                   47
users
        authmap
        sessions      shared
        role
        users_roles
$user


                      banana




                               48
users
                                authmap
                                sessions      shared
                                role
                                users_roles
$user

$db_prefix = array(
  'default' => '',                            banana
  'users' => 'shared.',
  'authmap' => 'shared.',
  'sessions' => 'shared.',
  'role' => 'shared.',
  'users_roles' => 'shared.',
);




                                                       48
user, authmap, sessions, role,
users_roles + $cookie_domain

One login for all sites
User record shared
Role names/ids shared
Role assignments shared




                                  49
User                      Role
                      Login   Role
             record                  assignment

  user


+ sessions              *


  + role

    +
users_role



                                                  50
Caution!




           51
Caution!
• Table contention




                         51
Caution!
• Table contention
• Database updates




                        51
Caution!
• Table contention
• Database updates
• Don’t share role
  assignments and not
  role IDs!




                         51
Caution!
• Table contention
• Database updates
• Don’t share role
  assignments and not
  role IDs!

• Think it out using
  stories!



                          51
What is Multisite?



      How Multisite Works



Sharing Information Between Sites




                                    52

Más contenido relacionado

La actualidad más candente

Using python and docker for data science
Using python and docker for data scienceUsing python and docker for data science
Using python and docker for data scienceCalvin Giles
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWalter Ebert
 
Top 5 Non-Obvious Drupal Modules
Top 5 Non-Obvious Drupal ModulesTop 5 Non-Obvious Drupal Modules
Top 5 Non-Obvious Drupal Modulesghing
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practicesmarkparolisi
 
Webinar - Managing Files with Puppet
Webinar - Managing Files with PuppetWebinar - Managing Files with Puppet
Webinar - Managing Files with PuppetOlinData
 

La actualidad más candente (6)

Using python and docker for data science
Using python and docker for data scienceUsing python and docker for data science
Using python and docker for data science
 
Php talk
Php talkPhp talk
Php talk
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwalten
 
Top 5 Non-Obvious Drupal Modules
Top 5 Non-Obvious Drupal ModulesTop 5 Non-Obvious Drupal Modules
Top 5 Non-Obvious Drupal Modules
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
Webinar - Managing Files with Puppet
Webinar - Managing Files with PuppetWebinar - Managing Files with Puppet
Webinar - Managing Files with Puppet
 

Destacado

Drupal module development
Drupal module developmentDrupal module development
Drupal module developmentRachit Gupta
 
Building Social Networking sites with and around drupal
Building Social Networking sites with and around drupalBuilding Social Networking sites with and around drupal
Building Social Networking sites with and around drupalDipen Chaudhary
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architectureHai Vo Hoang
 
Drupal Architecture and functionality
Drupal Architecture and functionality Drupal Architecture and functionality
Drupal Architecture and functionality Ann Lam
 
Information Architecture for Drupal
Information Architecture for DrupalInformation Architecture for Drupal
Information Architecture for DrupalVanessa Turke
 
Drupal 7 performance and optimization
Drupal 7 performance and optimizationDrupal 7 performance and optimization
Drupal 7 performance and optimizationShafqat Hussain
 

Destacado (6)

Drupal module development
Drupal module developmentDrupal module development
Drupal module development
 
Building Social Networking sites with and around drupal
Building Social Networking sites with and around drupalBuilding Social Networking sites with and around drupal
Building Social Networking sites with and around drupal
 
Intro to drupal_7_architecture
Intro to drupal_7_architectureIntro to drupal_7_architecture
Intro to drupal_7_architecture
 
Drupal Architecture and functionality
Drupal Architecture and functionality Drupal Architecture and functionality
Drupal Architecture and functionality
 
Information Architecture for Drupal
Information Architecture for DrupalInformation Architecture for Drupal
Information Architecture for Drupal
 
Drupal 7 performance and optimization
Drupal 7 performance and optimizationDrupal 7 performance and optimization
Drupal 7 performance and optimization
 

Similar a Multisite Van Dyk Walkah

Drupal Multisite Setup
Drupal Multisite SetupDrupal Multisite Setup
Drupal Multisite Setupipsitamishra
 
Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)jimyhuang
 
Introducing ruby on rails
Introducing ruby on railsIntroducing ruby on rails
Introducing ruby on railsPriceen
 
Drupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappersDrupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappersMarcus Deglos
 
Apache ignite - a do-it-all key-value db?
Apache ignite - a do-it-all key-value db?Apache ignite - a do-it-all key-value db?
Apache ignite - a do-it-all key-value db?Zaar Hai
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliGetSource
 
Cloud, Cache, and Configs
Cloud, Cache, and ConfigsCloud, Cache, and Configs
Cloud, Cache, and ConfigsScott Taylor
 
Drupal Multi-Site Setup
Drupal Multi-Site SetupDrupal Multi-Site Setup
Drupal Multi-Site Setupylynfatt
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliGetSource
 
Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLkangaro10a
 
Top 5 Hadoop Admin Tasks
Top 5 Hadoop Admin TasksTop 5 Hadoop Admin Tasks
Top 5 Hadoop Admin TasksEdureka!
 
Webinar: Top 5 Hadoop Admin Tasks
Webinar: Top 5 Hadoop Admin TasksWebinar: Top 5 Hadoop Admin Tasks
Webinar: Top 5 Hadoop Admin TasksEdureka!
 
Get Started With Drupal
Get Started With DrupalGet Started With Drupal
Get Started With DrupalKartik Singhal
 
Drupal multisite
Drupal multisiteDrupal multisite
Drupal multisiteLy Phuong
 

Similar a Multisite Van Dyk Walkah (20)

Drupal Multisite Setup
Drupal Multisite SetupDrupal Multisite Setup
Drupal Multisite Setup
 
Local Drupal MultiSite Set-up
Local Drupal MultiSite Set-upLocal Drupal MultiSite Set-up
Local Drupal MultiSite Set-up
 
Drupal Multi-site for Fun and Profit
Drupal Multi-site for Fun and ProfitDrupal Multi-site for Fun and Profit
Drupal Multi-site for Fun and Profit
 
Drupal 8 Render Cache
Drupal 8 Render CacheDrupal 8 Render Cache
Drupal 8 Render Cache
 
Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)Scaling in Mind (Case study of Drupal Core)
Scaling in Mind (Case study of Drupal Core)
 
Introducing ruby on rails
Introducing ruby on railsIntroducing ruby on rails
Introducing ruby on rails
 
CloudInit Introduction
CloudInit IntroductionCloudInit Introduction
CloudInit Introduction
 
Drupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappersDrupal feature proposal: two new stream-wrappers
Drupal feature proposal: two new stream-wrappers
 
Apache ignite - a do-it-all key-value db?
Apache ignite - a do-it-all key-value db?Apache ignite - a do-it-all key-value db?
Apache ignite - a do-it-all key-value db?
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cli
 
DevOps: Docker Workshop
DevOps: Docker WorkshopDevOps: Docker Workshop
DevOps: Docker Workshop
 
Cloud, Cache, and Configs
Cloud, Cache, and ConfigsCloud, Cache, and Configs
Cloud, Cache, and Configs
 
Drupal Multi-Site Setup
Drupal Multi-Site SetupDrupal Multi-Site Setup
Drupal Multi-Site Setup
 
Intro to Drush
Intro to DrushIntro to Drush
Intro to Drush
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
 
Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQL
 
Top 5 Hadoop Admin Tasks
Top 5 Hadoop Admin TasksTop 5 Hadoop Admin Tasks
Top 5 Hadoop Admin Tasks
 
Webinar: Top 5 Hadoop Admin Tasks
Webinar: Top 5 Hadoop Admin TasksWebinar: Top 5 Hadoop Admin Tasks
Webinar: Top 5 Hadoop Admin Tasks
 
Get Started With Drupal
Get Started With DrupalGet Started With Drupal
Get Started With Drupal
 
Drupal multisite
Drupal multisiteDrupal multisite
Drupal multisite
 

Último

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Multisite Van Dyk Walkah

  • 1. Demystifying Multisite Architecture John VanDyk and James Walker Do It With Drupal, December 2008 1
  • 2. What is Multisite? How Multisite Works Sharing Information Between Sites 2 three sections to this presentation, lots of time for questions
  • 3. http://www.example.com http://banana.example.com http://www.example.com/apple http://pancakeblog.net 3 You can always have multiple Drupal sites on a server, with multiple copies of Drupal
  • 4. http://www.example.com http://banana.example.com http://www.example.com/apple http://pancakeblog.net 4 We’re talking about having multiple sites on ONE copy of Drupal.
  • 5. Why? 5
  • 6. 6
  • 7. • Only one copy of the codebase 6
  • 8. • Only one copy of the codebase • Only one codebase to upgrade 6
  • 9. • Only one copy of the codebase • Only one codebase to upgrade • Only one set of files to debug 6
  • 10. • Only one copy of the codebase • Only one codebase to upgrade • Only one set of files to debug • Still have flexibility for site-specific modules 6
  • 11. 7 Drupal has three essential components. The filesystem contains the files that make up the Drupal codebase.
  • 12. $db_url = 'mysqli://joe:secret@localhost/example'; 8 The database contains content and most configuration settings.
  • 13. example $db_url = 'mysqli://joe:secret@localhost/example'; 8 The database contains content and most configuration settings.
  • 14. example $db_url = 'mysqli://joe:secret@localhost/example'; 8 The database contains content and most configuration settings.
  • 15. 9 The files directory contains uploaded files.
  • 16. 10 If using private files, the files directory can be outside of the web root.
  • 18. CONFIGURATION: initialize configuration. EARLY PAGE CACHE DATABASE: initialize database layer. ACCESS: identify and reject banned hosts. SESSION: initialize session handling. LATE PAGE CACHE LANGUAGE: identify the language PATH: path handling FULL: Drupal is fully loaded 12
  • 19. CONFIGURATION: initialize configuration. EARLY PAGE CACHE DATABASE: initialize database layer. ACCESS: identify and reject banned hosts. SESSION: initialize session handling. LATE PAGE CACHE LANGUAGE: identify the language PATH: path handling FULL: Drupal is fully loaded 13 Multisite happens here.
  • 20. We’ve got a request for http://www.example.com/ That’s from host www.example.com, path / Let’s look for a settings file at 14 What normally happens.
  • 21. We’ve got a request for http://www.example.com/ That’s from host www.example.com, path / Let’s look for a settings file at sites/www.example.com/settings.php 14 What normally happens.
  • 22. We’ve got a request for http://www.example.com/ That’s from host www.example.com, path / Let’s look for a settings file at sites/www.example.com/settings.php sites/example.com/settings.php 14 What normally happens.
  • 23. We’ve got a request for http://www.example.com/ That’s from host www.example.com, path / Let’s look for a settings file at sites/www.example.com/settings.php sites/example.com/settings.php sites/com/settings.php 14 What normally happens.
  • 24. We’ve got a request for http://www.example.com/ That’s from host www.example.com, path / Let’s look for a settings file at sites/www.example.com/settings.php sites/example.com/settings.php sites/com/settings.php sites/default/settings.php 14 What normally happens.
  • 25. http://www.example.com http://banana.example.com 15 We’re talking about having multiple sites on ONE copy of Drupal.
  • 26. $db_url = 'mysqli://jdoe:secret@localhost/banana'; $db_url = 'mysqli://moe:shhhh@localhost/www'; 16 Now banana.example.com will get a site using the banana database; everything else gets the www database.
  • 27. $db_url = 'mysqli://jdoe:secret@localhost/banana'; banana $db_url = 'mysqli://moe:shhhh@localhost/www'; 16 Now banana.example.com will get a site using the banana database; everything else gets the www database.
  • 28. $db_url = 'mysqli://jdoe:secret@localhost/banana'; banana example $db_url = 'mysqli://moe:shhhh@localhost/www'; 16 Now banana.example.com will get a site using the banana database; everything else gets the www database.
  • 29. $db_url = 'mysqli://jdoe:secret@localhost/banana'; banana example $db_url = 'mysqli://moe:shhhh@localhost/www'; 16 Now banana.example.com will get a site using the banana database; everything else gets the www database.
  • 30. $db_url = 'mysqli://jdoe:secret@localhost/banana'; banana example $db_url = 'mysqli://moe:shhhh@localhost/www'; 16 Now banana.example.com will get a site using the banana database; everything else gets the www database.
  • 31. Edge case http://www.example.com/something 17 Need a symlink
  • 33. CCK and Views available for all sites porcupine theme available for all sites 19
  • 34. 20
  • 35. fivestar module only available on banana.example.com 20
  • 36. fivestar module only available on banana.example.com bananator module only available on banana.example.com 20
  • 37. fivestar module only available on banana.example.com bananator module only available on banana.example.com gobananas theme only available on banana.example.com 20
  • 38. 21 Each site has its own place to put uploaded files.
  • 39. http://www.example.com/sites/www.example.com/files/ image.jpg 22 mod_rewrite can help make your URLs more friendly
  • 40. http://www.example.com/sites/www.example.com/files/ image.jpg RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L] 22 mod_rewrite can help make your URLs more friendly
  • 41. http://www.example.com/sites/www.example.com/files/ image.jpg RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L] http://www.example.com/files/image.jpg 22 mod_rewrite can help make your URLs more friendly
  • 42. Summary So Far • Single codebase • Everything in sites/all is shared: modules, themes • Site-specific modules and themes go in sites/sitename/ • Each site has its own file uploads directory 23
  • 43. Cron! 24
  • 45. Updating a Drupal Site example 26 The database contains content and most configuration settings.
  • 46. Updating a Drupal Site example 26 The database contains content and most configuration settings.
  • 47. Updating a Drupal Site example 26 The database contains content and most configuration settings.
  • 48. Updating Multisite banana cherry 27 Running update.php once is not enough!
  • 49. Updating Multisite banana cherry 27 Running update.php once is not enough!
  • 50. Updating Multisite banana cherry 27 Running update.php once is not enough!
  • 51. Updating Multisite banana cherry 27 Running update.php once is not enough!
  • 52. Updating Multisite banana cherry 27 Running update.php once is not enough!
  • 53. Updating Multisite banana cherry 27 Running update.php once is not enough!
  • 54. What is Multisite? How Multisite Works Sharing Information Between Sites 28
  • 55. Table Prefixing 29 Prefixing originally for multiple Drupal sites on cheap hosting
  • 56. Table Prefixing 29 Prefixing originally for multiple Drupal sites on cheap hosting
  • 57. Table Prefixing $db_prefix = 'zoinks_'; 29 Prefixing originally for multiple Drupal sites on cheap hosting
  • 58. $db_prefix = array( 'default' => 'main_', 'users' => 'shared_', 'sessions' => 'shared_', 'role' => 'shared_', 'authmap' => 'shared_', ); 30 settings.php
  • 59. $db_prefix = array( 'default' => '', 'users' => 'shared.', 'sessions' => 'shared.', 'role' => 'shared.', 'authmap' => 'shared.', ); shared.users databasename.tablename 31 settings.php
  • 60. access actions example actions_aid authmap ... 32 What will happen with this arrangement? Nothing different! The location of the two tables has just changed (users and authmap tables in the example database are unused).
  • 61. users shared authmap access actions example actions_aid authmap ... 32 What will happen with this arrangement? Nothing different! The location of the two tables has just changed (users and authmap tables in the example database are unused).
  • 62. users shared authmap access actions example actions_aid authmap ... 32 What will happen with this arrangement? Nothing different! The location of the two tables has just changed (users and authmap tables in the example database are unused).
  • 63. access actions banana actions_aid authmap ... access actions example actions_aid authmap ... 33 Still no change in behavior!
  • 64. users shared authmap access actions banana actions_aid authmap ... access actions example actions_aid authmap ... 33 Still no change in behavior!
  • 65. users shared authmap access actions banana actions_aid authmap ... access actions example actions_aid authmap ... 33 Still no change in behavior!
  • 66. users shared authmap access actions banana actions_aid authmap ... access actions example actions_aid authmap ... 33 Still no change in behavior!
  • 67. “Logged in” means • Cookie containing session ID • Entry in sessions table containing session ID • Entry in users table 34
  • 68. users shared authmap $user sessions banana role 35
  • 69. users shared authmap $user sessions banana role sessions example role 36
  • 70. Share user, authmap Separate login on each site Simultaneous logins! User record shared Roles are not shared Role assignments are not shared 37
  • 71. Share user, authmap Separate login on each site Simultaneous logins! User record shared Roles are not shared Role assignments are not shared 37
  • 73. users authmap shared sessions $user role banana 39
  • 74. users authmap shared sessions $user $db_prefix = array( role banana 'default' => '', 'users' => 'shared.', 'authmap' => 'shared.', 'sessions' => 'shared.', ); 39
  • 76. What happens? • Log into http://banana.example.com 40
  • 77. What happens? • Log into http://banana.example.com • Go to http://www.example.com 40
  • 78. What happens? • Log into http://banana.example.com • Go to http://www.example.com • We’re not logged in! 40
  • 79. What happens? • Log into http://banana.example.com • Go to http://www.example.com • We’re not logged in! • Huh? 40
  • 80. What’s wrong with this picture? SESS0787a3dbcceb3bde85599fd17a876fa8de: d977085b070ee1f8def0fa7c2fb26ada SESS2611eb8d937302f9383947cd79a86d6888: 26bd9e318d607b0581696431bcfb93b1 41
  • 83. What happens? • Log into http://banana.example.com 43
  • 84. What happens? • Log into http://banana.example.com • Go to http://www.example.com 43
  • 85. What happens? • Log into http://banana.example.com • Go to http://www.example.com • We’re already logged in! 43
  • 86. What happens? • Log into http://banana.example.com • Go to http://www.example.com • We’re already logged in! • Yay! 43
  • 87. user, authmap, sessions + $cookie_domain One login for all sites User record shared Roles are not shared Role assignments are not shared 44
  • 88. users authmap shared sessions role $user banana 45
  • 89. users authmap shared sessions role $user $db_prefix = array( banana 'default' => '', 'users' => 'shared.', 'authmap' => 'shared.', 'sessions' => 'shared.', 'role' => 'shared.', ); 45
  • 90. 46
  • 91. user, authmap, sessions, role + $cookie_domain One login for all sites User record shared Role names/ids shared Role assignments are not shared 47
  • 92. users authmap sessions shared role users_roles $user banana 48
  • 93. users authmap sessions shared role users_roles $user $db_prefix = array( 'default' => '', banana 'users' => 'shared.', 'authmap' => 'shared.', 'sessions' => 'shared.', 'role' => 'shared.', 'users_roles' => 'shared.', ); 48
  • 94. user, authmap, sessions, role, users_roles + $cookie_domain One login for all sites User record shared Role names/ids shared Role assignments shared 49
  • 95. User Role Login Role record assignment user + sessions * + role + users_role 50
  • 96. Caution! 51
  • 98. Caution! • Table contention • Database updates 51
  • 99. Caution! • Table contention • Database updates • Don’t share role assignments and not role IDs! 51
  • 100. Caution! • Table contention • Database updates • Don’t share role assignments and not role IDs! • Think it out using stories! 51
  • 101. What is Multisite? How Multisite Works Sharing Information Between Sites 52