Additional Service Configurations and Add-ons for ddev¶
DDEV-Local projects can be extended to provide additional add-ons, including services. This is achieved by adding docker-compose files to a project's .ddev directory that defines the added add-on(s).
If you need a service not provided here, see Defining an additional service with Docker Compose
Although anyone can create their own services with a .ddev/docker-compose.*.yaml file, a growing number of services are supported and tested and can be installed with the ddev get command starting with DDEV v1.19.0+.
You can see available supported and tested add-ons with the command ddev get --list. To see all possible add-ons (not necessarily supported or tested), use ddev get --list --all.
For example,
ddev get --list
┌───────────────────────────┬──────────────────────────────────────────────────┐
│ ADD-ON │ DESCRIPTION │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-elasticsearch │ Elasticsearch add-on for DDEV* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-varnish │ Varnish reverse proxy add-on for ddev* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-redis │ redis service for ddev* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-beanstalkd │ beanstalkd for ddev* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-redis-commander │ Redis commander for use with ddev redis service* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-mongo │ mongodb addon for ddev* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-drupal9-solr │ Drupal 9 Apache Solr installation for DDEV* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-pdfreactor │ PDFreactor service for ddev* │
├───────────────────────────┼──────────────────────────────────────────────────┤
│ drud/ddev-memcached │ Install memcached as an extra service in ddev* │
└───────────────────────────┴──────────────────────────────────────────────────┘
Here are some of the add-ons that are officially supported:
- Redis:
ddev get drud/ddev-redis. - Redis Commander:
ddev get drud/ddev-redis-commander. - Elasticsearch:
ddev get drud/ddev-elasticsearch. - Apache Solr for Drupal 9:
ddev get drud/ddev-drupal9-solr. - Memcached:
ddev get drud/ddev-memcached. - Varnish:
ddev get drud/ddev-varnish. - Mongo:
ddev get drud/ddev-mongo. - PDFReactor:
ddev get drud/ddev-pdfreactor - Beanstalkd:
ddev get drud/ddev-beanstalkd.
Creating an additional service for ddev get¶
Anyone can create an add-on for ddev get (see screencast and instructions in ddev-addon-template):
- Click "Use this template" on
ddev-addon-template. - Create a new repository
- Test it and preferably make sure it has valid tests in
tests.bats. - When it's working and tested, create a release.
- Add the label
ddev-getand a good short description to the repository on GitHub. - When you're ready for the add-on to become official, open an issue in the DDEV issue queue requesting upgrade to official. You'll be expected to maintain it of course, and subscribe to all activity and be responsive to questions.
Sections and features of ddev-get add-on install.yaml¶
The install.yaml is a simple yaml file with a few main sections:
pre_install_actionsis an array of bash statements or scripts that will be executed beforeproject_filesare installed. The actions are executed in the context of the target project's root directory.project_filesis an array of files or directories to be copied from the add-on into the target project's .ddev directory.global_filesis an array of files or directories to be copied from the add-on into the target system's global .ddev directory (~/.ddev/).post_install_actionsis an array of bash statements or scripts that will be executed afterproject_filesandglobal_filesare installed. The actions are executed in the context of the target project's root directory.yaml_read_filesis a map ofname: fileof yaml files that will be read from the target project's root directory. The contents of these yaml files may be used as templated actions withinpre_install_actionsandpost_install_actions.
You can see a simple install.yaml in ddev-addon-template's install.yaml.
Environment variable replacements¶
Simple environment variables will be replaced in install.yaml as part of filenames. This can include environment variables in the context of where ddev is being run, as well as the standard environment variables provided to custom host commands, like DDEV_APPROOT, DDEV_DOCROOT, etc. For example, if a file in project_files is listed as somefile.${DDEV_PROJECT}.txt with a project named d10, the file named somefile.d10.txt will be copied from the add-on into the project.
Template action replacements (advanced)¶
A number of additional replacements can be made using go template replacement techniques, using the format {{ .some-gotemplate-action }}. These are mostly for use of yaml information pulled into yaml_read_files. A map of values from each yaml file is placed in a map headed by the name of the yaml file. For example, if a yaml file named `example_yaml.yaml:
is referenced using
then value1 can be used throughout the install.yaml as {{ example.value1 }} and it will be replaced with the value xxx.
More exotic template-based replacements can be seen in advanced test example.
Additional services in ddev-contrib (MongoDB, Elasticsearch, etc)¶
Commonly used services will be migrated from the ddev-contrib repository to individual, tested, supported repositories, but ddev-contrib repository has a wealth of additional examples and instructions:
- ElasticHQ:See ElasticHQ.
- Headless Chrome: See Headless Chrome for Behat Testing
- MongoDB: See MongoDB.
- Old PHP Versions to Run Old Sites: See Old PHP Versions
- RabbitMQ: See RabbitMQ
- TYPO3 Solr Integration: See TYPO3 Solr
Your pull requests to integrate other services are welcome at ddev-contrib.