Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Do not expose ES ports locally during tests
Browse files Browse the repository at this point in the history
Running the test targets (single-node-test, cluster-unicast-test) can
sometimes lead to CI failures:
https://devops-ci.elastic.co/view/Docker/job/elastic+elasticsearch-docker+5.0/21/console. This
can happen when both targets are run simultaneously due to a conflict on
the locally exposed port :9200.

Remove local port references for ES in docker-compose.yml. This change
doesn't affect the tests as the test container accesses ES through the
docker network driver.

Retain backwards compatibility for run-es(single|cluster) targets, by
overriding the localhost port definitions with
docker-compose.hostports.yml. This strategy is described in:
docker/compose#2260 (comment)
  • Loading branch information
dliappis committed Oct 25, 2016
1 parent 288248a commit cbcd4c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ clean:
rm -f tests/*.pyc

run-es-single: pull-latest-baseimage
ES_NODE_COUNT=1 docker-compose up --build elasticsearch1
ES_NODE_COUNT=1 docker-compose -f docker-compose.yml -f docker-compose.hostports.yml up --build elasticsearch1

run-es-cluster: pull-latest-baseimage
ES_NODE_COUNT=2 docker-compose up --build elasticsearch1 elasticsearch2
ES_NODE_COUNT=2 docker-compose -f docker-compose.yml -f docker-compose.hostports.yml up --build elasticsearch1 elasticsearch2

single-node-test: export ES_NODE_COUNT=1
single-node-test: pull-latest-baseimage clean
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.hostports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Override docker-compose ports to expose 9200 on localhost for run-* targets
---
version: '2'
services:
elasticsearch1:
ports:
- 9200:9200
6 changes: 0 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ services:
- discovery.zen.minimum_master_nodes=${ES_NODE_COUNT}
image: "elasticsearch:${IMAGETAG}"
mem_limit: 4g
ports:
- 9200:9200
- 9300
ulimits:
memlock:
soft: -1
Expand All @@ -45,9 +42,6 @@ services:
links:
- elasticsearch1
mem_limit: 4g
ports:
- 9200
- 9300
ulimits:
memlock:
soft: -1
Expand Down

0 comments on commit cbcd4c9

Please sign in to comment.