Skip to content

Commit 6e1bf1b

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 7580152 commit 6e1bf1b

3 files changed

Lines changed: 415 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,49 @@ run: bash tests/labs/test-lab-19-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 19-05 -- Zabbix Advanced Integration (Mattermost Webhook)
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 default-mysql-client 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:8764/__admin/health; do sleep 5; done'
250+
251+
- name: Wait for MySQL
252+
run: timeout 120 bash -c 'until docker exec zabbix-i05-db mysqladmin ping -uroot -pRootLab05! --silent 2>/dev/null; do sleep 5; done'
253+
254+
- name: Wait for Zabbix Server
255+
run: |
256+
timeout 120 bash -c 'until docker ps --format "{{.Names}}" | grep -q zabbix-i05-server; do sleep 5; done'
257+
sleep 30
258+
259+
- name: Wait for Keycloak
260+
run: timeout 300 bash -c 'until curl -sf http://localhost:8543/realms/master; do sleep 10; done'
261+
262+
- name: Wait for Zabbix Web
263+
run: timeout 300 bash -c 'until curl -sf http://localhost:8443/ | grep -qi zabbix; do sleep 15; done'
264+
265+
- name: Run Lab 19-05 test script
266+
run: bash tests/labs/test-lab-19-05.sh --no-cleanup
267+
268+
- name: Collect logs on failure
269+
if: failure()
270+
run: docker compose -f docker/docker-compose.integration.yml logs
271+
272+
- name: Cleanup
273+
if: always()
274+
run: docker compose -f docker/docker-compose.integration.yml down -v
Lines changed: 221 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,229 @@
1-
# Lab 05 — Advanced Integration: zabbix with full IT-Stack ecosystem
2-
---
1+
# =============================================================================
2+
# IT-Stack: Zabbix — Lab 05: Advanced Integration
3+
# Module 19 · Phase 4 · Lab 05
4+
# =============================================================================
5+
# Services: MySQL · OpenLDAP · Keycloak · WireMock (Mattermost-mock)
6+
# Mailhog · Zabbix Server · Zabbix Web
7+
# Ports: Web:8443 WireMock:8764 KC:8543 LDAP:3888 MH:8743
8+
# Credentials:
9+
# DB root: RootLab05! zabbix: ZabbixLab05!
10+
# Keycloak: admin / Admin05!
11+
# LDAP: cn=admin,dc=lab,dc=local / LdapLab05!
12+
# What's new vs Lab 04:
13+
# + WireMock 3.x simulates Mattermost incoming webhook API
14+
# + Zabbix web configured with MATTERMOST_WEBHOOK_URL for alerts
15+
# + Integration tested: Zabbix alert → Mattermost #ops-alerts (WireMock)
16+
# =============================================================================
17+
18+
name: it-stack-zabbix-lab05
19+
320
services:
4-
zabbix:
5-
image: zabbix/zabbix-server-pgsql:alpine-6.4-latest
6-
container_name: it-stack-zabbix
21+
22+
# ── MySQL ──────────────────────────────────────────────────────────────────
23+
zabbix-i05-db:
24+
image: mysql:8.0
25+
container_name: zabbix-i05-db
26+
restart: unless-stopped
27+
environment:
28+
MYSQL_ROOT_PASSWORD: RootLab05!
29+
MYSQL_DATABASE: zabbix
30+
MYSQL_USER: zabbix
31+
MYSQL_PASSWORD: ZabbixLab05!
32+
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --default-authentication-plugin=mysql_native_password
33+
volumes:
34+
- zabbix-i05-db-data:/var/lib/mysql
35+
healthcheck:
36+
test: ["CMD", "mysqladmin", "ping", "-uroot", "-pRootLab05!", "--silent"]
37+
interval: 10s
38+
timeout: 5s
39+
retries: 15
40+
networks:
41+
- zabbix-i05-net
42+
deploy:
43+
resources:
44+
limits:
45+
memory: 512M
46+
cpus: "0.5"
47+
48+
# ── OpenLDAP ───────────────────────────────────────────────────────────────
49+
zabbix-i05-ldap:
50+
image: osixia/openldap:1.5.0
51+
container_name: zabbix-i05-ldap
52+
restart: unless-stopped
53+
environment:
54+
LDAP_ORGANISATION: "IT-Stack Lab"
55+
LDAP_DOMAIN: lab.local
56+
LDAP_ADMIN_PASSWORD: LdapLab05!
57+
LDAP_CONFIG_PASSWORD: ConfigLab05!
58+
LDAP_BASE_DN: dc=lab,dc=local
59+
LDAP_READONLY_USER: "true"
60+
LDAP_READONLY_USER_USERNAME: readonly
61+
LDAP_READONLY_USER_PASSWORD: ReadOnly05!
62+
ports:
63+
- "3888:389"
64+
volumes:
65+
- zabbix-i05-ldap-data:/var/lib/ldap
66+
- zabbix-i05-ldap-config:/etc/ldap/slapd.d
67+
healthcheck:
68+
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"]
69+
interval: 10s
70+
timeout: 5s
71+
retries: 15
72+
networks:
73+
- zabbix-i05-net
74+
deploy:
75+
resources:
76+
limits:
77+
memory: 256M
78+
cpus: "0.25"
79+
80+
# ── Keycloak ───────────────────────────────────────────────────────────────
81+
zabbix-i05-kc:
82+
image: quay.io/keycloak/keycloak:24.0.3
83+
container_name: zabbix-i05-kc
84+
restart: unless-stopped
85+
command: start-dev
86+
environment:
87+
KEYCLOAK_ADMIN: admin
88+
KEYCLOAK_ADMIN_PASSWORD: Admin05!
89+
KC_HEALTH_ENABLED: "true"
90+
KC_DB: dev-file
91+
KC_HOSTNAME_STRICT: "false"
92+
KC_HOSTNAME_STRICT_HTTPS: "false"
93+
KC_HTTP_ENABLED: "true"
94+
ports:
95+
- "8543:8080"
96+
healthcheck:
97+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/realms/master || exit 1"]
98+
interval: 15s
99+
timeout: 10s
100+
retries: 20
101+
start_period: 30s
102+
networks:
103+
- zabbix-i05-net
104+
deploy:
105+
resources:
106+
limits:
107+
memory: 1G
108+
cpus: "1.0"
109+
110+
# ── WireMock — Mattermost incoming webhook mock ───────────────────────────────
111+
zabbix-i05-mock:
112+
image: wiremock/wiremock:3.3.1
113+
container_name: zabbix-i05-mock
114+
restart: unless-stopped
115+
command: >
116+
--port=8080
117+
--verbose
118+
--global-response-templating
119+
ports:
120+
- "8764:8080"
121+
healthcheck:
122+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/__admin/health || exit 1"]
123+
interval: 10s
124+
timeout: 5s
125+
retries: 10
126+
networks:
127+
- zabbix-i05-net
128+
deploy:
129+
resources:
130+
limits:
131+
memory: 256M
132+
cpus: "0.25"
133+
134+
# ── Mailhog ────────────────────────────────────────────────────────────────
135+
zabbix-i05-mail:
136+
image: mailhog/mailhog:latest
137+
container_name: zabbix-i05-mail
7138
restart: unless-stopped
8139
ports:
9-
- "10051:$firstPort"
140+
- "8743:8025"
141+
networks:
142+
- zabbix-i05-net
143+
deploy:
144+
resources:
145+
limits:
146+
memory: 128M
147+
cpus: "0.1"
148+
149+
# ── Zabbix Server ──────────────────────────────────────────────────────────
150+
zabbix-i05-server:
151+
image: zabbix/zabbix-server-mysql:ubuntu-7.0-latest
152+
container_name: zabbix-i05-server
153+
restart: unless-stopped
154+
depends_on:
155+
zabbix-i05-db:
156+
condition: service_healthy
10157
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"
158+
DB_SERVER_HOST: zabbix-i05-db
159+
MYSQL_DATABASE: zabbix
160+
MYSQL_USER: zabbix
161+
MYSQL_PASSWORD: ZabbixLab05!
162+
MYSQL_ROOT_PASSWORD: RootLab05!
163+
volumes:
164+
- zabbix-i05-server-data:/var/lib/zabbix
21165
networks:
22-
- it-stack-net
166+
- zabbix-i05-net
167+
deploy:
168+
resources:
169+
limits:
170+
memory: 512M
171+
cpus: "0.5"
23172

173+
# ── Zabbix Web ─────────────────────────────────────────────────────────────
174+
zabbix-i05-web:
175+
image: zabbix/zabbix-web-nginx-mysql:ubuntu-7.0-latest
176+
container_name: zabbix-i05-web
177+
restart: unless-stopped
178+
depends_on:
179+
zabbix-i05-db:
180+
condition: service_healthy
181+
zabbix-i05-server:
182+
condition: service_started
183+
zabbix-i05-ldap:
184+
condition: service_healthy
185+
zabbix-i05-mock:
186+
condition: service_healthy
187+
ports:
188+
- "8443:8080"
189+
environment:
190+
ZBX_SERVER_HOST: zabbix-i05-server
191+
ZBX_SERVER_PORT: "10051"
192+
DB_SERVER_HOST: zabbix-i05-db
193+
MYSQL_DATABASE: zabbix
194+
MYSQL_USER: zabbix
195+
MYSQL_PASSWORD: ZabbixLab05!
196+
MYSQL_ROOT_PASSWORD: RootLab05!
197+
PHP_TZ: UTC
198+
KEYCLOAK_URL: http://zabbix-i05-kc:8080
199+
KEYCLOAK_REALM: it-stack
200+
KEYCLOAK_CLIENT_ID: zabbix
201+
ZBX_SAML_IDP_ENTITY_ID: http://zabbix-i05-kc:8080/realms/it-stack
202+
ZBX_SAML_SSO_SERVICE: http://zabbix-i05-kc:8080/realms/it-stack/protocol/saml
203+
ZBX_SAML_SLO_SERVICE: http://zabbix-i05-kc:8080/realms/it-stack/protocol/saml
204+
ZBX_SAML_USERNAME_ATTRIBUTE: username
205+
ZBX_SAML_SP_ENTITY_ID: zabbix
206+
# Mattermost integration (via WireMock)
207+
MATTERMOST_WEBHOOK_URL: http://zabbix-i05-mock:8080/hooks/lab05
208+
MATTERMOST_CHANNEL: ops-alerts
209+
MATTERMOST_USERNAME: zabbix-bot
210+
networks:
211+
- zabbix-i05-net
212+
deploy:
213+
resources:
214+
limits:
215+
memory: 512M
216+
cpus: "0.5"
217+
218+
# ── Networks ───────────────────────────────────────────────────────────────────
24219
networks:
25-
it-stack-net:
220+
zabbix-i05-net:
221+
name: zabbix-i05-net
26222
driver: bridge
223+
224+
# ── Volumes ────────────────────────────────────────────────────────────────────
225+
volumes:
226+
zabbix-i05-db-data:
227+
zabbix-i05-ldap-data:
228+
zabbix-i05-ldap-config:
229+
zabbix-i05-server-data:

0 commit comments

Comments
 (0)