Skip to content

Commit

Permalink
Updates Elasticsearch quick start by adding DDEV
Browse files Browse the repository at this point in the history
Added instructions and services files for Elasticsearch
DDEV services.
  • Loading branch information
Alban Jubert committed Jul 4, 2019
1 parent c3e540d commit 8d2c8e7
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
17 changes: 14 additions & 3 deletions elasticsearch-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,24 @@ The craft-elasticsearch plugin isn't very useless without an Elasticsearch serve
In this guide we'll walk you through the steps to set up both a development and a production Elasticsearch instance.


## Development using DDEV

## Development
A super easy way to get up and running is by using [DDEV][ddev].

Once the initial configuration is done, simply copy the content of `vendor/la-haute-societe/craft-elasticsearch/resources/ddev` into your `.ddev` project folder
then start or restart your DDEV environment.

This will start an Elasticsearch and Kibana services, respectively accessible at <http://projectname.ddev.site:9200> and <http://projectname.ddev.site:5601>.

From the Elasticsearch plugin setting, you use <http://elasticsearch:9200> to point to the Elasticsearch instance.


## Development using a Docker container

To have a development environment up & running in minutes, use Docker:

```sh
cd <plugin_dir>/resources/docker
cd vendor/la-haute-societe/craft-elasticsearch/resources/docker
docker-compose up
```

Expand All @@ -27,10 +38,10 @@ to your docker-compose php container definition so it points your apache host to
For example, if your Craft CMS instance is accessible through `http://docker.test`, you will define an extra_hosts entry as follow: `- "docker.test:xxx.xxx.xxx.xxx"` where xxx.xxx.xxx.xxx represent your public IP.



## Production

If you need a hassle-free, secure, scalable & production-ready solution, [Elastic Cloud][elasticsearch-cloud] is the way
to go.

[elasticsearch-cloud]: https://www.elastic.co/cloud/elasticsearch-service
[ddev]: https://ddev.readthedocs.io/en/stable/
51 changes: 51 additions & 0 deletions resources/ddev/docker-compose.elasticsearch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.6'

services:

elasticsearch:
build: ./elasticsearch-build
container_name: ddev-${DDEV_SITENAME}-elasticsearch
environment:
- cluster.name=yii2-test-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- ELASTIC_PASSWORD=9kMf8NWZRXxV
- VIRTUAL_HOST=$DDEV_HOSTNAME # This defines the host name the service should be accessible from. This will be sitename.ddev.local
- HTTP_EXPOSE=9200
ulimits:
memlock:
soft: -1
hard: -1
restart: on-failure
volumes:
- es6-data:/usr/share/elasticsearch/data
ports:
- 9200
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
com.ddev.app-url: $DDEV_URL


kibana:
image: docker.elastic.co/kibana/kibana:6.1.4
container_name: ddev-${DDEV_SITENAME}-kibana
environment:
- elasticsearch.password=9kMf8NWZRXxV
- VIRTUAL_HOST=$DDEV_HOSTNAME # This defines the host name the service should be accessible from. This will be sitename.ddev.local
- HTTP_EXPOSE=5601
ports:
- 5601
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
com.ddev.app-url: $DDEV_URL

web:
links:
- elasticsearch:$DDEV_HOSTNAME
- kibana:$DDEV_HOSTNAME

volumes:
es6-data:
driver: local
3 changes: 3 additions & 0 deletions resources/ddev/elasticsearch-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM docker.elastic.co/elasticsearch/elasticsearch:6.1.4

RUN printf "y/n" | bin/elasticsearch-plugin install ingest-attachment

0 comments on commit 8d2c8e7

Please sign in to comment.