From 74bb0d149998525e9a561ff6407076cad5122351 Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou" Date: Wed, 10 Jan 2018 17:04:42 +0100 Subject: [PATCH 1/6] updated readme - dockerhub warning --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d321fcd..92a7666 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ Elastic 6.1.1 as a Docker container. For development use only. +**Note that this repository is not yet linked to our Dockerhub account.** This means you'll have to build the image yourself first with: + +``` +docker build . -t mcreations/openwrt-elastic +``` + +from this repository's top directory. + + ## Quickstart Without arguments, the container starts the Elastic server: @@ -8,7 +17,7 @@ docker run -d --name elastic mcreations/openwrt-elastic ``` ## Configuration Details -the volume as /data cab be passed from outside of Docker container with -v switch. +the volume as /data can be passed from outside of Docker container with -v switch. The ports can be opened with -p switch. This is a sample command line with custom parameters: From ffc8b098761a5f4b15126c6851782c2ac8dfb8ef Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou" Date: Fri, 12 Jan 2018 11:57:35 +0100 Subject: [PATCH 2/6] added travis.yml and an initial test --- .travis.yml | 14 ++++++++++++++ test/test-connection.sh | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .travis.yml create mode 100644 test/test-connection.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b172613 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +sudo: required + +language: java + +services: + - docker + +before_install: + - docker build . -t openwrt-elastic:6.1.1 + - docker run -d -p 9200:9200 --restart=unless-stopped --name elasticsearch -e "xpack.security.enabled=false" openwrt-elastic:6.1.1 + +script: + - sh test/test-connection.sh + diff --git a/test/test-connection.sh b/test/test-connection.sh new file mode 100644 index 0000000..4f9bbc7 --- /dev/null +++ b/test/test-connection.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Sometimes health tests should be repeated (especially if this is ran right after the containers come up). + +echo "first health test:" +curl http://127.0.0.1:9200/_cat/health + +sleep 4 +echo "second health test:" +curl http://127.0.0.1:9200/_cat/health + +sleep 3 +echo "third health test:" +curl http://127.0.0.1:9200/_cat/health + +echo "Indices:" +curl http://localhost:9200/_cat/indices From 7f8a9b53d93d33854818fb10fc9955602be5d802 Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou" Date: Fri, 12 Jan 2018 13:31:58 +0100 Subject: [PATCH 3/6] troubles with the test. works locally, fails in travis. --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b172613..5218aae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,14 @@ sudo: required -language: java - services: - docker -before_install: +install: - docker build . -t openwrt-elastic:6.1.1 - - docker run -d -p 9200:9200 --restart=unless-stopped --name elasticsearch -e "xpack.security.enabled=false" openwrt-elastic:6.1.1 -script: +script: + - docker run -d -p 9200:9200 --restart=unless-stopped --name elasticsearch -e "xpack.security.enabled=false" openwrt-elastic:6.1.1 - sh test/test-connection.sh + + From be0ee040fe1b41894c865304e88ea8c0dab39987 Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou" Date: Fri, 12 Jan 2018 14:03:55 +0100 Subject: [PATCH 4/6] removed yml until i correct issues --- .travis.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5218aae..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -sudo: required - -services: - - docker - -install: - - docker build . -t openwrt-elastic:6.1.1 - -script: - - docker run -d -p 9200:9200 --restart=unless-stopped --name elasticsearch -e "xpack.security.enabled=false" openwrt-elastic:6.1.1 - - sh test/test-connection.sh - - - From b3a93da8b7ce132315bd67396874c3e7c47eb2ea Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou" Date: Fri, 12 Jan 2018 17:20:59 +0100 Subject: [PATCH 5/6] for testing basic elasticsearch functionality --- test/test-send-receive-indexes.sh | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/test-send-receive-indexes.sh diff --git a/test/test-send-receive-indexes.sh b/test/test-send-receive-indexes.sh new file mode 100644 index 0000000..ef241a7 --- /dev/null +++ b/test/test-send-receive-indexes.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# create a new index while posting a message to it: + +curl -XPUT 'localhost:9200/foo/tweet/1?pretty' -H 'Content-Type: application/json' -d' +{ + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" +} +' + +# query for this index: + +curl -XGET 'localhost:9200/twitter/tweet/1?pretty' + + +# post a second message to the index: + + +curl -XPUT 'localhost:9200/foo/tweet/2?pretty' -H 'Content-Type: application/json' -d' +{ + "title" : "Search", + "publish_date" : "2017-11-15", + "content" : "trying out Elasticsearch", + "status" : "published" +} +' + +# send a query on this index to get only the second message: + +echo "Query test:" + +curl -XGET 'localhost:9200/_search?pretty' -H 'Content-Type: application/json' -d' +{ + "query": { + "bool": { + "must": [ + { "match": { "title": "Search" }}, + { "match": { "content": "Elasticsearch" }} + ], + "filter": [ + { "term": { "status": "published" }}, + { "range": { "publish_date": { "gte": "2015-01-01" }}} + ] + } + } +} +' From b5eb54d83dd86d64cc1ac3a2c845ce51afd7fb55 Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou" Date: Fri, 12 Jan 2018 17:30:41 +0100 Subject: [PATCH 6/6] travis basic test --- .travis.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..07eb408 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +sudo: required + +services: + - docker + +install: + - docker build . -t openwrt-elastic:6.1.1 + +script: + - docker run -d -p 9200:9200 --restart=unless-stopped --name elasticsearch -e "xpack.security.enabled=false" openwrt-elastic:6.1.1 + - sleep 15 + - sh test/test-connection.sh + - sh test/test-send-receive-indexes.sh + + + + +