Skip to content

Apache Solr (standalone) search integration for TYPO3 on DDEV

License

Notifications You must be signed in to change notification settings

ddev/ddev-typo3-solr

add-on registry tests last commit release

DDEV TYPO3 Solr (standalone)

Overview

Apache Solr is the blazing-fast, open source, multi-modal search platform built on the full-text, vector, and geospatial search capabilities of Apache Lucene™.

This add-on integrates Solr standalone (no cloud) into your DDEV project and creates Solr cores according to the configuration defined in .ddev/typo3-solr/config.yaml.

This add-on is meant to be a simple integration for DDEV, as it does not work with Solr Cloud and only for Solr standalone. Most web projects use Solr in standalone-mode so this add-on simulates this behaviour for local environments.

Installation

ddev add-on get ddev/ddev-typo3-solr
ddev restart

After installation, make sure to commit the .ddev directory to version control.

Usage

Command Description
ddev solrctl --help Create and destroy solr cores and configsets
ddev solr Run Solr CLI inside the Solr container
ddev launch :8984 Open Solr Admin in your browser (https://<project>.ddev.site:8984)
ddev describe View service status and used ports for Solr
ddev logs -s typo3-solr Check Solr logs

Configuration

Create cores and its configuration

Configuration example for TYPO3 in .ddev/typo3-solr/config.yaml:

config: 'vendor/apache-solr-for-typo3/solr/Resources/Private/Solr/solr.xml'
typo3lib: "vendor/apache-solr-for-typo3/solr/Resources/Private/Solr/typo3lib"
configsets:
    - name: "ext_solr_12_0_0"
      path: "vendor/apache-solr-for-typo3/solr/Resources/Private/Solr/configsets/ext_solr_12_0_0"
      cores:
          - name: "core_en"
            schema: "english/schema.xml"
          - name: "core_de"
            schema: "german/schema.xml"
ddev solrctl apply

To ensure the cores are created automatically on boot, add the following hook to your .ddev/config.yaml:

hooks:
  post-start:
    - exec-host: ddev solrctl apply

Example configuration for TYPO3

To connect to the solr service you have to configure the following lines in your site configuration:

solr_enabled_read: true
solr_host_read: <your-site>.ddev.site
solr_path_read: /
solr_port_read: '8984'
solr_scheme_read: https

Delete cores and its configuration

ddev solrctl wipe

Note

After running wipe, it may take a few seconds until files are synced which may cause issues when running apply straight after wipe.

Running the solr control script

ddev solr

Advanced Customization

Using alternate versions of Solr

This addon defaults to installing a preferred version of the docker Solr image, but can be configured to use a different version via environment variable (SOLR_BASE_IMAGE).

# Change image version as appropriate.
ddev dotenv set .ddev/.env.solr --solr-base-image="solr:9.8"

ddev add-on get ddev/ddev-typo3-solr

# remove old solr volume (if this is downgrade)
ddev stop
docker volume rm ddev-$(ddev status -j | docker run -i --rm ddev/ddev-utilities jq -r '.raw.name')_typo3-solr

# rebuild solr image (required step)
ddev debug rebuild -s typo3-solr

ddev restart

# confirm the new Solr version
ddev solr version

Make sure to commit the .ddev/.env.solr file to version control.

All customization options (use with caution):

Variable Flag Default
SOLR_BASE_IMAGE --solr-base-image solr:9.8

Credits

Maintained by @b13

About

Apache Solr (standalone) search integration for TYPO3 on DDEV

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

Languages