One of the most common tasks you'll accomplish while developing or maintaining a Drupal application is adding a Drupal contributed module. If you are used to working in a local installation of Drupal, you may be used to doing this directly in the Drupal admin interface, using the core Update Manager module, or perhaps with Drush, using the
drush dl command. If your application is hosted on Acquia Cloud, the module directories are part of the code repository, which is not directly writable. This means that you can't directly add a module using the Update Manager,
drush dl, or SFTP. Instead, you must commit your changes using a version control system (Git).
There are several different approaches you can take. This topic describes two of them:
- Add the module to your local code base, and then commit it
- Install the module on an Acquia Cloud environment using Live Development, and then commit it
Another useful approach is to develop your application locally using Acquia Dev Desktop, add new modules using local tools like Drush or the Update Manager, and then push the code to Acquia Cloud with Acquia Dev Desktop.
Adding the module locally
To add a module to your local code base, and then commit it:
- Get SSH access to your Acquia Cloud server, if you don't already have it.
- Install Git locally, if you haven't already done so.
- Check out a local copy of the code repository.
- Change directory into the new local copy of the repository.
- Create a feature branch to test the module. In this example, we'll assume that we're installing the Foo module, so we'll call the feature branch
git checkout -b foo
- Change directory into your modules directory (
- Download and add the contributed module to the modules directory in the feature branch. For example:
curl http://ftp.drupal.org/files/projects/foo.tar.gz | tar fz
- Commit the new module code into the Acquia Cloud repository.
- Deploy the feature branch to your Development or Staging environment for testing.
- Using the Drupal admin UI or Drush, enable and configure the new module.
Installing using Live Development
Using Live Development mode, you can temporarily make the docroot of your Development environment writable, so you can add modules or make other changes.
Here are the steps for installing a module on an Acquia Cloud environment using Live Development, and then committing it. It's very important that you commit your changes to your Acquia Cloud code repository before you disable Live Development. Otherwise, the new module won't be part of your application's code base. If your application's database thinks the new module is enabled, but it can't be found, this can cause havoc.
- Enable Live Development on your Development environment. Live Development is available for non-Production environments only.
- Sign in to your Drupal application and go to the application's
- Enable the Update Manager, if it isn't already enabled.
- On the
/admin/modulespage, click Install new module and use the Update Manager to install the module.
- Enable and configure the module, and then test it on your Acquia Cloud Development environment.
- Connect to your Acquia Cloud server using SSH.
- Change directory to your application's live development directory,
- Commit your changes to your Acquia Cloud code repository.