Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Overview of Working with Multiple Drupal Sites

Video loading...

  • 0:01
    Overview of Working with Multiple Drupal Sites
  • 0:03
    with Addison Berry
  • 0:05
    Building one Drupal site
  • 0:06
    can be a fair amount of work in and of itself.
  • 0:09
    But what about building multiple sites, especially
  • 0:12
    if they're related in some way?
  • 0:14
    Sometimes you might have several sites
  • 0:15
    that make sense to build together in some fashion.
  • 0:19
    This could be due to maintenance reasons
  • 0:21
    or it could be because there's an overlap between content or users
  • 0:25
    or something like that between these various sites.
  • 0:28
    There are a lot of different ways to actually handle this in Drupal.
  • 0:32
    It's very much going to depend on what
  • 0:34
    your specific use case is, how to approach that.
  • 0:38
    So in this lesson we're going to dive into what this problem is
  • 0:41
    that gets posed when we're working with multiple sites
  • 0:45
    that we want to integrate in some way.
  • 0:48
    We'll look at some specific use cases
  • 0:50
    and then talk about different ways, some broad categories
  • 0:54
    for how to address them, depending on sort
  • 0:56
    of a general idea of the use case.
  • 0:59
    And then we'll talk about some of the specific modules
  • 1:02
    or architectural decisions that you can make to address the problems
  • 1:07
    in these particular use cases that we're going to look at.
  • 1:10
    So we're going to just get an overview of what it means to work
  • 1:13
    with multiple sites and the different ways
  • 1:16
    that we can approach this in Drupal.
  • 1:19
    So let's start off by taking a look at what are the problems
  • 1:22
    that people are trying to solve when they are trying to deal
  • 1:26
    with having multiple sites in their setup.
  • 1:30
    So the initial thought and classic example
  • 1:34
    is when you have sites that have the same structure
  • 1:36
    and the same features.
  • 1:37
    So you kind of have a cookie cutter mold for the same kind of site;
  • 1:43
    it's having the same stuff and you have the same features on it.
  • 1:46
    And so instead of having to recreate that from scratch over and over
  • 1:50
    again, is there a way to have multiple sites
  • 1:52
    running off that same structure?
  • 1:55
    Another thing that often comes up that people end up implementing
  • 1:58
    multiple sites for, is wanting to have access control locked down,
  • 2:05
    often by sort of an area or section.
  • 2:08
    And so people will build multiple sites,
  • 2:11
    a site per section so they have that fine-grained access
  • 2:15
    control that they need for the sections.
  • 2:18
    And then there's also the classic where you have different sites,
  • 2:21
    but they need to share content and/or users on one site
  • 2:27
    need to have access on the other site as well.
  • 2:30
    But it's not all one site.
  • 2:32
    You want things to actually be different.
  • 2:34
    There are other things that are going on.
  • 2:36
    But there is some overlap in either content or users on the site,
  • 2:40
    and this is a classic issue that comes up.
  • 2:44
    So when you're looking at building multiple sites,
  • 2:48
    here are a couple questions to think through in order to help you zero
  • 2:51
    in on what's the best approach to accomplish your goal.
  • 2:55
    So are you going to be sharing any of the content between the sites?
  • 2:58
    This is kind of a big deal and it's going to definitely change how you
  • 3:03
    solve the problem if you do you have to share that content.
  • 3:06
    And there are different ways of sharing content.
  • 3:08
    So we'll talk a little bit more about that.
  • 3:10
    Do you need user access control to be different?
  • 3:14
    So if you have a user on this site, are they
  • 3:15
    going to have different access control, and rights,
  • 3:18
    and responsibilities on the different sites?
  • 3:21
    And then we have the do you have to share
  • 3:23
    a domain name or infrastructure?
  • 3:25
    Like do you have a server where you have just one area that you can
  • 3:28
    have these things and you have to make everything fit there?
  • 3:31
    Do you have multiple needs on the sites
  • 3:34
    but you need to have them all under one domain name,
  • 3:37
    so it appears as though it is one site?
  • 3:40
    So these are important things that will determine how you end up
  • 3:44
    fixing the problem that you're facing.
  • 3:47
    So some points to consider here that we're going to look at.
  • 3:51
    Content, storage sharing, and canonical location.
  • 3:55
    So when you write a blog post, where does that blog post live?
  • 4:00
    Like where's its original home?
  • 4:02
    And how and where do you need to share that piece of content?
  • 4:07
    Is it only going to be on one quote, unquote "site," or does
  • 4:10
    it need to go across multiple sites, but still you're
  • 4:13
    going to have to decide where the home is for that piece of content,
  • 4:16
    where it originally gets created.
  • 4:18
    Of course we have users, profiles, permissions.
  • 4:21
    I mean there's the user, but there's also the user has a profile.
  • 4:24
    Does the profile need to be shared or do
  • 4:26
    they just need login access that's the same?
  • 4:29
    Feature and style standardization.
  • 4:31
    So we're talking about theming or having a feature, like we have
  • 4:35
    a feature that is a blog and that should remain the same
  • 4:38
    across all sites, or it's going to be different on different sites.
  • 4:42
    And again, themes is a huge one where often you have
  • 4:45
    a similar structure, but you want things to look different.
  • 4:48
    Site administration and code and server management.
  • 4:51
    So if you have a whole bunch of sites, managing each of those
  • 4:55
    individually as separate code bases and making sure that things are--
  • 4:59
    security updates and those kinds of things happen,
  • 5:02
    can lead you to consider multi-site in terms
  • 5:04
    of being able to better manage that.
  • 5:07
    It's a double-edged sword though, because having multiple sites being
  • 5:10
    managed from one code base simplifies things.
  • 5:13
    All of your sites are then tied to that.
  • 5:15
    So you have to really weigh this out and figure out
  • 5:18
    what is the bigger win for your situation.
  • 5:22
    And then, of course, we also have just performance.
  • 5:25
    If you only have one code base and you're just running those things
  • 5:28
    and it gets cached, and PHP, and on the server,
  • 5:31
    then a multi-site like a classic Drupal multi-site installation
  • 5:36
    could run a lot faster.
  • 5:38
    But given that there's a lot of caching and performance things
  • 5:41
    you can do on your site, these days it doesn't tend to be a make
  • 5:46
    or break difference, but it's just something for you
  • 5:48
    to consider and be aware of when you're making your decisions,
  • 5:51
    and make sure that you are testing that.
  • 5:55
    So three infrastructures.
  • 5:57
    These are three different approaches for how to solve the problems
  • 6:01
    that we've been discussing and the things that we need to consider.
  • 6:05
    We'll cover each of these individually here.
  • 6:07
    So the first way to go about this, of course,
  • 6:09
    is simply to build separate sites.
  • 6:11
    I mean that's a classic way of doing it.
  • 6:13
    It's very straightforward.
  • 6:15
    You literally build a separate site for each of your needs.
  • 6:19
    Multiple sites on the same code base.
  • 6:21
    So when most people refer to multisite that's
  • 6:23
    what they're referring to.
  • 6:25
    You have one Drupal code base, but you have different databases.
  • 6:30
    And then you have a single site with restricted access.
  • 6:33
    So you have just one single site, but you make it feel or function
  • 6:37
    as though it has multiple sections that can be configured differently.
  • 6:42
    So you don't actually need to necessarily
  • 6:44
    build out separate sites.
  • 6:46
    You can have it all in one, but you need
  • 6:47
    to be able to create those sections that you're looking for.
  • 6:50
    So we'll start off with separate sites.
  • 6:53
    Again, full autonomy.
  • 6:54
    There's no central management here.
  • 6:55
    Each site is an island unto itself.
  • 6:58
  • 6:58
    Very straightforward.
  • 7:00
    If you need to have consistency of features on the site,
  • 7:04
    you can use Features module.
  • 7:06
    You can use things like installation profiles.
  • 7:09
    Drush, Aegir are also other tools, depending on what kind
  • 7:12
    of consistency it is you're looking for.
  • 7:14
    And this is sort of that cookie cutter mold of--
  • 7:16
    and building a lot of the same sites in the same way,
  • 7:20
    and I just want to have them set up the same way every time.
  • 7:24
    You can use a lot of these other tools
  • 7:27
    to be able to create those individual sites without having
  • 7:30
    to manually go through all of the setup
  • 7:31
    work that's involved with that.
  • 7:33
    When it comes to content, if you want to share content
  • 7:36
    between sites, you don't necessarily have
  • 7:38
    to have it all be on the same database.
  • 7:40
    I mean sites communicate on the web to each other
  • 7:43
    all the time sharing their data.
  • 7:45
    And so in Drupal we have Feeds, Services, and Migrate modules which
  • 7:50
    can all be used in slightly different ways
  • 7:53
    for transferring data between sites.
  • 7:55
    So it doesn't have to be somebody else's website out on the web.
  • 7:59
    It can also be your own sites that you're managing that provide
  • 8:02
    and ingest this kind of data.
  • 8:04
    And again, for user access, you don't necessarily
  • 8:08
    need to have all the same users in the database.
  • 8:12
    If you have multiple sites but you don't want people to have to have
  • 8:15
    a different account on every single one, you can use single sign on.
  • 8:19
    Like there's a whole process, there's
  • 8:20
    a module for setting up single sign on between sites
  • 8:25
    so that you don't actually have to have the database be the same.
  • 8:28
    So those are some ways of using separate sites.
  • 8:31
    It works well, and there are a lot of ways to be able to integrate
  • 8:34
    separate sites, so they're related but not actually built
  • 8:37
    necessarily in the same infrastructure.
  • 8:41
    So multiple sites with the same code base.
  • 8:44
    This is the classic Drupal core multisite feature that you hear
  • 8:50
    spoken of quite often in this context.
  • 8:52
    So you have one Drupal code base and you have different databases
  • 8:56
    for each site.
  • 8:58
    And that allows you to have different content, different users,
  • 9:02
    things like different themes.
  • 9:04
    You can do all of those things because you
  • 9:06
    have a separate database.
  • 9:07
    Everything about it is separate.
  • 9:09
    But you don't necessarily have single sign on.
  • 9:12
    You can do some things with sharing users
  • 9:17
    between these separate databases, but it's
  • 9:19
    pretty-- it's not designed to work that way necessarily.
  • 9:23
    So you may find yourself wading through some heavy stuff
  • 9:27
    to try and do something like that with a classic multisite.
  • 9:32
    But the classic multisite setup is you essentially
  • 9:36
    have three separate websites-- kind of like the separate sites we just
  • 9:40
    looked at.
  • 9:41
    It's just that you're actually using the same code base.
  • 9:43
    So all three can use the same Views module code.
  • 9:46
    You don't have to have three versions
  • 9:48
    of the Views module code on your server.
  • 9:50
    You can just have one and all of them can use that and share it.
  • 9:53
    But when it comes to the database side of things
  • 9:55
    those are all separate.
  • 9:57
    Domain Access only has one database, but it
  • 10:00
    has multiple sites in that database.
  • 10:03
    And so you can decide whether you want
  • 10:05
    to share content or not with that.
  • 10:07
    And you can have just one user account
  • 10:10
    that runs across all of those things.
  • 10:12
    So Domain Access is also a way to be able to do this with having,
  • 10:17
    literally, multiple sites, multiple domain names,
  • 10:19
    and that kind of a thing, but all running
  • 10:21
    on just one code base and one database.
  • 10:26
    And then a single site with restricted access.
  • 10:28
    A lot of, like I said, multisite people
  • 10:30
    build different sites because they need different sections.
  • 10:33
    There are lots of ways to approach that in Drupal other
  • 10:36
    than separate sites.
  • 10:37
    So you can use Domain Access for that
  • 10:41
    to break things out on the site.
  • 10:43
    We have Organic Groups which creates access
  • 10:46
    control areas, groups on the site.
  • 10:49
    And Workbench works not in terms of necessarily controlling it
  • 10:54
    by the URL you land on or something, but it controls
  • 10:57
    who can do what with what kinds of content.
  • 11:02
    So this is a very nice editorial control process.
  • 11:07
    Only you can manage stuff that's happening
  • 11:09
    in the international section of the site,
  • 11:12
    and different people have access to the local content
  • 11:14
    that's happening on the site.
  • 11:16
    So these are great modules to use if you really are just looking
  • 11:20
    for sections and access control, rather than
  • 11:24
    the whole infrastructure issues that we talked about with the others.
  • 11:28
    These are three different ways of approaching it,
  • 11:31
    and these are different tools within Drupal.
  • 11:32
    You can see there are a lot of different tools that are available,
  • 11:35
    and we've got a bunch of modules listed on these various pages here.
  • 11:41
    We have what comes with core.
  • 11:43
    So again, it depends on what your use case is.
  • 11:46
    Kind of walk through the questions and the things
  • 11:47
    that you want to consider.
  • 11:49
    And then you can snap together what you need,
  • 11:52
    depending on what your real need is.
  • 11:54
    Sometimes people end up implementing the wrong solution for the problem
  • 12:00
    that they're actually trying to face,
  • 12:01
    and that causes more headaches than it does help.

Overview of Working with Multiple Drupal Sites


Building one Drupal site is a fair amount of work in and of itself. But what about working with multiple Drupal sites? Sometimes you have a few sites that make sense together, either from a maintenance perspective, or due to an overlap in content or users. There are a number of different ways to approach this in Drupal, and which path you follow varies considerably depending on the exact use case you need to fulfill. In this lesson we'll get a good look at the problem multiple sites can pose, and list out some common use cases. Then we'll take a look at three different broad categories of solutions, with some specific architectural approaches. The rest of this series will walk through managing multiple sites using Drupal core's built-in multisite system.

If you are interested in working with the Domain Access project instead of core multisite, you should look at the Introduction to Domain Access series.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.