Skip to content

Commit 991685e

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 205619a commit 991685e

3 files changed

Lines changed: 398 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,44 @@ run: bash tests/labs/test-lab-16-01.sh
229229

230230
- name: Cleanup
231231
if: always()
232-
run: docker compose -f docker/docker-compose.sso.yml down -v
232+
run: docker compose -f docker/docker-compose.sso.yml down -v
233+
234+
lab-05-smoke:
235+
name: Lab 16-05 -- Snipe-IT Advanced Integration (Odoo REST API)
236+
runs-on: ubuntu-latest
237+
needs: validate
238+
continue-on-error: true
239+
steps:
240+
- uses: actions/checkout@v4
241+
242+
- name: Install tools
243+
run: sudo apt-get install -y curl default-mysql-client netcat-openbsd ldap-utils
244+
245+
- name: Validate integration compose
246+
run: docker compose -f docker/docker-compose.integration.yml config -q && echo "Integration compose valid"
247+
248+
- name: Start integration stack
249+
run: docker compose -f docker/docker-compose.integration.yml up -d
250+
251+
- name: Wait for WireMock
252+
run: timeout 90 bash -c 'until curl -sf http://localhost:8762/__admin/health; do sleep 5; done'
253+
254+
- name: Wait for MariaDB
255+
run: timeout 120 bash -c 'until docker exec snipeit-i05-db mysqladmin ping -uroot -pRootLab05! --silent 2>/dev/null; do sleep 5; done'
256+
257+
- name: Wait for Keycloak
258+
run: timeout 300 bash -c 'until curl -sf http://localhost:8541/realms/master; do sleep 10; done'
259+
260+
- name: Wait for Snipe-IT
261+
run: timeout 300 bash -c 'until curl -sf http://localhost:8441/ | grep -qi snipe; do sleep 15; done'
262+
263+
- name: Run Lab 16-05 test script
264+
run: bash tests/labs/test-lab-16-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: 202 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,211 @@
1-
# Lab 05 — Advanced Integration: snipeit with full IT-Stack ecosystem
2-
---
1+
# =============================================================================
2+
# IT-Stack: Snipe-IT — Lab 05: Advanced Integration
3+
# Module 16 · Phase 4 · Lab 05
4+
# =============================================================================
5+
# Services: MariaDB · OpenLDAP · Keycloak · WireMock (Odoo-mock) · Mailhog · Snipe-IT
6+
# Ports: App:8441 WireMock:8762 KC:8541 LDAP:3886 MH:8741
7+
# Credentials:
8+
# DB root: RootLab05! app: snipeit / SnipeLab05!
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 Odoo REST API (asset procurement flow)
13+
# + Snipe-IT configured with ODOO_URL for asset sync
14+
# + Integration tested: Snipe-IT → Odoo asset procurement REST API
15+
# =============================================================================
16+
17+
name: it-stack-snipeit-lab05
18+
319
services:
4-
snipeit:
20+
21+
# ── MariaDB ────────────────────────────────────────────────────────────────
22+
snipeit-i05-db:
23+
image: mariadb:10.11
24+
container_name: snipeit-i05-db
25+
restart: unless-stopped
26+
environment:
27+
MYSQL_ROOT_PASSWORD: RootLab05!
28+
MYSQL_DATABASE: snipeit
29+
MYSQL_USER: snipeit
30+
MYSQL_PASSWORD: SnipeLab05!
31+
volumes:
32+
- snipeit-i05-db-data:/var/lib/mysql
33+
healthcheck:
34+
test: ["CMD", "mysqladmin", "ping", "-uroot", "-pRootLab05!", "--silent"]
35+
interval: 10s
36+
timeout: 5s
37+
retries: 15
38+
networks:
39+
- snipeit-i05-net
40+
deploy:
41+
resources:
42+
limits:
43+
memory: 512M
44+
cpus: "0.5"
45+
46+
# ── OpenLDAP ───────────────────────────────────────────────────────────────
47+
snipeit-i05-ldap:
48+
image: osixia/openldap:1.5.0
49+
container_name: snipeit-i05-ldap
50+
restart: unless-stopped
51+
environment:
52+
LDAP_ORGANISATION: "IT-Stack Lab"
53+
LDAP_DOMAIN: lab.local
54+
LDAP_ADMIN_PASSWORD: LdapLab05!
55+
LDAP_CONFIG_PASSWORD: ConfigLab05!
56+
LDAP_BASE_DN: dc=lab,dc=local
57+
LDAP_READONLY_USER: "true"
58+
LDAP_READONLY_USER_USERNAME: readonly
59+
LDAP_READONLY_USER_PASSWORD: ReadOnly05!
60+
ports:
61+
- "3886:389"
62+
volumes:
63+
- snipeit-i05-ldap-data:/var/lib/ldap
64+
- snipeit-i05-ldap-config:/etc/ldap/slapd.d
65+
healthcheck:
66+
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"]
67+
interval: 10s
68+
timeout: 5s
69+
retries: 15
70+
networks:
71+
- snipeit-i05-net
72+
deploy:
73+
resources:
74+
limits:
75+
memory: 256M
76+
cpus: "0.25"
77+
78+
# ── Keycloak ───────────────────────────────────────────────────────────────
79+
snipeit-i05-kc:
80+
image: quay.io/keycloak/keycloak:24.0.3
81+
container_name: snipeit-i05-kc
82+
restart: unless-stopped
83+
command: start-dev
84+
environment:
85+
KEYCLOAK_ADMIN: admin
86+
KEYCLOAK_ADMIN_PASSWORD: Admin05!
87+
KC_HEALTH_ENABLED: "true"
88+
KC_DB: dev-file
89+
KC_HOSTNAME_STRICT: "false"
90+
KC_HOSTNAME_STRICT_HTTPS: "false"
91+
KC_HTTP_ENABLED: "true"
92+
ports:
93+
- "8541:8080"
94+
healthcheck:
95+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/realms/master || exit 1"]
96+
interval: 15s
97+
timeout: 10s
98+
retries: 20
99+
start_period: 30s
100+
networks:
101+
- snipeit-i05-net
102+
deploy:
103+
resources:
104+
limits:
105+
memory: 1G
106+
cpus: "1.0"
107+
108+
# ── WireMock — Odoo REST API mock ──────────────────────────────────────────
109+
snipeit-i05-mock:
110+
image: wiremock/wiremock:3.3.1
111+
container_name: snipeit-i05-mock
112+
restart: unless-stopped
113+
command: >
114+
--port=8080
115+
--verbose
116+
--global-response-templating
117+
ports:
118+
- "8762:8080"
119+
healthcheck:
120+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/__admin/health || exit 1"]
121+
interval: 10s
122+
timeout: 5s
123+
retries: 10
124+
networks:
125+
- snipeit-i05-net
126+
deploy:
127+
resources:
128+
limits:
129+
memory: 256M
130+
cpus: "0.25"
131+
132+
# ── Mailhog ────────────────────────────────────────────────────────────────
133+
snipeit-i05-mail:
134+
image: mailhog/mailhog:latest
135+
container_name: snipeit-i05-mail
136+
restart: unless-stopped
137+
ports:
138+
- "8741:8025"
139+
networks:
140+
- snipeit-i05-net
141+
deploy:
142+
resources:
143+
limits:
144+
memory: 128M
145+
cpus: "0.1"
146+
147+
# ── Snipe-IT ───────────────────────────────────────────────────────────────
148+
snipeit-i05-app:
5149
image: snipe/snipe-it:latest
6-
container_name: it-stack-snipeit
150+
container_name: snipeit-i05-app
7151
restart: unless-stopped
152+
depends_on:
153+
snipeit-i05-db:
154+
condition: service_healthy
155+
snipeit-i05-ldap:
156+
condition: service_healthy
157+
snipeit-i05-mock:
158+
condition: service_healthy
8159
ports:
9-
- "80:$firstPort"
160+
- "8441:80"
10161
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"
162+
APP_KEY: base64:SnipeItLab05KeyABCDEFGHIJKLMNOP=
163+
APP_URL: http://localhost:8441
164+
DB_CONNECTION: mysql
165+
DB_HOST: snipeit-i05-db
166+
DB_PORT: "3306"
167+
DB_DATABASE: snipeit
168+
DB_USERNAME: snipeit
169+
DB_PASSWORD: SnipeLab05!
170+
MAIL_HOST: snipeit-i05-mail
171+
MAIL_PORT: "1025"
172+
LDAP_ENABLED: "true"
173+
LDAP_SERVER: snipeit-i05-ldap
174+
LDAP_PORT: "389"
175+
LDAP_UNAME_FORMAT: uid=<username>,dc=lab,dc=local
176+
LDAP_BASE_DN: dc=lab,dc=local
177+
LDAP_USERNAME: cn=admin,dc=lab,dc=local
178+
LDAP_PASSWORD: LdapLab05!
179+
KEYCLOAK_URL: http://snipeit-i05-kc:8080
180+
KEYCLOAK_REALM: it-stack
181+
KEYCLOAK_CLIENT_ID: snipeit
182+
# Odoo integration (via WireMock)
183+
ODOO_URL: http://snipeit-i05-mock:8080
184+
ODOO_DB: odoo
185+
ODOO_USER: admin
186+
ODOO_API_KEY: lab-odoo-key-05
187+
ODOO_ASSET_MODEL: stock.inventory
188+
volumes:
189+
- snipeit-i05-data:/var/lib/snipeit
190+
- snipeit-i05-logs:/var/www/html/storage/logs
21191
networks:
22-
- it-stack-net
192+
- snipeit-i05-net
193+
deploy:
194+
resources:
195+
limits:
196+
memory: 1G
197+
cpus: "1.0"
23198

199+
# ── Networks ───────────────────────────────────────────────────────────────────
24200
networks:
25-
it-stack-net:
201+
snipeit-i05-net:
202+
name: snipeit-i05-net
26203
driver: bridge
204+
205+
# ── Volumes ────────────────────────────────────────────────────────────────────
206+
volumes:
207+
snipeit-i05-db-data:
208+
snipeit-i05-ldap-data:
209+
snipeit-i05-ldap-config:
210+
snipeit-i05-data:
211+
snipeit-i05-logs:

0 commit comments

Comments
 (0)