Add script to run ES in docker container (#590)
* Adding start_elasticsearch.sh script to run elastic search on the host in a docker container at http://localhost:9200 * update readme in instructions on how to use script
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
.eggs/*
|
||||
.*.swp
|
||||
*~
|
||||
*.py[co]
|
||||
|
||||
@@ -66,6 +66,26 @@ Install the ``elasticsearch`` package with `pip
|
||||
pip install elasticsearch
|
||||
|
||||
|
||||
Run Elasticsearch in a Container
|
||||
--------------------------------
|
||||
|
||||
To run elasticsearch in a container, optionally set the `ES_VERSION` environment evariable to either 5.4, 5.3 or 2.4. `ES_VERSION` is defaulted to `latest`.
|
||||
Then run ./start_elasticsearch.sh::
|
||||
|
||||
export ES_VERSION=5.4
|
||||
./start_elasticsearch.sh
|
||||
|
||||
|
||||
This will run a version fo Elastic Search in a Docker container suitable for running the tests. To check that elasticearch is running
|
||||
first wait for a `healthy` status in `docker ps`::
|
||||
|
||||
$ docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
955e57564e53 7d2ad83f8446 "/docker-entrypoin..." 6 minutes ago Up 6 minutes (healthy) 0.0.0.0:9200->9200/tcp, 9300/tcp trusting_brattain
|
||||
|
||||
Then you can navigate to `locahost:9200` in your browser.
|
||||
|
||||
|
||||
Example use
|
||||
-----------
|
||||
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start elasticsearch in a docker container
|
||||
|
||||
ES_VERSION=${ES_VERSION:-"latest"}
|
||||
ES_TEST_SERVER=${ES_TEST_SERVER:-"http://localhost:9200"}
|
||||
|
||||
exec docker run -d \
|
||||
-e script.inline=true \
|
||||
-e path.repo=/tmp \
|
||||
-e "repositories.url.allowed_urls=http://*" \
|
||||
-e node.attr.testattr=test \
|
||||
-e ES_HOST=$ES_TEST_SERVER \
|
||||
-v `pwd`/../elasticsearch:/code/elasticsearch \
|
||||
-v /tmp:/tmp \
|
||||
-p "9200:9200" \
|
||||
fxdgear/elasticsearch:$ES_VERSION
|
||||
|
||||
Reference in New Issue
Block a user