---
title: Implementing Solr in TYPO3 local dev environment
url: "https://b13.com/knowledge/how-to-integrate-solr-ddev-typo3-local-development"
description: A quick guide on adding Solr to your local dev setup in TYPO3 for continuous improvement and continuous delivery. 
image: "https://b13.com/fileadmin/_processed_/5/a/csm_ddev-TYPO3_191-1_18488dacde.png"
date: 2021-12-21
modified: 2026-08-19
lastUpdated: 2026-08-19
---

# Implementing Solr in TYPO3 local dev environment

[ Solr ](https://b13.com/knowledge/solr) [ DDEV ](https://b13.com/knowledge/ddev)

 How to integrate Solr with DDEV and TYPO3 v10 for your local development
==========================================================================

![](https://b13.com/fileadmin/_processed_/c/6/csm_benni_5e519221c4.jpg)Benni Mack

  21 December 2021

 [ RSS Feed ](https://b13.com/rss.xml)

  ![Two individuals work on laptops while seated on blue shipping containers. A large orange crate is suspended above them, with abstract shapes and dots in the background.](https://b13.com/fileadmin/_processed_/0/3/csm_ddev-TYPO3_fb9ca3661e.webp)

Many of our enterprise customers require high-performant search functionality on their websites. TYPO3 meets this challenge by easily integrating with Solr search, and we rely on dkd’s Solr extension to set up [powerful search features](https://b13.com/blog/fall-in-love-with-your-solr-search).

At b13, our developers practice continuous integration and continuous delivery (CI/CD) and test changes locally before any code is published to the production systems. To be able to implement changes, our local and production environments must have identical configurations—for Solr and other systems. As a result, developers who want to implement Solr in production without major obstacles will also need to implement it locally.

This step-by-step guide will show you how to set up Solr locally, via Docker, in a matter of minutes.

   Prerequisites
---------------

One of the tools we use in local development is [DDEV](https://ddev.com/), a powerful platform built around Docker and Docker-Compose for PHP projects. DDEV has great support for TYPO3. Before you begin, make sure you’ve already installed DDEV and dkd’s Solr extension in your existing TYPO3 project. This guide assumes you’re using Git version control and have updated to TYPO3 v10 LTS. As a short checklist, we’d expect your project to meet the following prerequisites:

- TYPO3 v10 LTS is running with Composer, and your public web root is configured as “htdocs/” (where your fileadmin folder resides).
- [Solr Extension](https://extensions.typo3.org/extension/solr) v11.0.x is installed.
- Connected Solr server 8.11.1 is already configured in TYPO3’s site configuration (see the [Solr extension’s version matrix](https://docs.typo3.org/p/apache-solr-for-typo3/solr/main/en-us/Appendix/VersionMatrix.html) for more information)
- A distinct Solr Core is set up for each language on your website, all using the TYPO3-Solr config set “ext\_solr\_11\_1\_0”. (For example, a website with four languages would have four Solr Cores: “corporate\_en”, “corporate\_de”, “corporate\_it” and “corporate\_cn”.)
- DDEV is already running and configured in `.ddev` of your project root

   Step 1: Set up Solr as a DDEV container
-----------------------------------------

DDEV already ships with basic support for Solr, and you can use any docker-compose file to set up additional Docker containers quickly. (It’s brilliant!)

In your existing project, create a new file named `.ddev/docker-compose.solr.yaml` with the following contents:

  ```
1<br></br>2<br></br>3<br></br>4<br></br>5<br></br>6<br></br>7<br></br>8<br></br>9<br></br>10<br></br>11<br></br>12<br></br>13<br></br>14<br></br>15<br></br>16<br></br>17<br></br>18<br></br>19<br></br>20<br></br>21<br></br>
```

```
<span class="hljs-attr">version:</span> <span class="hljs-string">'3.6'</span><br></br><br></br><span class="hljs-attr">services:</span><br></br> <span class="hljs-attr">solr:</span><br></br>   <span class="hljs-attr">container_name:</span> <span class="hljs-string">ddev-${DDEV_SITENAME}-solr</span><br></br>   <span class="hljs-attr">image:</span> <span class="hljs-string">solr:8.11.1</span><br></br>   <span class="hljs-attr">restart:</span> <span class="hljs-string">"no"</span><br></br>   <span class="hljs-attr">expose:</span><br></br>     <span class="hljs-bullet">-</span> <span class="hljs-number">8983</span><span class="hljs-number">-8984</span><br></br>   <span class="hljs-attr">labels:</span><br></br>     <span class="hljs-attr">com.ddev.site-name:</span> <span class="hljs-string">${DDEV_SITENAME}</span><br></br>     <span class="hljs-attr">com.ddev.approot:</span> <span class="hljs-string">$DDEV_APPROOT</span><br></br>   <span class="hljs-attr">environment:</span><br></br>     <span class="hljs-bullet">-</span> <span class="hljs-string">VIRTUAL_HOST=$DDEV_HOSTNAME</span><br></br>     <span class="hljs-bullet">-</span> <span class="hljs-string">HTTP_EXPOSE=8983</span><br></br>     <span class="hljs-bullet">-</span> <span class="hljs-string">HTTPS_EXPOSE=8984:8983</span><br></br>   <span class="hljs-attr">volumes:</span><br></br>     <span class="hljs-bullet">-</span> <span class="hljs-string">./solr:/var/solr/data</span><br></br> <span class="hljs-attr">web:</span><br></br>   <span class="hljs-attr">links:</span><br></br>     <span class="hljs-bullet">-</span> <span class="hljs-string">solr</span><br></br>
```

  Note the following three items:

1. The name of the docker image is “solr:8.11.1”. We use the official “solr” image with the tag “8.11.1” since it’s running in production, and we want to stick as close to the production system as possible. See [https://hub.docker.com/\_/solr?tab=tags](https://hub.docker.com/_/solr?tab=tags) for available versions of this image. Solr 8.11.1 is also safe from any [Log4J vulnerabilities](https://solr.apache.org/news.html#apache-solrtm-8111-available).
2. The container\_name is `ddev-${DDEV_SITENAME}-solr` and we’ll later use it to connect to the Solr service in TYPO3.
3. The exposed ports for HTTP and HTTPS, which we use the default ones solr uses. 8983 for the non-encrypted HTTP port and 8984 for the encrypted HTTPS port.

   Step 2: Configure your Solr cores
-----------------------------------

Configure the Solr cores in DDEVs main `.ddev/config.yaml` file. Add the following lines at the end of the file, adjusting for your language settings:

  ```
1<br></br>2<br></br>3<br></br>4<br></br>5<br></br>6<br></br>7<br></br>8<br></br>9<br></br>10<br></br>11<br></br>12<br></br>13<br></br>14<br></br>15<br></br>16<br></br>17<br></br>18<br></br>19<br></br>20<br></br>21<br></br>22<br></br>23<br></br>24<br></br>25<br></br>
```

```
environment:<br></br> - SOLR_HOST=${DDEV_SITENAME}.ddev.site<br></br>TYPO3_solr_cores:<br></br> - { name: corporate_en, schema: <span class="hljs-string">"english/schema.xml"</span> }<br></br> - { name: corporate_de, schema: <span class="hljs-string">"german/schema.xml"</span> }<br></br> - { name: corporate_zh, schema: <span class="hljs-string">"chinese/schema.xml"</span> }<br></br> - { name: corporate_it, schema: <span class="hljs-string">"italian/schema.xml"</span> }<br></br>TYPO3_solr_ext_path: <span class="hljs-string">'htdocs/TYPO3conf/ext/solr/Resources/Private/Solr/'</span><br></br>TYPO3_solr_configset: <span class="hljs-string">'ext_solr_11_0_0'</span><br></br>hooks:<br></br> post-start:<br></br>   - <span class="hljs-keyword">exec</span>-host: <span class="hljs-string">"composer install --no-scripts"</span><br></br>   - <span class="hljs-keyword">exec</span>: |<br></br>       SOLR_EXT_PATH=(<span class="hljs-string">`yq e '.TYPO3_solr_ext_path' .ddev/config.yaml`</span>)<br></br>       cp -r ${SOLR_EXT_PATH}solr.xml .ddev/solr/<br></br>       cp -r ${SOLR_EXT_PATH}configsets .ddev/solr/<br></br><br></br>       CONFIGSET=(<span class="hljs-string">`yq e '.TYPO3_solr_configset' .ddev/config.yaml`</span>)<br></br>       NAME=(<span class="hljs-string">`yq e '.TYPO3_solr_cores.[].name' .ddev/config.yaml`</span>)<br></br>       SCHEMA=(<span class="hljs-string">`yq e '.TYPO3_solr_cores.[].schema' .ddev/config.yaml`</span>)<br></br><br></br>       <span class="hljs-keyword">length</span>=${<span class="hljs-comment">#NAME[@]}</span><br></br>       <span class="hljs-keyword">for</span> (( i = <span class="hljs-number">0</span>; i < <span class="hljs-keyword">length</span>; i++ )); <span class="hljs-keyword">do</span><br></br>         curl -<span class="hljs-keyword">s</span> -o /dev/null <span class="hljs-string">"http://solr:8983/solr/admin/cores?action=CREATE&name=<span class="hljs-subst">${NAME[$i]}</span>&configSet=<span class="hljs-subst">${CONFIGSET}</span>&schema=<span class="hljs-subst">${SCHEMA[$i]}</span>&dataDir=data/"</span><br></br>       done<br></br>
```

  This step implements the main logic for the TYPO3 integration. Again, three points are key:

- Define the cores you want to create (TYPO3\_solr\_ext\_cores), the path to the Solr extension’s asset folder (TYPO3\_solr\_ext\_path), which already ships the configsets, and the solr configuration, which is ready-to-use for TYPO3.
- The post-start hook copies over the configuration from the extension and creates the cores via a curl request to the solr host, if they don’t exist yet. The hook uses a `composer install` to ensure that the solr extension has been installed at that time.
- The additional environment variable for the main web container `SOLR_HOST` is used later on in TYPO3 to reference the internal Docker service directly in TYPO3’s site configuration.

If you’re using git, now is the time to edit the `.ddev/.gitignore` file and ensure that the created solr core data and configsets are not committed. To add `.gitignore` to your Git repository and exclude the `.ddev/solr/` folder and its contents from versioning control, you need to remove the first three lines in `.ddev/.gitignore` and add `/solr/` to the very end of the file.

Run `ddev restart` and—voila—your Solr cores are created automatically.

   Step 3: Connect your Solr cores in TYPO3
------------------------------------------

In our example, we assume you work with environment variables in your production environment (see <https://12factor.net/config> for more details). We use the same Solr host for read and write, and we use the `SOLR_HOST` environment variable in production. Assuming your setup is similar, follow[ TYPO3 Solr’s documentation](https://docs.typo3.org/p/apache-solr-for-typo3/solr/11.0/en-us/GettingStarted/ConfigureExtension.html#configure-solr-connections) and match the environment variable we named `SOLR_HOST` in your site configuration—either through the GUI or by editing the file `config/sites/main/config.yaml`.

As a final check, make sure to use environment variables in production and use the `SOLR_HOST` variable for production in your site configuration. In addition, match the names of your local Solr cores to those used in production. Once you’ve done so, your setup is done! You can index and test your Solr search locally in DDEV.

This is a quick excerpt of the example project’s site configuration file located in `config/sites/main/config.yaml`.

  ```
1<br></br>2<br></br>3<br></br>4<br></br>5<br></br>6<br></br>7<br></br>8<br></br>9<br></br>10<br></br>11<br></br>12<br></br>13<br></br>14<br></br>15<br></br>16<br></br>17<br></br>18<br></br>19<br></br>
```

```
<span class="hljs-bullet">-</span><br></br> <span class="hljs-attr">title:</span> <span class="hljs-string">English</span><br></br> <span class="hljs-attr">languageId:</span> <span class="hljs-number">0</span><br></br> <span class="hljs-attr">base:</span> <span class="hljs-string">/en/</span><br></br> <span class="hljs-attr">TYPO3Language:</span> <span class="hljs-string">default</span><br></br> <span class="hljs-string">...</span><br></br> <span class="hljs-attr">solr_core_read:</span> <span class="hljs-string">corporate_en</span><br></br><span class="hljs-bullet">-</span><br></br> <span class="hljs-attr">title:</span> <span class="hljs-string">Deutsch</span><br></br> <span class="hljs-attr">languageId:</span> <span class="hljs-number">1</span><br></br> <span class="hljs-attr">base:</span> <span class="hljs-string">/</span><br></br> <span class="hljs-attr">TYPO3Language:</span> <span class="hljs-string">de</span><br></br> <span class="hljs-string">...</span><br></br> <span class="hljs-attr">solr_core_read:</span> <span class="hljs-string">corporate_de</span><br></br><span class="hljs-attr">solr_enabled_read:</span> <span class="hljs-literal">true</span><br></br><span class="hljs-attr">solr_host_read:</span> <span class="hljs-string">'%env(SOLR_HOST)'</span><br></br><span class="hljs-attr">solr_path_read:</span> <span class="hljs-string">/solr/</span><br></br><span class="hljs-attr">solr_port_read:</span> <span class="hljs-string">'8983'</span><br></br><span class="hljs-attr">solr_scheme_read:</span> <span class="hljs-string">http</span><br></br>
```

  Last but not least: Commit and push your code, so your team members can enjoy the setup you’ve created for the project.

We hope this will save you and your team members time!

  **If you need extra help, get in touch. We’ll help you set up a deployment pipeline and environment-specific code in your TYPO3 project.**

 [ Let’s connect ](https://b13.com/lets-connect)

  ###  Written by:

 ![Bild von Benni Mack](https://b13.com/fileadmin/_processed_/c/6/csm_benni_66cce9a81f.webp)

b13 co-founder and TYPO3 CMS Core Development Lead, Benni Mack, heads our technical practices, setup and maintenance of our technical infrastructure, and coordinates our open-source contribution. His essential tool: TYPO3

 Benni Mack  CTO

 [ more from Benni Mack ](https://b13.com/team/benni-mack)

  Related Articles
------------------

- ![A series of stylized figures in various poses, each with a distinctive orange hat, depict a progression from walking to standing still while looking at a phone, set against a purple grid background.](https://b13.com/fileadmin/_processed_/d/7/csm_QueuesDDEV_Headerbild_f640931350.webp)

    ###  Better scalability with decoupled queues: How to set up RabbitMQ with TYPO3

     10 April 2024 | Jochen Roth

     When built-in message transports hit their limits, RabbitMQ can provide TYPO3 with a scalable, robust message queue.

     [ Read more: Better scalability with decoupled queues: How to set up RabbitMQ with TYPO3 ](https://b13.com/knowledge/better-scalability-with-decoupled-queues-how-to-set-up-rabbitmq-with-typo3)
- ![Four stylized figures with orange cone-shaped heads are engaged in a tug-of-war, pulling on a rope. The background features a grid pattern, emphasizing the dynamic action of the scene.](https://b13.com/fileadmin/_processed_/2/d/csm_CustomProviderDDEVpull_Headerbild_4acc1aab1d.webp)

    ###  How to fetch a customer’s TYPO3 data with a DDEV custom provider

     19 March 2025 | Jochen Roth

     How to create a repeatable, standardized process for fetching customers‘ TYPO3 data into a local environment with ddev pull.

     [ Read more: How to fetch a customer’s TYPO3 data with a DDEV custom provider ](https://b13.com/knowledge/how-to-fetch-a-customers-typo3-data-with-a-ddev-custom-provider)
- ![A person rests their chin on their hands, looking contemplative, surrounded by hearts and a search bar with a magnifying glass icon, suggesting themes of love and online searching.](https://b13.com/fileadmin/_processed_/7/9/csm_on-site-search_360beef0b1.webp)

    ###  How to fall in love with your on-site search (again)

     01 September 2020 | Florian “Flix” Keitgen

     Are you using your on-site search to its best advantage? In this article, we explain why you’ll need to continuously fine-tune Solr search relevance to provide a great on-site…

     [ Read more: How to fall in love with your on-site search (again) ](https://b13.com/knowledge/fall-in-love-with-your-solr-search)