Additional Sites - ryanblyth/wiki-sandbox GitHub Wiki
After creating the initial base box and Drupal install, you can create additional sites in one of two ways.
Method 1
Create an additional site that uses the same VM you have already created. This method allows you to reuse the same VM for multiple sites, which saves your computer's resources.
1.Edit the drupal_lamp.json located in the Infrastructure directory.
2.Copy the code located within the "example:" brackets.
"example": {
"active": true,
"deploy": {
"action": "clean",
"releases": 1
},
"drupal": {
"version": 8.0,
"install": {
"install_configure_form.update_status_module": "'array(FALSE,FALSE)'",
"--clean-url": 1
},
"settings": {
"profile": "standard",
"files": "sites/default/files",
"custom": "sites/default/example.settings.php",
"settings": "sites/default/settings.php",
"cookbook": "drupal",
"template": "example.settings.php.erb",
"db_name": "example",
"db_host": "localhost",
"db_prefix": "",
"db_driver": "mysql"
}
},
"repository": {
"host": "github.com",
"uri": "https://github.com/drupal/drupal.git",
"revision": "8.x"
},
"web_app": {
"80": {
"server_name": "drupal.local",
"rewrite_engine": "On",
"docroot": "/srv/www/example/current"
}
}
}
3.Paste that code after the existing "example:" brackets and replace "example" with the name of the additional new site.
"sites": {
"example": {
"active": true,
"deploy": {
"action": "clean",
"releases": 1
},
"drupal": {
"version": 8.0,
"install": {
"install_configure_form.update_status_module": "'array(FALSE,FALSE)'",
"--clean-url": 1
},
"settings": {
"profile": "standard",
"files": "sites/default/files",
"custom": "sites/default/example.settings.php",
"settings": "sites/default/settings.php",
"cookbook": "drupal",
"template": "example.settings.php.erb",
"db_name": "example",
"db_host": "localhost",
"db_prefix": "",
"db_driver": "mysql"
}
},
"repository": {
"host": "github.com",
"uri": "https://github.com/drupal/drupal.git",
"revision": "8.x"
},
"web_app": {
"80": {
"server_name": "drupal.local",
"rewrite_engine": "On",
"docroot": "/srv/www/example/current"
}
}
},
"newsite": {
"active": true,
"deploy": {
"action": "clean",
"releases": 1
},
"drupal": {
"version": 8.0,
"install": {
"install_configure_form.update_status_module": "'array(FALSE,FALSE)'",
"--clean-url": 1
},
"settings": {
"profile": "standard",
"files": "sites/default/files",
"custom": "sites/default/example.settings.php",
"settings": "sites/default/settings.php",
"cookbook": "drupal",
"template": "example.settings.php.erb",
"db_name": "newsite",
"db_host": "localhost",
"db_prefix": "",
"db_driver": "mysql"
}
},
"repository": {
"host": "github.com",
"uri": "https://github.com/drupal/drupal.git",
"revision": "8.x"
},
"web_app": {
"80": {
"server_name": "newsite.local",
"rewrite_engine": "On",
"docroot": "/srv/www/newsite/current"
}
}
}
}
Note: Make sure you change the action on your original site from "clean" to "nothing" if you want to keep any edits or new files in the original site. The clean action will perform a new/clean install of all site files when you provision the VM.
"example": {
"active": true,
"deploy": {
"action": "nothing",
"releases": 1
},
"drupal": {
"version": 8.0,
"install": {
"install_configure_form.update_status_module": "'array(FALSE,FALSE)'",
"--clean-url": 1
},
"settings": {
"profile": "standard",
"files": "sites/default/files",
"custom": "sites/default/example.settings.php",
"settings": "sites/default/settings.php",
"cookbook": "drupal",
"template": "example.settings.php.erb",
"db_name": "example",
"db_host": "localhost",
"db_prefix": "",
"db_driver": "mysql"
}
},
"repository": {
"host": "github.com",
"uri": "https://github.com/drupal/drupal.git",
"revision": "8.x"
},
"web_app": {
"80": {
"server_name": "drupal.local",
"rewrite_engine": "On",
"docroot": "/srv/www/example/current"
}
}
}
4.Create a new json file in the chef/data_bags directory. Make sure the filename is the same as the additional site name you just created in step 3. For example if you called the new site "mynewsite", your file should be mynewsite.json.
{
"id": "newsite",
"_default" : {
"db_user": "drupal",
"db_password": "drupal",
"admin_user": "example_admin",
"admin_pass": "admin"
}
}
5.Edit your hosts file and add the IP and host for the site. Use the same IP address that was assigned for the original site. You can use whatever host name you would like, for example mynewsite.local would work well.
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
192.168.50.5 drupal.local
192.168.50.5 newsite.local
6.Provision the VM. (see vagrant instructions.)
Method 2
Create an additional site that uses a a separate new VM.
1.Run the drupal-lamp install (*insert link to command) command again and when prompted assign a new VM name, IP address, and host.
Enter the VM's name you would like to use (this is exposed in virtualbox or vmware). This will also be used as the sitename in drupal configurations. It should not contain anything but letters or numbers. [drupal]:
Enter the VM's IP address you would like to use [192.168.50.5]:
The host for the git repo you are deploying. [drupal.local]: