Skip to content

Commit 2598834

Browse files
committed
feat(lab-03): Zammad Advanced -- ES indices, resource limits, RAILS_MAX_THREADS
1 parent c3a7a0a commit 2598834

3 files changed

Lines changed: 326 additions & 74 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,31 @@ jobs:
149149
- name: Cleanup
150150
if: always()
151151
run: docker compose -f docker/docker-compose.lan.yml down -v
152+
153+
lab-03-smoke:
154+
name: Lab 03 - Zammad Advanced (ES indices, resource limits, RAILS_MAX_THREADS)
155+
runs-on: ubuntu-latest
156+
needs: validate
157+
continue-on-error: true
158+
steps:
159+
- uses: actions/checkout@v4
160+
- name: Install tools
161+
run: sudo apt-get install -y curl
162+
- name: Validate advanced compose
163+
run: docker compose -f docker/docker-compose.advanced.yml config -q && echo "Advanced compose valid"
164+
- name: Start advanced stack
165+
run: docker compose -f docker/docker-compose.advanced.yml up -d
166+
- name: Wait for PostgreSQL
167+
run: timeout 60 bash -c 'until docker compose -f docker/docker-compose.advanced.yml exec -T postgresql pg_isready -U zammad -d zammad_production; do sleep 3; done'
168+
- name: Wait for Elasticsearch
169+
run: timeout 120 bash -c 'until curl -sf http://localhost:9200/_cluster/health | grep -qE "\"status\":\"(green|yellow)\""; do sleep 5; done'
170+
- name: Wait for Zammad web
171+
run: timeout 360 bash -c 'until curl -sf http://localhost:3000/ | grep -qi zammad; do sleep 10; done'
172+
- name: Run Lab 11-03 test script
173+
run: bash tests/labs/test-lab-11-03.sh
174+
- name: Collect logs on failure
175+
if: failure()
176+
run: docker compose -f docker/docker-compose.advanced.yml logs
177+
- name: Cleanup
178+
if: always()
179+
run: docker compose -f docker/docker-compose.advanced.yml down -v

docker/docker-compose.advanced.yml

Lines changed: 191 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,204 @@
1-
# Lab 03 — Advanced Features: zammad with TLS, resource limits, logging
2-
---
1+
# docker-compose.advanced.yml — Lab 11-03: Advanced Features
2+
# Zammad with PostgreSQL, Elasticsearch, Redis, mailhog, RAILS_MAX_THREADS, resource limits
3+
name: zammad-advanced
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: Lab03Password!
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-adv-postgresql
24+
environment:
25+
POSTGRES_DB: zammad_production
26+
POSTGRES_USER: zammad
27+
POSTGRES_PASSWORD: Lab03Password!
28+
volumes:
29+
- zammad_adv_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
44+
45+
elasticsearch:
46+
image: bitnami/elasticsearch:8
47+
container_name: zammad-adv-elasticsearch
48+
environment:
49+
ELASTICSEARCH_HEAP_SIZE: 512m
50+
discovery.type: single-node
51+
xpack.security.enabled: "false"
52+
volumes:
53+
- zammad_adv_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-adv-redis
72+
command: redis-server --save "" --maxmemory 256mb --maxmemory-policy allkeys-lru
73+
networks:
74+
- zammad-data-net
75+
deploy:
76+
resources:
77+
limits:
78+
cpus: "0.25"
79+
memory: 320M
80+
restart: unless-stopped
81+
82+
smtp:
83+
image: mailhog/mailhog:v1.0.1
84+
container_name: zammad-adv-smtp
885
ports:
9-
- "3000:$firstPort"
86+
- "8025:8025"
87+
networks:
88+
- zammad-mail-net
89+
restart: unless-stopped
90+
91+
init:
92+
image: ghcr.io/zammad/zammad:6.3.0
93+
container_name: zammad-adv-init
94+
command: ["zammad-init"]
95+
environment:
96+
<<: *zammad-env
97+
volumes:
98+
- zammad_adv_data:/opt/zammad/storage
99+
networks:
100+
- zammad-data-net
101+
depends_on:
102+
postgresql:
103+
condition: service_healthy
104+
elasticsearch:
105+
condition: service_healthy
106+
restart: on-failure
107+
108+
railsserver:
109+
image: ghcr.io/zammad/zammad:6.3.0
110+
container_name: zammad-adv-railsserver
111+
command: ["zammad-railsserver"]
10112
environment:
11-
- IT_STACK_ENV=lab-03-advanced
12-
- TLS_ENABLED=true
113+
<<: *zammad-env
13114
volumes:
14-
- zammad_data:/var/lib/zammad
15-
- ./certs:/etc/ssl/certs:ro
115+
- zammad_adv_data:/opt/zammad/storage
116+
networks:
117+
- zammad-app-net
118+
- zammad-data-net
119+
- zammad-mail-net
120+
depends_on:
121+
- init
16122
deploy:
17123
resources:
18124
limits:
19125
cpus: "2.0"
20-
memory: G
21-
logging:
22-
driver: json-file
23-
options:
24-
max-size: "100m"
25-
max-file: "5"
126+
memory: 2G
127+
restart: unless-stopped
128+
129+
scheduler:
130+
image: ghcr.io/zammad/zammad:6.3.0
131+
container_name: zammad-adv-scheduler
132+
command: ["zammad-scheduler"]
133+
environment:
134+
<<: *zammad-env
135+
volumes:
136+
- zammad_adv_data:/opt/zammad/storage
26137
networks:
27-
- it-stack-net
138+
- zammad-data-net
139+
depends_on:
140+
- init
141+
deploy:
142+
resources:
143+
limits:
144+
cpus: "0.5"
145+
memory: 512M
146+
restart: unless-stopped
28147

29-
networks:
30-
it-stack-net:
31-
driver: bridge
148+
websocket:
149+
image: ghcr.io/zammad/zammad:6.3.0
150+
container_name: zammad-adv-websocket
151+
command: ["zammad-websocket"]
152+
environment:
153+
<<: *zammad-env
154+
volumes:
155+
- zammad_adv_data:/opt/zammad/storage
156+
networks:
157+
- zammad-app-net
158+
- zammad-data-net
159+
depends_on:
160+
- init
161+
deploy:
162+
resources:
163+
limits:
164+
cpus: "0.25"
165+
memory: 256M
166+
restart: unless-stopped
167+
168+
nginx:
169+
image: ghcr.io/zammad/zammad:6.3.0
170+
container_name: zammad-adv-nginx
171+
command: ["zammad-nginx"]
172+
ports:
173+
- "3000:8080"
174+
environment:
175+
<<: *zammad-env
176+
volumes:
177+
- zammad_adv_data:/opt/zammad/storage
178+
networks:
179+
- zammad-app-net
180+
depends_on:
181+
- railsserver
182+
- websocket
183+
healthcheck:
184+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/ | grep -qi zammad"]
185+
interval: 30s
186+
timeout: 10s
187+
retries: 10
188+
start_period: 120s
189+
deploy:
190+
resources:
191+
limits:
192+
cpus: "0.25"
193+
memory: 128M
194+
restart: unless-stopped
32195

33196
volumes:
34-
zammad_data:
197+
zammad_adv_postgresql:
198+
zammad_adv_elasticsearch:
199+
zammad_adv_data:
200+
201+
networks:
202+
zammad-app-net:
203+
zammad-data-net:
204+
zammad-mail-net:

0 commit comments

Comments
 (0)