Install Additional services on DDEV

Published on
4 mins read
––– views
thumbnail-image

So you've installed DDEV, you can now create projects from the CLI, you're enjoying fast load speeds, you start coding, but suddenly, you need to check something on the database.

Your first instinct is to check on phpMyAdmin. Well, you can't. You're on a fresh install of DDEV, and since version 1.21, phpMyAdmin is no longer included in the DDEV core.

Fear not! As you've already seen in other posts, DDEV is highly customizable, and you can add phpMyAdmin back by running a simple command:

ddev get ddev/ddev-phpmyadmin

That's it! Isn't DDEV great?

What other services are available?

You can always head over to the DDEV Docs and check out the list of available services.

Installing Solr for Drupal

  • One of the services I use most is Solr. Drupal's search API and search_api_solr make my life easier when implementing search functionality on a Drupal site.

  • To install Solr, you can run the following command:

ddev get ddev/ddev-drupal9-solr && ddev restart

Note: Solr 8.11.2 will be installed since it's compatible with Drupal 8 and up.

Now, we need to set Drupal:

  1. From the command line, we disable the default search module:
ddev drush pmu search
  1. We install and enable the search_api and search_api_solr modules:
ddev composer require drupal/search_api
ddev composer require drupal/search_api_solr
ddev drush en search_api search_api_solr
  1. Once we have the modules installed, we need to configure the Solr server:
  • From the admin panel, we head to Configuration> Search API (/admin/config/search/search-api) and click Add server.
  • Under the server name, put the whatever name you want. I usually go with Solr.
  • Under Solr connector, select Standard. Then, for solr host, we put solr. And for solr core, we put dev.
  • Head down to Advanced server configuration and in solr.install.dir put /opt/solr.

That's it! You've got Solr installed and ready to use on your Drupal site.

Tip: Sometimes, when you try to migrate from one domain to another, your Solr might stop working. To fix this, you need to check Retrieve results for this site only in the 'Multi-site compatibility' section of the Solr server configuration. This tip has cost me many hours of debugging!

What if I already have a Solr server running on a different project and want to use it on this one?

Okay, so you've got a Drupal website set up on a server, you've got Solr running, and you want to use it on your local environment. How do you do that?

Easy, you follow the previous steps but don't use the dev core. Head over to your Drupal server admin/config/search/search-api/server/my_awesome_solr_server and click get config.zip. This will download a zip file with the configuration of your Solr server, which we'll use to create a new core.

Copy the zip file to .ddev/solr and unzip it inside .ddev/solr, restart ddev, and that's it!

Configset outdated error

If you get the error message "Solr is using an outdated config set, created with a version of Search API Solr older than 4.3.0" You need to follow the same steps I've given above.


And That's it for today! I hope you found this helpful post. If you have any questions, please contact me on LinkedIn.

Happy coding!