Multisite Van Dyk Walkah

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite & 1 Event

    Multisite Van Dyk Walkah - Presentation Transcript

    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.
    17. <?php require_once './includes/bootstrap.inc'; drupal_bootstrap(FULL); 11
    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
    32. http://banana.example.com/fanclub 18
    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
    44. Updating Multisite 25
    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
    72. Shared Logins 38
    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
    75. What happens? 40
    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
    81. $cookie_domain = ‘example.com’ 42
    82. What happens? 43
    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
    97. Caution! • Table contention 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

    + jvandykjvandyk, 11 months ago

    custom

    895 views, 1 favs, 1 embeds more stats

    Drupal Multisite presentation from Do It With Drupa more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 895
      • 894 on SlideShare
      • 1 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 20
    Most viewed embeds
    • 1 views on http://192.168.10.100

    more

    All embeds
    • 1 views on http://192.168.10.100

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags

    Groups / Events