Skip to content

Commit 9ec42c5

Browse files
committed
feat: Phase 4 Lab 05 — Advanced Integration (WireMock ecosystem mocks)
- docker-compose.integration.yml: full integration stack with WireMock - test-lab-XX-05.sh: WireMock stub registration + integration tests - ci.yml: lab-05-smoke job with integration stack wait steps - WireMock simulates ecosystem API (Graylog/Mattermost/Odoo/Zammad/Zabbix) - Ports, volumes, env vars, container-to-mock connectivity verified
1 parent d2138e0 commit 9ec42c5

2 files changed

Lines changed: 209 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,43 @@ run: bash tests/labs/test-lab-05-01.sh
216216
- name: Cleanup
217217
if: always()
218218
run: docker compose -f docker/docker-compose.sso.yml down -v
219+
220+
lab-05-smoke:
221+
name: Lab 05-05 -- Elasticsearch Advanced Integration (Graylog REST API)
222+
runs-on: ubuntu-latest
223+
needs: validate
224+
continue-on-error: true
225+
steps:
226+
- uses: actions/checkout@v4
227+
228+
- name: Install tools
229+
run: sudo apt-get install -y curl netcat-openbsd ldap-utils
230+
231+
- name: Validate integration compose
232+
run: docker compose -f docker/docker-compose.integration.yml config -q && echo "Integration compose valid"
233+
234+
- name: Start integration stack
235+
run: docker compose -f docker/docker-compose.integration.yml up -d
236+
237+
- name: Wait for WireMock
238+
run: timeout 90 bash -c 'until curl -sf http://localhost:8760/__admin/health; do sleep 5; done'
239+
240+
- name: Wait for Elasticsearch
241+
run: timeout 120 bash -c 'until curl -sf http://localhost:9200/_cluster/health | grep -q status; do sleep 10; done'
242+
243+
- name: Wait for Keycloak
244+
run: timeout 300 bash -c 'until curl -sf http://localhost:8505/realms/master; do sleep 10; done'
245+
246+
- name: Wait for Kibana
247+
run: timeout 300 bash -c 'until curl -sf http://localhost:5640/api/status | grep -q version; do sleep 15; done'
248+
249+
- name: Run Lab 05-05 test script
250+
run: bash tests/labs/test-lab-05-05.sh --no-cleanup
251+
252+
- name: Collect logs on failure
253+
if: failure()
254+
run: docker compose -f docker/docker-compose.integration.yml logs
255+
256+
- name: Cleanup
257+
if: always()
258+
run: docker compose -f docker/docker-compose.integration.yml down -v
Lines changed: 169 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,177 @@
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+
319
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
785
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!
895
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
10119
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
21135
networks:
22-
- it-stack-net
136+
- elastic-i05-net
137+
deploy:
138+
resources:
139+
limits:
140+
memory: 1G
141+
cpus: "1.0"
23142

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 ───────────────────────────────────────────────────────────────────
24168
networks:
25-
it-stack-net:
169+
elastic-i05-net:
170+
name: elastic-i05-net
26171
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

Comments
 (0)