From 31d7990e133e63c64c0a018274f6bddc3bcc1368 Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Tue, 18 Feb 2025 10:06:14 +0000 Subject: [PATCH] Add optional Elasticsearch service (#88) --- Makefile | 2 +- README.md | 12 +++++++++++- compose.yaml | 10 ++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d85af43..c57e87f 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ build: ## Build the backend Docker image docker compose build web start: ## Bring the backend Docker container up - docker compose up + docker compose up web stop: ## Stop the backend Docker container docker compose stop diff --git a/README.md b/README.md index 071accf..e5058ad 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Once the build is complete: ```sh # 6. Start your containers and wait for them to finish their startup scripts. -docker compose up +docker compose up web ``` You might see a message like this the first time you run your containers. This is normal because the frontend container has not finished building the assets for the Wagtail admin. Just wait a few seconds for the frontend container to finish building (you should see a message like `webpack compiled successfully in 15557 ms` and then stop and start your containers again (Ctrl+C + `docker compose up`). @@ -306,3 +306,13 @@ You simply do the same operations to fork the Willow project and point your loca ## See also - [Vagrant Wagtail development](https://github.com/wagtail/vagrant-wagtail-develop) + +## Testing with Elasticsearch + +To test the Wagtail search with the [Elasticsearch backend](https://docs.wagtail.org/en/stable/topics/search/backends.html#elasticsearch-backend) or OpenSearch, use the additional service: + +```sh +docker compose up web elastic +``` + +Then install any dependencies and configure Wagtail per the developer documentation, configuring the search backend to use `http://elastic:9200` as the URL. diff --git a/compose.yaml b/compose.yaml index b734530..75966c5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -47,3 +47,13 @@ services: command: bash -c "echo 'Copying node_modules, this may take a few minutes...' && rsync -rah --info=progress2 /node_modules /code/wagtail/ && npm run start" restart: "no" tty: true + + elastic: + container_name: elastic + image: elasticsearch:8.17.1 + ports: + - "9200:9200" + - "9300:9300" + environment: + - xpack.security.enabled=false + - discovery.type=single-node