From de051be47b708528e439d9b150c7a3466d7a1533 Mon Sep 17 00:00:00 2001 From: drosetti Date: Tue, 22 Oct 2024 16:45:57 +0200 Subject: [PATCH] fix --- docker/elasticsearch.override.yml | 7 +++---- docker/test.elasticsearch.override.yml | 23 ----------------------- intel_owl/settings/elasticsearch.py | 14 ++++---------- start | 4 ++-- 4 files changed, 9 insertions(+), 39 deletions(-) delete mode 100644 docker/test.elasticsearch.override.yml diff --git a/docker/elasticsearch.override.yml b/docker/elasticsearch.override.yml index 5cf1afd66..fa06160b0 100644 --- a/docker/elasticsearch.override.yml +++ b/docker/elasticsearch.override.yml @@ -2,6 +2,8 @@ services: uwsgi: depends_on: - elasticsearch + volumes: + - ../certs:/opt/deploy/intel_owl/certs elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:8.15.0 @@ -19,10 +21,7 @@ services: - ../certs:/usr/share/elasticsearch/config/certificates environment: - discovery.type=single-node - - xpack.security.http.ssl.enabled=true - - xpack.security.http.ssl.key=/usr/share/elasticsearch/config/certificates/elastic.key - - xpack.security.http.ssl.certificate_authorities=/usr/share/elasticsearch/config/certificates/elastic_ca.crt - - xpack.security.http.ssl.certificate=/usr/share/elasticsearch/config/certificates/elastic.crt + - xpack.security.http.ssl.enabled=false volumes: elastic_data: \ No newline at end of file diff --git a/docker/test.elasticsearch.override.yml b/docker/test.elasticsearch.override.yml deleted file mode 100644 index deb784c23..000000000 --- a/docker/test.elasticsearch.override.yml +++ /dev/null @@ -1,23 +0,0 @@ -services: - uwsgi: - depends_on: - - elasticsearch - - elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.15.0 - container_name: intelowl_elasticsearch - healthcheck: - test: ["CMD-SHELL", "nc -z localhost 9200 || exit 1"] - interval: 5s - timeout: 2s - start_period: 2s - retries: 6 - env_file: - - env_file_app - volumes: - - elastic_data:/usr/share/elasticsearch/data - environment: - - xpack.security.http.ssl.enabled=false - -volumes: - elastic_data: \ No newline at end of file diff --git a/intel_owl/settings/elasticsearch.py b/intel_owl/settings/elasticsearch.py index 8c618b817..370004599 100644 --- a/intel_owl/settings/elasticsearch.py +++ b/intel_owl/settings/elasticsearch.py @@ -4,7 +4,6 @@ from elasticsearch import Elasticsearch from intel_owl import secrets -from intel_owl.settings.commons import STAGE_CI, STAGE_LOCAL ELASTICSEARCH_BI_ENABLED = ( secrets.get_secret("ELASTICSEARCH_BI_ENABLED", False) == "True" @@ -29,19 +28,14 @@ f"ELASTICSEARCH BI client configuration did not connect correctly: {ELASTICSEARCH_BI_CLIENT.info()}" ) -ELASTIC_CLIENT_NAME = ( - "default" # use this as value for the param "using" in Search to use the client -) ELASTIC_HOST = secrets.get_secret("ELASTIC_HOST") if ELASTIC_HOST: - ELASTIC_PASSWORD = secrets.get_secret("ELASTIC_PASSWORD") - elastic_client_settings = {"hosts": ELASTIC_HOST} + + ELASTIC_PASSWORD = secrets.get_secret("ELASTIC_PASSWORD") if ELASTIC_PASSWORD: elastic_client_settings["basic_auth"] = ("elastic", ELASTIC_PASSWORD) - if STAGE_LOCAL or STAGE_CI: - elastic_client_settings["verify_certs"] = False - ELASTICSEARCH_DSL = {ELASTIC_CLIENT_NAME: elastic_client_settings} + ELASTICSEARCH_DSL = {"default": elastic_client_settings} ELASTICSEARCH_DSL_INDEX_SETTINGS = { "number_of_shards": int(secrets.get_secret("ELASTICSEARCH_DSL_NO_OF_SHARDS")), @@ -52,5 +46,5 @@ else: ELASTICSEARCH_DSL_AUTOSYNC = False ELASTICSEARCH_DSL = { - ELASTIC_CLIENT_NAME: {"hosts": ""}, + "default": {"hosts": ""}, } diff --git a/start b/start index 2a1689c54..154de569b 100755 --- a/start +++ b/start @@ -9,7 +9,7 @@ declare -A env_arguments=(["prod"]=1 ["test"]=1 ["ci"]=1) declare -A test_mode=(["test"]=1 ["ci"]=1) declare -A cmd_arguments=(["build"]=1 ["up"]=1 ["start"]=1 ["restart"]=1 ["down"]=1 ["stop"]=1 ["kill"]=1 ["logs"]=1 ["ps"]=1) -declare -A path_mapping=(["default"]="docker/default.yml" ["postgres"]="docker/postgres.override.yml" ["rabbitmq"]="docker/rabbitmq.override.yml" ["test"]="docker/test.override.yml" ["ci"]="docker/ci.override.yml" ["custom"]="docker/custom.override.yml" ["traefik"]="docker/traefik.yml" ["traefik_prod"]="docker/traefik_prod.yml" ["traefik_local"]="docker/traefik_local.yml" ["multi_queue"]="docker/multi-queue.override.yml" ["test_multi_queue"]="docker/test.multi-queue.override.yml" ["flower"]="docker/flower.override.yml" ["test_flower"]="docker/test.flower.override.yml" ["elastic"]="docker/elasticsearch.override.yml" ["test_elastic"]="docker/test.elasticsearch.override.yml" ["https"]="docker/https.override.yml" ["nfs"]="docker/nfs.override.yml" ["redis"]="docker/redis.override.yml" ["nginx_default"]="docker/nginx.override.yml") +declare -A path_mapping=(["default"]="docker/default.yml" ["postgres"]="docker/postgres.override.yml" ["rabbitmq"]="docker/rabbitmq.override.yml" ["test"]="docker/test.override.yml" ["ci"]="docker/ci.override.yml" ["custom"]="docker/custom.override.yml" ["traefik"]="docker/traefik.yml" ["traefik_prod"]="docker/traefik_prod.yml" ["traefik_local"]="docker/traefik_local.yml" ["multi_queue"]="docker/multi-queue.override.yml" ["test_multi_queue"]="docker/test.multi-queue.override.yml" ["flower"]="docker/flower.override.yml" ["test_flower"]="docker/test.flower.override.yml" ["elastic"]="docker/elasticsearch.override.yml" ["https"]="docker/https.override.yml" ["nfs"]="docker/nfs.override.yml" ["redis"]="docker/redis.override.yml" ["nginx_default"]="docker/nginx.override.yml") print_synopsis () { echo "SYNOPSIS" echo -e " start [OPTIONS]" @@ -297,7 +297,7 @@ done # add all the test files if [[ $env_argument == "test" ]]; then - test_values=("multi_queue" "flower", "elastic") + test_values=("multi_queue" "flower") for value in "${test_values[@]}"; do if [ "${params["$value"]}" ]; then compose_files+=("${path_mapping["test_$value"]}")