Leveraging Features and Spaces for Drupal Installation Profiles
There are a few ways in Drupal to create "copies" of a Drupal site that you find you want deploy over and over again.
These include:
- Using the Installation profile Wizard (no Drupal 6 version)
- Features module (can only enable after site has been built out, making it difficult to deploy using Aegir Hosting system)
- Build an Install Profile (using Install Profile API) from scratch. Integrates nicely with Aegir, can be time consuming to put together.
Since the Features module performs many of the tasks of the Installation Profile Wizard (albeit more human interaction is required) we can use it to build the base of our Install Profile. Features can then be exported and included in your installation profile. The exported features are included in the /sites/all/modules/custom folder and will be picked up by the install profile.
function hook_profile_modules() {
return array(
/* core */ 'block', 'color', 'filter', 'help', 'menu', 'node', 'system', 'user',
/* features setup */ 'features', 'permissions-editor'
}
function hook_profile_details() {
return array(
'name' => 'Feature Install Profile',
'description' => 'Select this profile to install Features based Website.'
);
}
So our very simple install profile (full code is listed above) uses the information in the Permissions Editor feature we have previously exported to finish buildout of the site. We can now modularize our install profile. I.e. various role permissions, features to be enabled etc, by modifying the hook_profile_modules function in our installation profile.
While you could accomplish the same thing by simply doing a mysqldump or manually enabling the specific features on your new site, by including them in an install profile, you can easily deploy new websites based on this Feature driven installation profile using the Aegir Hosting System.