I set up a local Drupal 8 multisite, using Acquia dev desktop. It's working fine. I added all Drupal 8 core files to my local repository and pushed them to a central remote repository.

  • in sites/default/settings.php I added $config_directories['staging'] = 'sites/default/config/staging';to make the configuration directory versionable.
  • All sites (main site, subside1 and subside2) has different databases

But what about the sites/subside1/ and sites/subside2/ config files? Do I have to add also a different path for those files? Do those have to be versioned or not?

I want to clone my repo to make instances of this multisite for staging and live environments.

  • You can have a configuration directory per site per environment. Or only per environment. Or only per site. – Eyal Apr 12 '16 at 16:36
  • I have one default site (site 1) and to other sites (site 2) and (site 3). They are 3 different sites but with the same kind of template. What do you for $config_directories ? – meez Apr 12 '16 at 16:51
  • 1
    It's up to you. You can have it either way. – Eyal Apr 12 '16 at 18:00

It's a little bit up to you how you manage your config. In my multisites I have a ../config directory outside the web root. Each site instance then has it's own folder in there. And inside each one I split the config per environment.

shared/ holds the config that is similar on all environments. local/ holds all the extra config for local development. And live/ holds the extra config for the live site. This can be achieved using the Config Split module.

├── config/
│   ├── bar/
│   │   ├── live/
│   │   ├── local/           
│   │   └── shared/
│   └── foo/
│       ├── live/
│       ├── local/
│       └── shared/
└── web/
    └── sites/
        ├── bar/
        └── foo/

The settings.php config for the foo/ instance then looks like this:

$config_directories['sync'] = '../config/foo/shared';

And the Git-ignored settings.local.php on my local machine looks like this:

$config['config_split.config_split.local']['status'] = TRUE;
$config['config_split.config_split.live']['status'] = FALSE;

Whereas on the live server it looks like this:

$config['config_split.config_split.local']['status'] = FALSE;
$config['config_split.config_split.live']['status'] = TRUE;
| improve this answer | |

if you are okay with the configs for the subsites mixing with the default site then you can set the config directory to be the same as is in default/settings.php by adding to the sites/subsite1/settings.php and sites/subsite2/settings.php

$config_directories['sync'] = '../config/sync';

(relative to the site root, not subsite root)

if you want to manage the subsite configs completely separate from the default site then you could in theory set these unique to each site - so in sites/subsite1/settings.php

$config_directories['sync'] = '../config/subsite1_sync';

... this possibly might be more problematic since you now have as many discrete configs as you do subsites, but it depends on what config settings you need to sync I suppose.

this is also explained more by @AjitS here: https://drupal.stackexchange.com/a/271321/91863 - where it is also recommended to explore the config_split and config_filter contrib modules

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.