github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/docs/content/users/extend/additional-services.md (about)

     1  ---
     2  search:
     3    boost: 2
     4  ---
     5  
     6  # Additional Service Configurations & Add-ons
     7  
     8  DDEV projects can be extended to provide additional add-ons, including services. You can define these add-ons using docker-compose files in the project’s `.ddev` directory.
     9  
    10  Anyone can create their own services with a `.ddev/docker-compose.*.yaml` file, and a growing number of popular services are supported and tested, and can be installed using the [`ddev get`](../usage/commands.md#get) command.
    11  
    12  Use `ddev get --list` to see available add-ons. To see all possible add-ons (not necessarily supported or tested), use `ddev get --list --all`.
    13  
    14  For example,
    15  
    16  ```
    17  →  ddev get --list
    18  ┌──────────────────────────────────────┬────────────────────────────────────────────────────┐
    19  │ ADD-ON                               │ DESCRIPTION                                        │
    20  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    21  │ ddev/ddev-adminer                    │ Adminer service for DDEV*                          │
    22  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    23  │ ddev/ddev-beanstalkd                 │ Beanstalkd for DDEV*                               │
    24  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    25  │ ddev/ddev-browsersync                │ Auto-refresh HTTPS page on changes with DDEV*      │
    26  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    27  │ ddev/ddev-cron                       │ Schedule commands to execute within DDEV*          │
    28  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    29  │ ddev/ddev-drupal-contrib             │ DDEV integration for developing Drupal contrib     │
    30  │                                      │ projects*                                          │
    31  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    32  │ ddev/ddev-drupal-solr                │ Drupal Apache Solr installation for DDEV (please   │
    33  │                                      │ consider ddev/ddev-solr first)*                    │
    34  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    35  │ ddev/ddev-elasticsearch              │ Elasticsearch add-on for DDEV*                     │
    36  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    37  │ ddev/ddev-memcached                  │ Install Memcached as an extra service in DDEV*     │
    38  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    39  │ ddev/ddev-mongo                      │ MongoDB add-on for DDEV*                           │
    40  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    41  │ ddev/ddev-pdfreactor                 │ PDFreactor service for DDEV*                       │
    42  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    43  │ ddev/ddev-phpmyadmin                 │ phpMyAdmin Add-on For DDEV*                        │
    44  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    45  │ ddev/ddev-platformsh                 │ Add integration with Platform.sh hosting service*  │
    46  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    47  │ ddev/ddev-proxy-support              │ Support HTTP/HTTPS proxies with DDEV*              │
    48  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    49  │ ddev/ddev-redis                      │ Redis service for DDEV*                            │
    50  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    51  │ ddev/ddev-redis-7                    │ Redis 7 service for DDEV*                          │
    52  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    53  │ ddev/ddev-redis-commander            │ Redis Commander for use with DDEV Redis service*   │
    54  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    55  │ ddev/ddev-selenium-standalone-chrome │ A DDEV service for running standalone Chrome*      │
    56  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    57  │ ddev/ddev-solr                       │ Solr service for DDEV*                             │
    58  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    59  │ ddev/ddev-sqlsrv                     │ MS SQL server add-on for DDEV*                     │
    60  ├──────────────────────────────────────┼────────────────────────────────────────────────────┤
    61  │ ddev/ddev-varnish                    │ Varnish reverse proxy add-on for DDEV*             │
    62  └──────────────────────────────────────┴────────────────────────────────────────────────────┘
    63  20 repositories found. Add-ons marked with '*' are officially maintained DDEV add-ons.
    64  ```
    65  
    66  !!!tip
    67      If you need a service not provided here, see [Defining an Additional Service with Docker Compose](custom-compose-files.md).
    68  
    69  Officially-supported add-ons:
    70  
    71  * [Adminer](https://github.com/ddev/ddev-adminer): `ddev get ddev/ddev-adminer`.
    72  * [Apache Solr for Drupal](https://github.com/ddev/ddev-drupal-solr): `ddev get ddev/ddev-drupal-solr`.
    73  * [Beanstalkd](https://github.com/ddev/ddev-beanstalkd): `ddev get ddev/ddev-beanstalkd`.
    74  * [Browsersync](https://github.com/ddev/ddev-browsersync): `ddev get ddev/ddev-browsersync`.
    75  * [cron](https://github.com/ddev/ddev-cron): `ddev get ddev/ddev-cron`.
    76  * [Elasticsearch](https://github.com/ddev/ddev-elasticsearch): `ddev get ddev/ddev-elasticsearch`.
    77  * [Memcached](https://github.com/ddev/ddev-memcached): `ddev get ddev/ddev-memcached`.
    78  * [MongoDB](https://github.com/ddev/ddev-mongo): `ddev get ddev/ddev-mongo`.
    79  * [PDFreactor](https://github.com/ddev/ddev-pdfreactor): `ddev get ddev/ddev-pdfreactor`
    80  * [Platform.sh](https://github.com/ddev/ddev-platformsh): `ddev get ddev/ddev-platformsh`
    81  * [Proxy Support](https://github.com/ddev/ddev-proxy-support): `ddev get ddev/ddev-proxy-support`.
    82  * [Redis Commander](https://github.com/ddev/ddev-redis-commander): `ddev get ddev/ddev-redis-commander`.
    83  * [Redis](https://github.com/ddev/ddev-redis): `ddev get ddev/ddev-redis`.
    84  * [Selenium Standalone Chrome](https://github.com/ddev/ddev-selenium-standalone-chrome): `ddev get ddev/ddev-selenium-standalone-chrome`.
    85  * [Varnish](https://github.com/ddev/ddev-varnish): `ddev get ddev/ddev-varnish`.
    86  
    87  ## Managing Installed Add-Ons
    88  
    89  Add-ons installed in DDEV v1.22+ are versioned and can be viewed by running `ddev get --installed`.
    90  
    91  You can update an add-on by running `ddev get <addonname>`, or remove it by running `ddev get --remove <addonname>`.
    92  
    93  If you have add-ons that were installed before v1.22, update them with `ddev get <addonname>` and they will be versioned and available in `ddev get --installed`.
    94  
    95  ## Adding Custom Configuration to an Add-on
    96  
    97  Sometimes it's necessary to add custom configuration to an add-on. For example, in [`ddev-redis-7`](https://github.com/ddev/ddev-redis-7) the `image` is set to `image: redis:7.2-alpine`. If you wanted to change this to use `7.0-alpine` instead, you would have two choices:
    98  
    99  1. Remove the `#ddev-generated` line in `docker-compose.redis-7.yaml` and edit the relevant line.
   100  2. Add a `.ddev/docker-compose.redis-7_extra.yaml` with the contents:
   101  
   102  ```yaml
   103    services:
   104      redis:
   105        image: redis:7.0-alpine
   106  ```
   107  
   108  Using the second option (`docker-compose.redis-7_extra.yaml`) allows you to update to future versions of `ddev-redis-7` without losing your configuration, and without the upgrade being blocked because you removed the `#ddev-generated` line from the upstream `docker-compose.redis-7.yaml`.
   109  
   110  ## Creating an Additional Service for `ddev get`
   111  
   112  Anyone can create an add-on for `ddev get`. See [this screencast](https://www.youtube.com/watch?v=fPVGpKGr0f4) and instructions in [`ddev-addon-template`](https://github.com/ddev/ddev-addon-template):
   113  
   114  1. Click “Use this template” on [`ddev-addon-template`](https://github.com/ddev/ddev-addon-template).
   115  2. Create a new repository.
   116  3. Test it and preferably make sure it has valid tests in `tests.bats`.
   117  4. When it’s working and tested, create a release.
   118  5. Add the `ddev-get` label and a good short description to the GitHub repository.
   119  6. When you’re ready for the add-on to become official, open an issue in the [DDEV issue queue](https://github.com/ddev/ddev/issues/new) requesting upgrade to official. You’ll be expected to maintain it, and subscribe to all activity and be responsive to questions.
   120  
   121  ### Sections and Features of ddev-get Add-On install.yaml
   122  
   123  The `install.yaml` is a simple YAML file with a few main sections:
   124  
   125  * `pre_install_actions`: an array of Bash statements or scripts to be executed before `project_files` are installed. The actions are executed in the context of the target project’s root directory.
   126  * `project_files`: an array of files or directories to be copied from the add-on into the target project’s `.ddev` directory.
   127  * `global_files`: is an array of files or directories to be copied from the add-on into the target system’s global `.ddev` directory (`~/.ddev/`).
   128  * `dependencies`: an array of add-ons that this add-on depends on.
   129  * `post_install_actions`: an array of Bash statements or scripts to be executed after `project_files` and `global_files` are installed. The actions are executed in the context of the target project’s root directory.
   130  * `removal_actions`: an array of Bash statements or scripts to be executed when the add-on is being removed with `ddev get --remove`.
   131  * `yaml_read_files`: a map of `name: file` of YAML files to be read from the target project’s root directory. The contents of these YAML files may be used as templated actions within `pre_install_actions` and `post_install_actions`.
   132  
   133  In any stanza of `pre_install_actions` and `post_install_actions` you can:
   134  
   135  * Use `#ddev-nodisplay` on a line to suppress any output.
   136  * Use `#ddev-description:<some description of what stanza is doing>` to instruct DDEV to output a description of the action it's taking.
   137  
   138  You can see a simple `install.yaml` in [`ddev-addon-template`’s `install.yaml`](https://github.com/ddev/ddev-addon-template/blob/main/install.yaml).
   139  
   140  ### Environment Variable Replacements
   141  
   142  Simple environment variables will be replaced in `install.yaml` as part of filenames. This can include environment variables in the context where DDEV run, as well as the standard [environment variables](custom-commands.md#environment-variables-provided) 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.
   143  
   144  ### Template Action Replacements (Advanced)
   145  
   146  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`:
   147  
   148  ```yaml
   149  value1: xxx
   150  ```
   151  
   152  is referenced using
   153  
   154  ```yaml
   155  yaml_read_files:
   156    example: example_yaml.yaml
   157  ```
   158  
   159  then `value1` can be used throughout the `install.yaml` as `{{ example.value1 }}` and it will be replaced with the value `xxx`.
   160  
   161  More exotic template-based replacements can be seen in an advanced test [example](https://github.com/ddev/ddev/blob/master/cmd/ddev/cmd/testdata/TestCmdGetComplex/recipe/install.yaml).
   162  
   163  Go templating resources:
   164  
   165  * [Official Go template docs](https://pkg.go.dev/text/template)
   166  * [Lots of intro to Golang templates](https://www.google.com/search?q=golang+templates+intro&oq=golang+templates+intro&aqs=chrome..69i57j0i546l4.3161j0j4&sourceid=chrome&ie=UTF-8)
   167  * [masterminds/sprig](http://masterminds.github.io/sprig/) extra functions.
   168  
   169  ## Additional services in ddev-contrib
   170  
   171  Commonly-used services are being migrated from the [ddev-contrib](https://github.com/ddev/ddev-contrib) repository to individual, tested, supported add-on repositories, but the repository still has a wealth of additional examples and instructions:
   172  
   173  * **Old PHP Versions to Run Old Sites**: See [Old PHP Versions](https://github.com/ddev/ddev-contrib/blob/master/docker-compose-services/old_php)
   174  * **RabbitMQ**: See [RabbitMQ](https://github.com/ddev/ddev-contrib/blob/master/docker-compose-services/rabbitmq)
   175  * **TYPO3 Solr Integration**: See [TYPO3 Solr](https://github.com/ddev/ddev-contrib/blob/master/docker-compose-services/typo3-solr)
   176  
   177  While we welcome requests to integrate other services at [ddev-contrib](https://github.com/ddev/ddev-contrib), we encourage creating a supported add-on that’s more beneficial to the community.