Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Jan 18, 2022
1 parent fe51a11 commit 4231f89
Show file tree
Hide file tree
Showing 26 changed files with 52 additions and 19,873 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Download docker images
run: |
mkdir junk && pushd junk && ddev config --auto && ddev debug download-images
docker pull solr:8
docker pull memcached:1.5
- name: tmate debugging session
uses: mxschmitt/action-tmate@v3
with:
Expand Down
31 changes: 9 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
[![tests](https://github.com/drud/ddev-drupal9-solr/actions/workflows/tests.yml/badge.svg)](https://github.com/drud/ddev-drupal9-solr/actions/workflows/tests.yml)
[![tests](https://github.com/drud/ddev-memcached/actions/workflows/tests.yml/badge.svg)](https://github.com/drud/ddev-memcached/actions/workflows/tests.yml)

## What is this?

This repository allows you to quickly install Apache Solr for Drupal 9 into a [Ddev](https://ddev.readthedocs.io) project using just `ddev service get drud/ddev-drupal9-solr`.
This repository allows you to quickly install memcached into a [Ddev](https://ddev.readthedocs.io) project using just `ddev service get drud/ddev-memcached`.

## Installation on Drupal 9
## Installation

1.`ddev service get drud/ddev-drupal9-solr && ddev restart`
2. You may need to install the relevant Drupal requirements: `ddev composer require drush/drush:* drupal/search_api_solr`
3. Enable the Search API Solr Search Defaults module: `ddev drush en -y search_api_solr_defaults`. (If it can't be enabled due to the "article" content type not existing, you can just create a search_api_solr server manually.)
4. Edit the enabled search_api server named `default_solr_server` at `admin/config/search/search-api/server/default_solr_server/edit`
* set "Solr host" to `solr`
* set "Solr core" name to "dev"
* Under "Advanced server configuration" set the "solr.install.dir" to `/opt/solr`
1.`ddev service get drud/ddev-memcached && ddev restart`
5. `ddev restart`

## Explanation

This is the classic Drupal solr 8 recipe used for a long time by Drupal users and compatible with search_api_solr.
This memcached recipe for [ddev](https://ddev.readthedocs.io) installs a [`.ddev/docker-compose.memcached.yaml`](docker-compose.memcached.yaml) using the memcached:1.5 docker image.

* It installs a [`.ddev/docker-compose.solr.yaml`](docker-compose.solr.yaml) using the solr:8 docker image
* A standard Drupal 9 solr configuration is included in [.ddev/solr/conf](.ddev/solr/conf)
* A [.ddev/docker-entrypoint-initdb.d/solr-configupdate.sh](solr/docker-entrypoint-initdb.d/solr-configupdate.sh) is included and mounted into the solr container so that you can change solr config in .ddev/solr/conf with just a `ddev restart`.
## Interacting with Memcached

## Interacting with Apache Solr

* The Solr admin interface will be accessible at: `http://<projectname>.ddev.site:8983/solr/` For example, if the project is named `myproject` the hostname will be: `http://myproject.ddev.site:8983/solr/`.
* To access the Solr container from inside the web container use: `http://solr:8983/solr/`
* A Solr core is automatically created by default with the name "dev"; it can be accessed (from inside the web container) at the URL: `http://solr:8983/solr/dev` or from the host at `http://<projectname>.ddev.site:8983/solr/#/~cores/dev`. You can obviously create other cores to meet your needs.

## Caveats
* This recipe won't work with versions of solr before solr:8, and Acquia and Pantheon.io hosting require versions from 3 to 7. You'll want to see the [contributed recipes](https://github.com/drud/ddev-contrib) for older versions of solr.
* The Memcached instance will listen on TCP port 11211 (the Memcached default).
* Configure your application to access Memcached on the host:port `memcached:11211`.
* To reach the Memcached admin interface, run ddev ssh to connect to the web container, then use nc or telnet to connect to the Memcached container on port 11211, i.e. nc memcached 11211. You can then run commands such as `stats` to see usage information.
35 changes: 35 additions & 0 deletions docker-compose.memcached.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# DDEV-Local memcached recipe file.
#
# To use this in your own project:
# 1. Copy this file to your project's ".ddev" directory.
# 2. Launch "ddev start".
# 3. Configure the project to look for memcached at hostname "memcached" and
# port 11211.
# 4. Optional: adjust the 'command' line below to change CLI flags sent to
# memcached.

version: '3.6'

services:
# This is the service name used when running ddev commands accepting the
# --service flag.
memcached:
# This is the name of the container. It is recommended to follow the same
# name convention used in the main docker-compose.yml file.
container_name: ddev-${DDEV_SITENAME}-memcached
image: memcached:1.5
networks: [default, ddev_default]
restart: "no"
# memcached is available at this port inside the container.
expose:
- 11211
# These labels ensure this service is discoverable by ddev.
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT

# Arguments passed to the memcached binary.
command: ["-m", "128"]

volumes:
- ".:/mnt/ddev_config"
86 changes: 0 additions & 86 deletions docker-compose.solr.yaml

This file was deleted.

10 changes: 2 additions & 8 deletions install.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
name: solr

pre_install_actions:
- "docker volume rm ddev-${DDEV_PROJECT}_solr 2>/dev/null || true"
name: memcached

# files and directories listed here are copied into .ddev
files:
- solr
- docker-compose.solr.yaml
- docker-compose.memcached.yaml

post_install_actions:
- chmod +x solr/docker-entrypoint-initdb.d/solr-configupdate.sh

185 changes: 0 additions & 185 deletions solr/conf/accents_en.txt

This file was deleted.

Loading

0 comments on commit 4231f89

Please sign in to comment.