diff --git a/multi-node/docker-compose.yml b/multi-node/docker-compose.yml index 8eafe5ce..035fd9ab 100644 --- a/multi-node/docker-compose.yml +++ b/multi-node/docker-compose.yml @@ -5,6 +5,14 @@ services: hostname: wazuh.master container_name: multi-node-wazuh.master restart: always + depends_on: + wazuh1.indexer: + condition: service_healthy + healthcheck: + test: [ "CMD-SHELL", "curl -s -k -I -u $$API_USERNAME:$$API_PASSWORD https://localhost:55000/security/user/authenticate > /dev/null || exit 1" ] + interval: 15s + timeout: 5s + retries: 5 ulimits: memlock: soft: -1 @@ -36,11 +44,18 @@ services: - ./wazuh-certificates/root-ca.pem:/var/wazuh-manager/etc/certs/root-ca.pem - ./wazuh-certificates/wazuh.master.pem:/var/wazuh-manager/etc/certs/manager.pem - ./wazuh-certificates/wazuh.master-key.pem:/var/wazuh-manager/etc/certs/manager-key.pem + wazuh.worker: image: wazuh/wazuh-manager:5.0.0 hostname: wazuh.worker container_name: multi-node-wazuh.worker restart: always + healthcheck: + test: [ "CMD-SHELL", "timeout 2 bash -c ' + /bin/sh -c " echo 'Waiting for wazuh1.indexer...'; sleep 5; until getent hosts wazuh1.indexer; do sleep 2; done; /entrypoint.sh opensearch" + depends_on: + - wazuh1.indexer environment: - OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g - bootstrap.memory_lock=true - - network.host=wazuh2.indexer + - network.host=0.0.0.0 - node.name=wazuh2.indexer - cluster.initial_cluster_manager_nodes=wazuh1.indexer,wazuh2.indexer,wazuh3.indexer - discovery.seed_hosts=wazuh1.indexer,wazuh2.indexer,wazuh3.indexer @@ -123,6 +151,12 @@ services: nofile: soft: 65536 hard: 65536 + healthcheck: + test: [ "CMD-SHELL", "curl -s -k -u $$INDEXER_USERNAME:$$INDEXER_PASSWORD https://localhost:9200/_cluster/health" ] + interval: 10s + timeout: 5s + retries: 10 + start_period: 30s volumes: - wazuh-indexer-data-2:/var/lib/wazuh-indexer - ./wazuh-certificates/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem @@ -134,10 +168,14 @@ services: hostname: wazuh3.indexer container_name: multi-node-wazuh3.indexer restart: always + entrypoint: > + /bin/sh -c " echo 'Waiting for wazuh1.indexer...'; sleep 5;until getent hosts wazuh1.indexer; do sleep 2; done; /entrypoint.sh opensearch" + depends_on: + - wazuh1.indexer environment: - OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g - bootstrap.memory_lock=true - - network.host=wazuh3.indexer + - network.host=0.0.0.0 - node.name=wazuh3.indexer - cluster.initial_cluster_manager_nodes=wazuh1.indexer,wazuh2.indexer,wazuh3.indexer - discovery.seed_hosts=wazuh1.indexer,wazuh2.indexer,wazuh3.indexer @@ -151,6 +189,12 @@ services: nofile: soft: 65536 hard: 65536 + healthcheck: + test: [ "CMD-SHELL", "curl -s -k -u $$INDEXER_USERNAME:$$INDEXER_PASSWORD https://localhost:9200/_cluster/health" ] + interval: 10s + timeout: 5s + retries: 10 + start_period: 30s volumes: - wazuh-indexer-data-3:/var/lib/wazuh-indexer - ./wazuh-certificates/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem @@ -162,6 +206,12 @@ services: hostname: wazuh.dashboard container_name: multi-node-wazuh.dashboard restart: always + healthcheck: + test: [ "CMD", "curl", "-k", "-s", "-o", "/dev/null", "https://localhost:5601/login" ] + interval: 30s + timeout: 10s + retries: 3 + start_period: 30s ports: - 443:5601 environment: @@ -185,11 +235,10 @@ services: - wazuh-dashboard-config:/usr/share/wazuh-dashboard/config - wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom depends_on: - - wazuh1.indexer - - wazuh.master - links: - - wazuh1.indexer:wazuh1.indexer - - wazuh.master:wazuh.master + wazuh1.indexer: + condition: service_healthy + wazuh.master: + condition: service_healthy nginx: image: nginx:stable @@ -202,10 +251,6 @@ services: - wazuh.master - wazuh.worker - wazuh.dashboard - links: - - wazuh.master:wazuh.master - - wazuh.worker:wazuh.worker - - wazuh.dashboard:wazuh.dashboard volumes: - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro diff --git a/single-node/docker-compose.yml b/single-node/docker-compose.yml index 58a74613..a473cf16 100644 --- a/single-node/docker-compose.yml +++ b/single-node/docker-compose.yml @@ -5,6 +5,14 @@ services: hostname: wazuh.manager container_name: single-node-wazuh.manager restart: always + depends_on: + wazuh.indexer: + condition: service_healthy + healthcheck: + test: [ "CMD-SHELL", "curl -s -k -I -u $$API_USERNAME:$$API_PASSWORD https://localhost:55000/security/user/authenticate > /dev/null || exit 1" ] + interval: 15s + timeout: 5s + retries: 5 ulimits: memlock: soft: -1 @@ -60,6 +68,14 @@ services: nofile: soft: 65536 hard: 65536 + healthcheck: + test: + - "CMD-SHELL" + - "curl -k -s -u $${INDEXER_USERNAME}:$${INDEXER_PASSWORD} https://localhost:9200/_cluster/health | grep -vq '\"status\":\"red\"'" + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s volumes: - wazuh-indexer-data:/var/lib/wazuh-indexer - ./wazuh-certificates/root-ca.pem:/usr/share/wazuh-indexer/config/certs/root-ca.pem @@ -73,6 +89,12 @@ services: hostname: wazuh.dashboard container_name: single-node-wazuh.dashboard restart: always + healthcheck: + test: [ "CMD", "curl", "-k", "-s", "-o", "/dev/null", "https://localhost:5601/login" ] + interval: 30s + timeout: 10s + retries: 3 + start_period: 30s ports: - 443:5601 environment: @@ -96,10 +118,10 @@ services: - wazuh-dashboard-config:/usr/share/wazuh-dashboard/config - wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom depends_on: - - wazuh.indexer - links: - - wazuh.indexer:wazuh.indexer - - wazuh.manager:wazuh.manager + wazuh.indexer: + condition: service_healthy + wazuh.manager: + condition: service_healthy volumes: wazuh_api_configuration: