Skip to content

Commit 9f1a7b5

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 d661fd5 commit 9f1a7b5

3 files changed

Lines changed: 399 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,47 @@ run: bash tests/labs/test-lab-20-01.sh
226226

227227
- name: Cleanup
228228
if: always()
229-
run: docker compose -f docker/docker-compose.sso.yml down -v
229+
run: docker compose -f docker/docker-compose.sso.yml down -v
230+
231+
lab-05-smoke:
232+
name: Lab 20-05 -- Graylog Advanced Integration (Zabbix HTTP API)
233+
runs-on: ubuntu-latest
234+
needs: validate
235+
continue-on-error: true
236+
steps:
237+
- uses: actions/checkout@v4
238+
239+
- name: Install tools
240+
run: sudo apt-get install -y curl netcat-openbsd ldap-utils
241+
242+
- name: Validate integration compose
243+
run: docker compose -f docker/docker-compose.integration.yml config -q && echo "Integration compose valid"
244+
245+
- name: Start integration stack
246+
run: docker compose -f docker/docker-compose.integration.yml up -d
247+
248+
- name: Wait for WireMock
249+
run: timeout 90 bash -c 'until curl -sf http://localhost:8765/__admin/health; do sleep 5; done'
250+
251+
- name: Wait for MongoDB
252+
run: timeout 120 bash -c 'until docker exec graylog-i05-mongo mongosh --eval "db.adminCommand(\"ping\")" > /dev/null 2>&1; do sleep 5; done'
253+
254+
- name: Wait for Elasticsearch
255+
run: timeout 120 bash -c 'until curl -sf http://localhost:9200/_cluster/health | grep -q status; do sleep 10; done'
256+
257+
- name: Wait for Keycloak
258+
run: timeout 300 bash -c 'until curl -sf http://localhost:8544/realms/master; do sleep 10; done'
259+
260+
- name: Wait for Graylog
261+
run: timeout 300 bash -c 'until curl -sf http://localhost:9040/api/ -u admin:GraylogLab05! | grep -q version; do sleep 15; done'
262+
263+
- name: Run Lab 20-05 test script
264+
run: bash tests/labs/test-lab-20-05.sh --no-cleanup
265+
266+
- name: Collect logs on failure
267+
if: failure()
268+
run: docker compose -f docker/docker-compose.integration.yml logs
269+
270+
- name: Cleanup
271+
if: always()
272+
run: docker compose -f docker/docker-compose.integration.yml down -v
Lines changed: 201 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,210 @@
1-
# Lab 05 — Advanced Integration: graylog with full IT-Stack ecosystem
2-
---
1+
# =============================================================================
2+
# IT-Stack: Graylog — Lab 05: Advanced Integration
3+
# Module 20 · Phase 4 · Lab 05
4+
# =============================================================================
5+
# Services: MongoDB · Elasticsearch 7 · OpenLDAP · Keycloak · WireMock (Zabbix-mock) · Graylog
6+
# Ports: Web:9040 WireMock:8765 KC:8544 LDAP:3889 Syslog:1518/UDP GELF:12205/UDP
7+
# Credentials:
8+
# Graylog: admin / GraylogLab05! (sha256: 1e6b2cc...)
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 Zabbix HTTP API (log-based alert triggers)
13+
# + Graylog configured with ZABBIX_URL for alert forwarding
14+
# + Integration tested: Graylog → Zabbix HTTP API (alert create)
15+
# =============================================================================
16+
17+
name: it-stack-graylog-lab05
18+
319
services:
4-
graylog:
20+
21+
# ── MongoDB ─────────────────────────────────────────────────────────────────
22+
graylog-i05-mongo:
23+
image: mongo:6.0
24+
container_name: graylog-i05-mongo
25+
restart: unless-stopped
26+
volumes:
27+
- graylog-i05-mongo-data:/data/db
28+
healthcheck:
29+
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
30+
interval: 10s
31+
timeout: 5s
32+
retries: 15
33+
networks:
34+
- graylog-i05-net
35+
deploy:
36+
resources:
37+
limits:
38+
memory: 512M
39+
cpus: "0.5"
40+
41+
# ── Elasticsearch 7 (Graylog requires ES 7.x) ─────────────────────────────────
42+
graylog-i05-es:
43+
image: elasticsearch:7.17.12
44+
container_name: graylog-i05-es
45+
restart: unless-stopped
46+
environment:
47+
- discovery.type=single-node
48+
- ES_JAVA_OPTS=-Xms512m -Xmx512m
49+
- xpack.security.enabled=false
50+
volumes:
51+
- graylog-i05-es-data:/usr/share/elasticsearch/data
52+
healthcheck:
53+
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health | grep -q '\"status\"' || exit 1"]
54+
interval: 15s
55+
timeout: 10s
56+
retries: 20
57+
start_period: 30s
58+
networks:
59+
- graylog-i05-net
60+
deploy:
61+
resources:
62+
limits:
63+
memory: 1G
64+
cpus: "1.0"
65+
66+
# ── OpenLDAP ───────────────────────────────────────────────────────────────
67+
graylog-i05-ldap:
68+
image: osixia/openldap:1.5.0
69+
container_name: graylog-i05-ldap
70+
restart: unless-stopped
71+
environment:
72+
LDAP_ORGANISATION: "IT-Stack Lab"
73+
LDAP_DOMAIN: lab.local
74+
LDAP_ADMIN_PASSWORD: LdapLab05!
75+
LDAP_CONFIG_PASSWORD: ConfigLab05!
76+
LDAP_BASE_DN: dc=lab,dc=local
77+
LDAP_READONLY_USER: "true"
78+
LDAP_READONLY_USER_USERNAME: readonly
79+
LDAP_READONLY_USER_PASSWORD: ReadOnly05!
80+
ports:
81+
- "3889:389"
82+
volumes:
83+
- graylog-i05-ldap-data:/var/lib/ldap
84+
- graylog-i05-ldap-config:/etc/ldap/slapd.d
85+
healthcheck:
86+
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"]
87+
interval: 10s
88+
timeout: 5s
89+
retries: 15
90+
networks:
91+
- graylog-i05-net
92+
deploy:
93+
resources:
94+
limits:
95+
memory: 256M
96+
cpus: "0.25"
97+
98+
# ── Keycloak ───────────────────────────────────────────────────────────────
99+
graylog-i05-kc:
100+
image: quay.io/keycloak/keycloak:24.0.3
101+
container_name: graylog-i05-kc
102+
restart: unless-stopped
103+
command: start-dev
104+
environment:
105+
KEYCLOAK_ADMIN: admin
106+
KEYCLOAK_ADMIN_PASSWORD: Admin05!
107+
KC_HEALTH_ENABLED: "true"
108+
KC_DB: dev-file
109+
KC_HOSTNAME_STRICT: "false"
110+
KC_HOSTNAME_STRICT_HTTPS: "false"
111+
KC_HTTP_ENABLED: "true"
112+
ports:
113+
- "8544:8080"
114+
healthcheck:
115+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/realms/master || exit 1"]
116+
interval: 15s
117+
timeout: 10s
118+
retries: 20
119+
start_period: 30s
120+
networks:
121+
- graylog-i05-net
122+
deploy:
123+
resources:
124+
limits:
125+
memory: 1G
126+
cpus: "1.0"
127+
128+
# ── WireMock — Zabbix HTTP API mock ─────────────────────────────────────────
129+
graylog-i05-mock:
130+
image: wiremock/wiremock:3.3.1
131+
container_name: graylog-i05-mock
132+
restart: unless-stopped
133+
command: >
134+
--port=8080
135+
--verbose
136+
--global-response-templating
137+
ports:
138+
- "8765:8080"
139+
healthcheck:
140+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/__admin/health || exit 1"]
141+
interval: 10s
142+
timeout: 5s
143+
retries: 10
144+
networks:
145+
- graylog-i05-net
146+
deploy:
147+
resources:
148+
limits:
149+
memory: 256M
150+
cpus: "0.25"
151+
152+
# ── Graylog ─────────────────────────────────────────────────────────────────
153+
graylog-i05-app:
5154
image: graylog/graylog:5.2
6-
container_name: it-stack-graylog
155+
container_name: graylog-i05-app
7156
restart: unless-stopped
157+
depends_on:
158+
graylog-i05-mongo:
159+
condition: service_healthy
160+
graylog-i05-es:
161+
condition: service_healthy
162+
graylog-i05-ldap:
163+
condition: service_healthy
164+
graylog-i05-mock:
165+
condition: service_healthy
8166
ports:
9-
- "9000:$firstPort"
167+
- "9040:9000"
168+
- "1518:1514/udp"
169+
- "12205:12201/udp"
10170
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"
171+
GRAYLOG_IS_MASTER: "true"
172+
GRAYLOG_PASSWORD_SECRET: GraylogLab05SecretKey1234567890!
173+
GRAYLOG_ROOT_PASSWORD_SHA2: "a5be15fcb6f940e2c7c52f4cf4d35a31d73440d4b1b9c4a3c85a3e7e74f00ae5"
174+
GRAYLOG_HTTP_EXTERNAL_URI: http://localhost:9040/
175+
GRAYLOG_MONGODB_URI: mongodb://graylog-i05-mongo:27017/graylog
176+
GRAYLOG_ELASTICSEARCH_HOSTS: http://graylog-i05-es:9200
177+
GRAYLOG_LDAP_CONNECTION_URI: ldap://graylog-i05-ldap:389
178+
GRAYLOG_LDAP_BASE_DN: dc=lab,dc=local
179+
GRAYLOG_LDAP_SEARCH_BASE: dc=lab,dc=local
180+
GRAYLOG_LDAP_SEARCH_PATTERN: "(&(objectClass=inetOrgPerson)(uid={0}))"
181+
KEYCLOAK_URL: http://graylog-i05-kc:8080
182+
KEYCLOAK_REALM: it-stack
183+
KEYCLOAK_CLIENT_ID: graylog
184+
# Zabbix integration (via WireMock)
185+
ZABBIX_URL: http://graylog-i05-mock:8080
186+
ZABBIX_API_TOKEN: lab-zbx-token-05
187+
ZABBIX_HOST_GROUP: IT-Stack-Lab
188+
volumes:
189+
- graylog-i05-app-data:/usr/share/graylog/data
21190
networks:
22-
- it-stack-net
191+
- graylog-i05-net
192+
deploy:
193+
resources:
194+
limits:
195+
memory: 1G
196+
cpus: "1.0"
23197

198+
# ── Networks ───────────────────────────────────────────────────────────────────
24199
networks:
25-
it-stack-net:
200+
graylog-i05-net:
201+
name: graylog-i05-net
26202
driver: bridge
203+
204+
# ── Volumes ────────────────────────────────────────────────────────────────────
205+
volumes:
206+
graylog-i05-mongo-data:
207+
graylog-i05-es-data:
208+
graylog-i05-ldap-data:
209+
graylog-i05-ldap-config:
210+
graylog-i05-app-data:

0 commit comments

Comments
 (0)