Skip to content

Commit 3109f58

Browse files
committed
feat(lab-04): Zammad SSO Integration -- Keycloak OIDC, zammad client, OIDC channel API
1 parent 2598834 commit 3109f58

3 files changed

Lines changed: 376 additions & 75 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,33 @@ jobs:
176176
run: docker compose -f docker/docker-compose.advanced.yml logs
177177
- name: Cleanup
178178
if: always()
179-
run: docker compose -f docker/docker-compose.advanced.yml down -v
179+
run: docker compose -f docker/docker-compose.advanced.yml down -v
180+
lab-04-smoke:
181+
name: Lab 04 — Zammad SSO Integration (Keycloak OIDC)
182+
runs-on: ubuntu-latest
183+
needs: validate
184+
continue-on-error: true
185+
steps:
186+
- uses: actions/checkout@v4
187+
- name: Install tools
188+
run: sudo apt-get install -y curl
189+
- name: Validate SSO compose
190+
run: docker compose -f docker/docker-compose.sso.yml config -q && echo "SSO compose valid"
191+
- name: Start SSO stack
192+
run: docker compose -f docker/docker-compose.sso.yml up -d
193+
- name: Wait for Keycloak
194+
run: timeout 120 bash -c 'until curl -sf http://localhost:8088/health/ready | grep -q UP; do sleep 5; done'
195+
- name: Wait for PostgreSQL
196+
run: timeout 60 bash -c 'until docker compose -f docker/docker-compose.sso.yml exec -T postgresql pg_isready -U zammad -d zammad_production; do sleep 3; done'
197+
- name: Wait for Elasticsearch
198+
run: timeout 120 bash -c 'until curl -sf http://localhost:9200/_cluster/health | grep -qE "\"status\":\"(green|yellow)\""; do sleep 5; done'
199+
- name: Wait for Zammad web
200+
run: timeout 360 bash -c 'until curl -sf http://localhost:3000/ | grep -qi zammad; do sleep 10; done'
201+
- name: Run Lab 11-04 test script
202+
run: bash tests/labs/test-lab-11-04.sh
203+
- name: Collect logs on failure
204+
if: failure()
205+
run: docker compose -f docker/docker-compose.sso.yml logs
206+
- name: Cleanup
207+
if: always()
208+
run: docker compose -f docker/docker-compose.sso.yml down -v

docker/docker-compose.sso.yml

Lines changed: 221 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,234 @@
1-
# Lab 04 — SSO Integration: zammad with Keycloak OIDC authentication
2-
---
1+
# docker-compose.sso.yml — Lab 11-04: SSO Integration
2+
# Zammad with Keycloak OIDC authentication
3+
name: zammad-sso
4+
5+
x-zammad-env: &zammad-env
6+
POSTGRESQL_HOST: postgresql
7+
POSTGRESQL_PORT: "5432"
8+
POSTGRESQL_DB: zammad_production
9+
POSTGRESQL_USER: zammad
10+
POSTGRESQL_PASS: Lab04Password!
11+
ELASTICSEARCH_HOST: elasticsearch
12+
ELASTICSEARCH_PORT: "9200"
13+
ELASTICSEARCH_ENABLED: "true"
14+
REDIS_URL: "redis://redis:6379"
15+
RAILS_MAX_THREADS: "5"
16+
WEB_CONCURRENCY: "2"
17+
ZAMMAD_RAILSSERVER_HOST: railsserver
18+
ZAMMAD_WEBSOCKET_HOST: websocket
19+
320
services:
4-
zammad:
5-
image: zammad/zammad-docker-compose:latest
6-
container_name: it-stack-zammad
21+
postgresql:
22+
image: postgres:15-alpine
23+
container_name: zammad-sso-postgresql
24+
environment:
25+
POSTGRES_DB: zammad_production
26+
POSTGRES_USER: zammad
27+
POSTGRES_PASSWORD: Lab04Password!
28+
volumes:
29+
- zammad_sso_postgresql:/var/lib/postgresql/data
30+
networks:
31+
- zammad-data-net
32+
healthcheck:
33+
test: ["CMD-SHELL", "pg_isready -U zammad -d zammad_production"]
34+
interval: 10s
35+
timeout: 5s
36+
retries: 5
37+
start_period: 20s
38+
deploy:
39+
resources:
40+
limits:
41+
cpus: "0.5"
42+
memory: 512M
743
restart: unless-stopped
8-
ports:
9-
- "3000:$firstPort"
44+
45+
elasticsearch:
46+
image: bitnami/elasticsearch:8
47+
container_name: zammad-sso-elasticsearch
1048
environment:
11-
- IT_STACK_ENV=lab-04-sso
12-
- KEYCLOAK_URL=
13-
- KEYCLOAK_REALM=
14-
- KEYCLOAK_CLIENT_ID=zammad
15-
- KEYCLOAK_CLIENT_SECRET=
49+
ELASTICSEARCH_HEAP_SIZE: 512m
50+
discovery.type: single-node
51+
xpack.security.enabled: "false"
52+
volumes:
53+
- zammad_sso_elasticsearch:/bitnami/elasticsearch/data
54+
networks:
55+
- zammad-data-net
56+
healthcheck:
57+
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health | grep -qE '\"status\":\"(green|yellow)\"'"]
58+
interval: 15s
59+
timeout: 10s
60+
retries: 8
61+
start_period: 60s
62+
deploy:
63+
resources:
64+
limits:
65+
cpus: "1.0"
66+
memory: 1G
67+
restart: unless-stopped
68+
69+
redis:
70+
image: redis:7-alpine
71+
container_name: zammad-sso-redis
72+
command: redis-server --save "" --maxmemory 256mb --maxmemory-policy allkeys-lru
1673
networks:
17-
- it-stack-net
74+
- zammad-data-net
75+
deploy:
76+
resources:
77+
limits:
78+
cpus: "0.25"
79+
memory: 320M
80+
restart: unless-stopped
1881

19-
# Local Keycloak for SSO lab (replace with lab-id1 in real env)
2082
keycloak:
21-
image: quay.io/keycloak/keycloak:24
22-
container_name: it-stack-zammad-keycloak
83+
image: quay.io/keycloak/keycloak:24.0
84+
container_name: zammad-sso-keycloak
2385
command: start-dev
2486
environment:
2587
KEYCLOAK_ADMIN: admin
26-
KEYCLOAK_ADMIN_PASSWORD: admin
88+
KEYCLOAK_ADMIN_PASSWORD: Lab04Admin!
89+
KC_HTTP_PORT: "8080"
90+
KC_HOSTNAME_STRICT: "false"
91+
KC_HOSTNAME_STRICT_HTTPS: "false"
92+
KC_HTTP_ENABLED: "true"
93+
KC_HEALTH_ENABLED: "true"
94+
KC_PROXY: edge
95+
ports:
96+
- "8088:8080"
97+
networks:
98+
- zammad-app-net
99+
healthcheck:
100+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/health/ready | grep -q UP"]
101+
interval: 20s
102+
timeout: 10s
103+
retries: 10
104+
start_period: 60s
105+
deploy:
106+
resources:
107+
limits:
108+
cpus: "1.0"
109+
memory: 768M
110+
restart: unless-stopped
111+
112+
smtp:
113+
image: mailhog/mailhog:v1.0.1
114+
container_name: zammad-sso-smtp
115+
ports:
116+
- "8025:8025"
117+
networks:
118+
- zammad-mail-net
119+
restart: unless-stopped
120+
121+
init:
122+
image: ghcr.io/zammad/zammad:6.3.0
123+
container_name: zammad-sso-init
124+
command: ["zammad-init"]
125+
environment:
126+
<<: *zammad-env
127+
volumes:
128+
- zammad_sso_data:/opt/zammad/storage
129+
networks:
130+
- zammad-data-net
131+
depends_on:
132+
postgresql:
133+
condition: service_healthy
134+
elasticsearch:
135+
condition: service_healthy
136+
restart: on-failure
137+
138+
railsserver:
139+
image: ghcr.io/zammad/zammad:6.3.0
140+
container_name: zammad-sso-railsserver
141+
command: ["zammad-railsserver"]
142+
environment:
143+
<<: *zammad-env
144+
volumes:
145+
- zammad_sso_data:/opt/zammad/storage
146+
networks:
147+
- zammad-app-net
148+
- zammad-data-net
149+
- zammad-mail-net
150+
depends_on:
151+
- init
152+
deploy:
153+
resources:
154+
limits:
155+
cpus: "2.0"
156+
memory: 2G
157+
restart: unless-stopped
158+
159+
scheduler:
160+
image: ghcr.io/zammad/zammad:6.3.0
161+
container_name: zammad-sso-scheduler
162+
command: ["zammad-scheduler"]
163+
environment:
164+
<<: *zammad-env
165+
volumes:
166+
- zammad_sso_data:/opt/zammad/storage
167+
networks:
168+
- zammad-data-net
169+
depends_on:
170+
- init
171+
deploy:
172+
resources:
173+
limits:
174+
cpus: "0.5"
175+
memory: 512M
176+
restart: unless-stopped
177+
178+
websocket:
179+
image: ghcr.io/zammad/zammad:6.3.0
180+
container_name: zammad-sso-websocket
181+
command: ["zammad-websocket"]
182+
environment:
183+
<<: *zammad-env
184+
volumes:
185+
- zammad_sso_data:/opt/zammad/storage
186+
networks:
187+
- zammad-app-net
188+
- zammad-data-net
189+
depends_on:
190+
- init
191+
deploy:
192+
resources:
193+
limits:
194+
cpus: "0.25"
195+
memory: 256M
196+
restart: unless-stopped
197+
198+
nginx:
199+
image: ghcr.io/zammad/zammad:6.3.0
200+
container_name: zammad-sso-nginx
201+
command: ["zammad-nginx"]
27202
ports:
28-
- "8080:8080"
203+
- "3000:8080"
204+
environment:
205+
<<: *zammad-env
206+
volumes:
207+
- zammad_sso_data:/opt/zammad/storage
29208
networks:
30-
- it-stack-net
209+
- zammad-app-net
210+
depends_on:
211+
- railsserver
212+
- websocket
213+
healthcheck:
214+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/ | grep -qi zammad"]
215+
interval: 30s
216+
timeout: 10s
217+
retries: 10
218+
start_period: 120s
219+
deploy:
220+
resources:
221+
limits:
222+
cpus: "0.25"
223+
memory: 128M
224+
restart: unless-stopped
225+
226+
volumes:
227+
zammad_sso_postgresql:
228+
zammad_sso_elasticsearch:
229+
zammad_sso_data:
31230

32231
networks:
33-
it-stack-net:
34-
driver: bridge
232+
zammad-app-net:
233+
zammad-data-net:
234+
zammad-mail-net:

0 commit comments

Comments
 (0)