Drupal 8 multisite platform with composer.
🔔 This tool is under heavy construction, there are no releases at all.
d8ms is a multisite platform intended to use as a base for several subsites that share most of the code. By using composer with "wikimedia/composer-merge-plugin", all the composer.json files living in configuration and profile directories are merged with the main composer.json file to generate a unique composer.lock file that will be shared by all subsites.
This platform works with three layers:
- This repository which is the base for all subsites sharing most of the code;
- The profile repository which is defines common themes and modules for all subsites;
- The subsites repositories that have the custom themes, modules and configuration files unique for each subsite.
- Clone this repo
- Run composer install
- Configure settings files
- Create the file drush/aliases.drushrc.local.phpbased indrush/aliases.drushrc.php
- Create the file web/sites/sites.local.phpbased inweb/sites/sites.php
- Create the file web/sites/settings.allsites.local.phpbased inweb/sites/settings.allsites.php
- Setup subsite configuration structure
- Run git clone git@github.com:dxvargas/d8ms-subsite.git subsite/default
- Make symlinks for the subsite directories
- Run cd config
- Run ln -s ../subsite/default/config default
 
- Run 
- Install Drupal
- Run cd ../webanddrush @default site-install -vy --account-name=admin --account-pass=admin --config-dir=../config/default/sync
- Verify that sites are working: drush @default status
 
- Run 
- Follow the instructions in Getting Started
- Configure settings files
- Run cp -r web/sites/default web/sites/foo && rm -rf web/sites/foo/files/*
- Add entry for fooindrush/aliases.drushrc.local.php
- Add entry for fooinweb/sites/sites.local.php
- Probably you'll need to add a new entry to "trusted_host_patterns" in settings.allsites.local.php
- Setup subsite configuration structure
- Run git clone git@github.com:dxvargas/d8ms-subsite.git subsite/foofor an example how configuration directories should be, in a final step you will change the repository info
- Make symlinks for the subsite directories
- Run cd config
- Run ln -s ../subsite/foo/config foo
 
- Run 
- Install Drupal
- Run cd ../webanddrush @foo site-install -vy --account-name=admin --account-pass=admin --config-dir=../config/foo/sync
- Verify that sites are working: drush @foo status
 
- Run 
- Configure subsite/foo to have it's own repository
- Usually you will also want to have custom themes and modules, you can store
them in subsite/fooand add symlinks in usual directories
- Follow the instructions in Getting Started
- Configure settings files
- Run cp -r web/sites/default web/sites/foo && rm -rf web/sites/foo/files/*
- Add entry for fooindrush/aliases.drushrc.local.php
- Add entry for fooinweb/sites/sites.local.php
- Probably you'll need to add a new entry to "trusted_host_patterns" in settings.allsites.local.php
- Setup subsite configuration structure
- Run git clone git@github.com:dxvargas/d8ms-subsite.git subsite/foofor an example how configuration directories should be, in a final step you will change the repository info
- Make symlinks for the subsite directories
- Run cd config
- Run ln -s ../subsite/foo/config foo
- Run cd ..
 
- Run 
- Put a Drupal profile in place
- Run git clone git@github.com:dxvargas/d8mspro.git web/profiles/d8mspro
- Run composer install
 
- Run 
- Install Drupal
- Run cd webanddrush @foo site-install d8mspro -vy --account-name=admin --account-pass=admin
- Verify that sites are working: drush @foo status
 
- Run 
- Configure subsite/foo to have it's own repository
- Export configuration, run drush @foo cex
- Usually you will also want to have custom themes and modules, you can store
them in subsite/fooand add symlinks in usual directories
- Many of the steps for first install and creating a new subsite should be automated with scripts;
- Packages that come from a secondary composer.json (via "wikimedia/composer-merge-plugin") should be downloaded into a path relative to that composer.json;
- Implement a deployment strategy;
- If subsite configuration structure is only for sync files, the repository can be cloned directly there. If so, you it is not needed to use symlinks;
- Thanks for the inspiration of multiplesite project from Moshe Weitzman.