Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down Expand 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.
10 changes: 10 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +58 to +59
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to simplify accessing / running locally (single node, no security). I’ve copy-pasted this from existing projects, not sure how we arrived at those specific settings. It works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, without xpack.security.enabled=false the Elasticsearch server will reject requests from the Django server process because Elasticsearch requires HTTPS by default. I ran into this while working on wagtail/wagtail#12862 yesterday: https://stackoverflow.com/questions/71492404

I also use discovery.type=single-node per the example in https://hub.docker.com/_/elasticsearch, but I haven't tried if it works without that.

The Elasticsearch GitHub Action we use in Wagtail's CI has a few more parameters, including both we set here: https://github.com/getong/elasticsearch-action/blob/v1.3/entrypoint.sh#L7