Environment Makefile

Categories

Component ID

2313227

Component name

Environment Makefile

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Environment Makefile

Environment makefile allows you to auto-enable or disable modules based on your site's makefile and environment. This would allow you to specify development modules such as devel, or production-only modules such as production monitor in one makefile that will be enabled or disabled when you run Drush.

Requirements

  • Drupal 7.x
  • PHP 5.3+

Configuration

To configure production environments, have your system administrator configure the ENVTYPE environment variable, setting to production, staging, dev, or local as appropriate.

In linux, add a /etc/profile.d/envtype.sh file:

#!/bin/bash
ENVTYPE=production
readonly ENVTYPE
export ENVTYPE

Configure your virtual host in Apache with:

SetEnv ENVTYPE production

Optional Configuration

To set an alternate set of production environments, use strongarm or $conf array to set the environment_makefile_product_environments variable:

$conf['environment_makefile_product_environments'] = array(
  'prod',
  'stag',
  'test',
);

Makefile location

environment_makefile assumes your makefile will be located in a makefiles directory adjacent to the Drupal webroot, and named to match the parent directory:

example.com/
├── makefiles
│     └── example.com.make
└── webroot

If you would like to specify the full path to your makefile, use strongarm or $conf to set the makefile_path variable.

To Use

environment_makefile uses an augmented drush make file to manage the enabling and disabling of modules in your Drupal deployment environments.

In your makefile, you can specify modules and submodules that should be enabled or disabled by using the following groupings:

  • enabled: these modules will be enabled in all environments
  • disabled: these modules will be disabled in all environments
  • dev_only: these modules will be disabled in production environments, and enabled everywhere else.

Example Makefile

core = 7.x

api = 2

projects[drupal][version] = "7.28"

disabled[] = overlay
disabled[] = dashboard

projects[ctools][subdir] = "contrib"
projects[ctools][version] = "1.4"
enabled[] = ctools
enabled[] = views_content
dev_only[] = bulk_export

Drush Support

Drush is the primary means of initiating environment_makefile.

drush @alias environment-makefile # alias envm