|
1 | | -# Lab 05 — Advanced Integration: elasticsearch with full IT-Stack ecosystem |
2 | | ---- |
| 1 | +# ============================================================================= |
| 2 | +# IT-Stack: Elasticsearch — Lab 05: Advanced Integration |
| 3 | +# Module 05 · Phase 4 · Lab 05 |
| 4 | +# ============================================================================= |
| 5 | +# Services: Elasticsearch · Kibana · OpenLDAP · Keycloak · WireMock (Graylog-mock) |
| 6 | +# Ports: Kibana:5640 WireMock:8760 Keycloak:8505 LDAP:3884 |
| 7 | +# Credentials: |
| 8 | +# Elastic: elastic / ElasticLab05! |
| 9 | +# Keycloak: admin / Admin05! |
| 10 | +# LDAP: cn=admin,dc=lab,dc=local / LdapLab05! |
| 11 | +# What's new vs Lab 04: |
| 12 | +# + WireMock 3.x simulates Graylog REST API (/api/system, /api/search) |
| 13 | +# + Kibana configured with GRAYLOG_API_URL pointing to WireMock |
| 14 | +# + Integration tested: Kibana → Graylog API (log federation) |
| 15 | +# ============================================================================= |
| 16 | + |
| 17 | +name: it-stack-elasticsearch-lab05 |
| 18 | + |
3 | 19 | services: |
4 | | - elasticsearch: |
5 | | - image: docker.elastic.co/elasticsearch/elasticsearch:8.13.0 |
6 | | - container_name: it-stack-elasticsearch |
| 20 | + |
| 21 | + # ── Elasticsearch ────────────────────────────────────────────────────────── |
| 22 | + elastic-i05-es: |
| 23 | + image: elasticsearch:8.13.0 |
| 24 | + container_name: elastic-i05-es |
| 25 | + restart: unless-stopped |
| 26 | + environment: |
| 27 | + - discovery.type=single-node |
| 28 | + - ELASTIC_PASSWORD=ElasticLab05! |
| 29 | + - xpack.security.enabled=true |
| 30 | + - xpack.security.http.ssl.enabled=false |
| 31 | + - ES_JAVA_OPTS=-Xms512m -Xmx512m |
| 32 | + healthcheck: |
| 33 | + test: ["CMD-SHELL", "curl -sf -u elastic:ElasticLab05! http://localhost:9200/_cluster/health | grep -q '\"status\"' || exit 1"] |
| 34 | + interval: 15s |
| 35 | + timeout: 10s |
| 36 | + retries: 20 |
| 37 | + start_period: 30s |
| 38 | + networks: |
| 39 | + - elastic-i05-net |
| 40 | + deploy: |
| 41 | + resources: |
| 42 | + limits: |
| 43 | + memory: 1G |
| 44 | + cpus: "1.0" |
| 45 | + |
| 46 | + # ── Kibana ───────────────────────────────────────────────────────────────── |
| 47 | + elastic-i05-kib: |
| 48 | + image: kibana:8.13.0 |
| 49 | + container_name: elastic-i05-kib |
| 50 | + restart: unless-stopped |
| 51 | + depends_on: |
| 52 | + elastic-i05-es: |
| 53 | + condition: service_healthy |
| 54 | + ports: |
| 55 | + - "5640:5601" |
| 56 | + environment: |
| 57 | + ELASTICSEARCH_HOSTS: http://elastic-i05-es:9200 |
| 58 | + ELASTICSEARCH_USERNAME: kibana_system |
| 59 | + ELASTICSEARCH_PASSWORD: ElasticLab05! |
| 60 | + KEYCLOAK_URL: http://elastic-i05-kc:8080 |
| 61 | + KEYCLOAK_REALM: it-stack |
| 62 | + KEYCLOAK_CLIENT_ID: kibana |
| 63 | + # Graylog integration (via WireMock) |
| 64 | + GRAYLOG_API_URL: http://elastic-i05-mock:8080 |
| 65 | + GRAYLOG_API_USER: admin |
| 66 | + GRAYLOG_API_TOKEN: lab-graylog-token-05 |
| 67 | + healthcheck: |
| 68 | + test: ["CMD-SHELL", "curl -sf http://localhost:5601/api/status | grep -q 'available\|green\|yellow' || exit 1"] |
| 69 | + interval: 20s |
| 70 | + timeout: 10s |
| 71 | + retries: 15 |
| 72 | + start_period: 30s |
| 73 | + networks: |
| 74 | + - elastic-i05-net |
| 75 | + deploy: |
| 76 | + resources: |
| 77 | + limits: |
| 78 | + memory: 1G |
| 79 | + cpus: "1.0" |
| 80 | + |
| 81 | + # ── OpenLDAP ─────────────────────────────────────────────────────────────── |
| 82 | + elastic-i05-ldap: |
| 83 | + image: osixia/openldap:1.5.0 |
| 84 | + container_name: elastic-i05-ldap |
7 | 85 | restart: unless-stopped |
| 86 | + environment: |
| 87 | + LDAP_ORGANISATION: "IT-Stack Lab" |
| 88 | + LDAP_DOMAIN: lab.local |
| 89 | + LDAP_ADMIN_PASSWORD: LdapLab05! |
| 90 | + LDAP_CONFIG_PASSWORD: ConfigLab05! |
| 91 | + LDAP_BASE_DN: dc=lab,dc=local |
| 92 | + LDAP_READONLY_USER: "true" |
| 93 | + LDAP_READONLY_USER_USERNAME: readonly |
| 94 | + LDAP_READONLY_USER_PASSWORD: ReadOnly05! |
8 | 95 | ports: |
9 | | - - "9200:$firstPort" |
| 96 | + - "3884:389" |
| 97 | + volumes: |
| 98 | + - elastic-i05-ldap-data:/var/lib/ldap |
| 99 | + - elastic-i05-ldap-config:/etc/ldap/slapd.d |
| 100 | + healthcheck: |
| 101 | + test: ["CMD-SHELL", "ldapsearch -x -H ldap://localhost -b dc=lab,dc=local -D cn=admin,dc=lab,dc=local -w LdapLab05! cn=admin > /dev/null 2>&1 || exit 1"] |
| 102 | + interval: 10s |
| 103 | + timeout: 5s |
| 104 | + retries: 15 |
| 105 | + networks: |
| 106 | + - elastic-i05-net |
| 107 | + deploy: |
| 108 | + resources: |
| 109 | + limits: |
| 110 | + memory: 256M |
| 111 | + cpus: "0.25" |
| 112 | + |
| 113 | + # ── Keycloak ─────────────────────────────────────────────────────────────── |
| 114 | + elastic-i05-kc: |
| 115 | + image: quay.io/keycloak/keycloak:24.0.3 |
| 116 | + container_name: elastic-i05-kc |
| 117 | + restart: unless-stopped |
| 118 | + command: start-dev |
10 | 119 | environment: |
11 | | - - IT_STACK_ENV=lab-05-integration |
12 | | - - KEYCLOAK_URL= |
13 | | - - DB_HOST= |
14 | | - - REDIS_HOST= |
15 | | - - SMTP_HOST= |
16 | | - - GRAYLOG_HOST= |
17 | | - extra_hosts: |
18 | | - - "lab-id1:10.0.50.11" |
19 | | - - "lab-db1:10.0.50.12" |
20 | | - - "lab-proxy1:10.0.50.15" |
| 120 | + KEYCLOAK_ADMIN: admin |
| 121 | + KEYCLOAK_ADMIN_PASSWORD: Admin05! |
| 122 | + KC_HEALTH_ENABLED: "true" |
| 123 | + KC_DB: dev-file |
| 124 | + KC_HOSTNAME_STRICT: "false" |
| 125 | + KC_HOSTNAME_STRICT_HTTPS: "false" |
| 126 | + KC_HTTP_ENABLED: "true" |
| 127 | + ports: |
| 128 | + - "8505:8080" |
| 129 | + healthcheck: |
| 130 | + test: ["CMD-SHELL", "curl -sf http://localhost:8080/realms/master || exit 1"] |
| 131 | + interval: 15s |
| 132 | + timeout: 10s |
| 133 | + retries: 20 |
| 134 | + start_period: 30s |
21 | 135 | networks: |
22 | | - - it-stack-net |
| 136 | + - elastic-i05-net |
| 137 | + deploy: |
| 138 | + resources: |
| 139 | + limits: |
| 140 | + memory: 1G |
| 141 | + cpus: "1.0" |
23 | 142 |
|
| 143 | + # ── WireMock — Graylog REST API mock ─────────────────────────────────────── |
| 144 | + elastic-i05-mock: |
| 145 | + image: wiremock/wiremock:3.3.1 |
| 146 | + container_name: elastic-i05-mock |
| 147 | + restart: unless-stopped |
| 148 | + command: > |
| 149 | + --port=8080 |
| 150 | + --verbose |
| 151 | + --global-response-templating |
| 152 | + ports: |
| 153 | + - "8760:8080" |
| 154 | + healthcheck: |
| 155 | + test: ["CMD-SHELL", "curl -sf http://localhost:8080/__admin/health || exit 1"] |
| 156 | + interval: 10s |
| 157 | + timeout: 5s |
| 158 | + retries: 10 |
| 159 | + networks: |
| 160 | + - elastic-i05-net |
| 161 | + deploy: |
| 162 | + resources: |
| 163 | + limits: |
| 164 | + memory: 256M |
| 165 | + cpus: "0.25" |
| 166 | + |
| 167 | +# ── Networks ─────────────────────────────────────────────────────────────────── |
24 | 168 | networks: |
25 | | - it-stack-net: |
| 169 | + elastic-i05-net: |
| 170 | + name: elastic-i05-net |
26 | 171 | driver: bridge |
| 172 | + |
| 173 | +# ── Volumes ──────────────────────────────────────────────────────────────────── |
| 174 | +volumes: |
| 175 | + elastic-i05-es-data: |
| 176 | + elastic-i05-ldap-data: |
| 177 | + elastic-i05-ldap-config: |
0 commit comments