From 6b7e1c791feafbb48cac607f44d86946d5b6c92f Mon Sep 17 00:00:00 2001 From: Myer Nore Date: Mon, 10 Jul 2023 16:34:06 -0400 Subject: [PATCH] update dev env for es 6.4 mn/#3-support-latest-elasticsearch-dsl-6 --- Makefile | 28 +++++++++++++++++++++ docker-compose.yml | 63 +++++++++++++++++++++++++++------------------- setup.py | 2 +- 3 files changed, 66 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 99c3adc..5d1eb4d 100644 --- a/Makefile +++ b/Makefile @@ -74,3 +74,31 @@ selfcheck: ## check that the Makefile is well-formed pylintrc: ## check that the Makefile is well-formed edx_lint write pylintrc + +nuke: + @echo "Removing containers, networks, and data... ๐Ÿงจ" + @echo + docker compose down -v + +es-health-local-api: + @echo "Assuming you've got docker up, getting health of elasticsearch... ๐Ÿ“„" + @echo + curl 'localhost:9200/_cat/health?format=json&pretty=true' + +es-list-indexes-local-api: + @echo "Assuming you've got docker up, getting elasticsearch indexes via API call... ๐Ÿ“„" + curl 'localhost:9200/_cat/indices?format=json&pretty=true' + +es-print-java-env: + @echo "printing runtime value of ES_JAVA_OPTS" + docker-compose run --rm elastic printenv ES_JAVA_OPTS + +up: + @echo "Bringing up elastic 6 in docker ๐Ÿš€" + docker compose up -d --remove-orphans + +down: + @echo "Destroying local containers, but keeping data volumes intact... ๐Ÿ˜ด" + docker compose down + + diff --git a/docker-compose.yml b/docker-compose.yml index 5cf86fe..73cdd70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,8 @@ version: '2.1' services: elastic: - image: docker.elastic.co/elasticsearch/elasticsearch:6.0.1 + # arm64v8 is for Apple M1 + image: webhippie/elasticsearch:6.4 ports: - 9200:9200 - 9300:9300 @@ -23,31 +24,41 @@ services: interval: 10s timeout: 10s retries: 10 - db: - image: postgres - restart: always - ports: - - "5432:5432" - environment: - POSTGRES_USER: "pguser" - POSTGRES_PASSWORD: "pgpass" - POSTGRES_DB: "pgdb" + volumes: + # for normal elasticsearch: + # - elasticsearch:/usr/share/elasticsearch/data + # for webhippie/elasticsearch: + - elasticsearch:/var/lib/elasticsearch -# uncomment to get kibana, which can be useful for analyzing index contents -# this is currently not a required part of testing infrastructure, just left here for convenience -# kibana: -# image: docker.elastic.co/kibana/kibana:6.0.1 -# depends_on: -# elastic: -# condition: service_healthy -# links: -# - elastic + # commented out because right now we're not using postgres for tests +# comment back in if we need it for multiprocessing tests +# db: +# image: postgres +# restart: always # ports: -# - 5601:5601 +# - "5432:5432" # environment: -# - "ELASTICSEARCH_URL=http://elastic:9200" -# healthcheck: -# test: ["CMD", "curl", "-f", "http://localhost:5601"] -# interval: 10s -# timeout: 10s -# retries: 10 \ No newline at end of file +# POSTGRES_USER: "pguser" +# POSTGRES_PASSWORD: "pgpass" +# POSTGRES_DB: "pgdb" + +# uncomment to get kibana, which can be useful for analyzing index contents +# this is currently not a required part of testing infrastructure, just left here for convenience + kibana: + image: docker.elastic.co/kibana/kibana:6.4.3 + depends_on: + elastic: + condition: service_healthy + links: + - elastic + ports: + - 5601:5601 + environment: + - "ELASTICSEARCH_URL=http://elastic:9200" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:5601"] + interval: 10s + timeout: 10s + retries: 10 +volumes: + elasticsearch: \ No newline at end of file diff --git a/setup.py b/setup.py index d7d0852..74e8e9f 100755 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ def get_version(*file_paths): license='MIT', include_package_data=True, install_requires=[ - "Django>=1.8", "elasticsearch-dsl>=6.4.0<7.0.0", "texttable>=1.2.1", + "Django>=1.8", "elasticsearch-dsl>=6.4.0,<7.0.0", "texttable>=1.2.1", "multiprocessing-logging>=0.2.6" ], zip_safe=False,