Skip to content

Commit 29c7e8a

Browse files
committed
feat(lab-06): Odoo Production Deployment (PostgreSQL + Redis + LDAP + Keycloak, workers=2, pg_dump backup)
1 parent 971d9ed commit 29c7e8a

3 files changed

Lines changed: 382 additions & 39 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,33 @@ jobs:
220220
- name: Cleanup
221221
if: always()
222222
run: docker compose -f docker/docker-compose.integration.yml down -v
223+
224+
lab-06-smoke:
225+
name: Lab 06 -- Odoo Production Deployment (PostgreSQL + Redis + LDAP + Keycloak + workers=2)
226+
runs-on: ubuntu-latest
227+
needs: validate
228+
continue-on-error: true
229+
steps:
230+
- uses: actions/checkout@v4
231+
- name: Install tools
232+
run: sudo apt-get install -y curl postgresql-client netcat-openbsd ldap-utils
233+
- name: Validate production compose
234+
run: docker compose -f docker/docker-compose.production.yml config -q && echo "Production compose valid"
235+
- name: Start production stack
236+
run: docker compose -f docker/docker-compose.production.yml up -d
237+
- name: Wait for PostgreSQL
238+
run: timeout 120 bash -c 'until docker exec odoo-p06-db pg_isready -U odoo; do sleep 5; done'
239+
- name: Wait for Keycloak
240+
run: timeout 300 bash -c 'until curl -sf http://localhost:8490/realms/master; do sleep 10; done'
241+
- name: Wait for Mailhog
242+
run: timeout 60 bash -c 'until curl -sf http://localhost:8690/api/v2/messages; do sleep 5; done'
243+
- name: Wait for Odoo web
244+
run: timeout 300 bash -c 'until curl -sf http://localhost:8390/web/login; do sleep 10; done'
245+
- name: Run Lab 13-06 test script
246+
run: bash tests/labs/test-lab-13-06.sh --no-cleanup
247+
- name: Collect logs on failure
248+
if: failure()
249+
run: docker compose -f docker/docker-compose.production.yml logs
250+
- name: Cleanup
251+
if: always()
252+
run: docker compose -f docker/docker-compose.production.yml down -v
Lines changed: 174 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,188 @@
1-
# Lab 06 — Production: odoo HA-ready with monitoring and external volumes
1+
# Lab 06 — Production Deployment: Odoo ERP
2+
# Full production-grade stack: PostgreSQL · Redis · OpenLDAP · Keycloak · Mailhog · Odoo (workers mode)
3+
# Ports: Web:8390 Gevent:8391 KC:8490 LDAP:3900 MH:8690
4+
# Naming: odoo-p06-{service} (p06 = production lab 06)
25
---
6+
name: it-stack-odoo-lab06
7+
38
services:
4-
odoo:
5-
image: odoo:17
6-
container_name: it-stack-odoo
7-
restart: always
8-
ports:
9-
- "8069:$firstPort"
9+
10+
odoo-p06-db:
11+
image: postgres:15-alpine
12+
container_name: odoo-p06-db
13+
restart: unless-stopped
1014
environment:
11-
- IT_STACK_ENV=production
12-
- KEYCLOAK_URL=
13-
- DB_HOST=
14-
- REDIS_HOST=
15-
- GRAYLOG_HOST=
15+
POSTGRES_USER: odoo
16+
POSTGRES_PASSWORD: OdooProd06!
17+
POSTGRES_DB: odoo
1618
volumes:
17-
- odoo_data:/var/lib/odoo
18-
- /etc/ssl/certs:/etc/ssl/certs:ro
19+
- db-data:/var/lib/postgresql/data
20+
healthcheck:
21+
test: ["CMD-SHELL", "pg_isready -U odoo"]
22+
interval: 10s
23+
timeout: 5s
24+
retries: 5
25+
start_period: 20s
1926
deploy:
20-
replicas: 1
2127
resources:
22-
limits:
23-
cpus: "4.0"
24-
memory: G
25-
reservations:
26-
cpus: "1.0"
27-
memory: 1G
28-
restart_policy:
29-
condition: any
30-
delay: 5s
31-
logging:
32-
driver: gelf
33-
options:
34-
gelf-address: "udp://${GRAYLOG_HOST}:12201"
35-
tag: "it-stack-odoo"
28+
limits: {cpus: "1.0", memory: 512M}
29+
reservations: {cpus: "0.25", memory: 128M}
30+
networks: [lab06]
31+
32+
odoo-p06-redis:
33+
image: redis:7-alpine
34+
container_name: odoo-p06-redis
35+
restart: unless-stopped
36+
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
37+
volumes:
38+
- redis-data:/data
39+
healthcheck:
40+
test: ["CMD", "redis-cli", "ping"]
41+
interval: 10s
42+
timeout: 3s
43+
retries: 3
44+
deploy:
45+
resources:
46+
limits: {cpus: "0.5", memory: 320M}
47+
networks: [lab06]
48+
49+
odoo-p06-ldap:
50+
image: osixia/openldap:1.5.0
51+
container_name: odoo-p06-ldap
52+
restart: unless-stopped
53+
environment:
54+
LDAP_ORGANISATION: IT-Stack Lab
55+
LDAP_DOMAIN: lab.local
56+
LDAP_ADMIN_PASSWORD: LdapProd06!
57+
ports:
58+
- "3900:389"
59+
volumes:
60+
- ldap-data:/var/lib/ldap
61+
- ldap-config:/etc/ldap/slapd.d
62+
healthcheck:
63+
test: ["CMD-SHELL", "ldapsearch -x -H ldap://localhost -b dc=lab,dc=local -D cn=admin,dc=lab,dc=local -w LdapProd06! cn=admin && echo ok"]
64+
interval: 15s
65+
timeout: 5s
66+
retries: 5
67+
start_period: 20s
68+
deploy:
69+
resources:
70+
limits: {cpus: "0.5", memory: 256M}
71+
networks: [lab06]
72+
73+
odoo-p06-kc:
74+
image: quay.io/keycloak/keycloak:24.0.3
75+
container_name: odoo-p06-kc
76+
command: start-dev
77+
restart: unless-stopped
78+
environment:
79+
KC_HOSTNAME_STRICT: "false"
80+
KC_HTTP_ENABLED: "true"
81+
KEYCLOAK_ADMIN: admin
82+
KEYCLOAK_ADMIN_PASSWORD: Admin06!
83+
ports:
84+
- "8490:8080"
3685
healthcheck:
37-
test: ["CMD-SHELL", "curl -sf http://localhost/health || exit 1"]
86+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/realms/master || exit 1"]
87+
interval: 15s
88+
timeout: 5s
89+
retries: 10
90+
start_period: 60s
91+
deploy:
92+
resources:
93+
limits: {cpus: "1.0", memory: 768M}
94+
reservations: {cpus: "0.25", memory: 256M}
95+
networks: [lab06]
96+
97+
odoo-p06-mail:
98+
image: mailhog/mailhog:latest
99+
container_name: odoo-p06-mail
100+
restart: unless-stopped
101+
ports:
102+
- "8690:8025"
103+
healthcheck:
104+
test: ["CMD-SHELL", "wget -qO- http://localhost:8025/api/v2/messages || exit 1"]
105+
interval: 10s
106+
timeout: 5s
107+
retries: 3
108+
deploy:
109+
resources:
110+
limits: {cpus: "0.25", memory: 128M}
111+
networks: [lab06]
112+
113+
odoo-p06-app:
114+
image: odoo:17
115+
container_name: odoo-p06-app
116+
restart: unless-stopped
117+
depends_on:
118+
odoo-p06-db:
119+
condition: service_healthy
120+
odoo-p06-redis:
121+
condition: service_healthy
122+
odoo-p06-ldap:
123+
condition: service_healthy
124+
odoo-p06-kc:
125+
condition: service_healthy
126+
odoo-p06-mail:
127+
condition: service_started
128+
ports:
129+
- "8390:8069"
130+
- "8391:8072"
131+
command: >-
132+
--workers=2
133+
--max-cron-threads=1
134+
--longpolling-port=8072
135+
--smtp-server=odoo-p06-mail
136+
--smtp-port=1025
137+
--limit-memory-hard=2684354560
138+
--limit-memory-soft=2147483648
139+
environment:
140+
IT_STACK_ENV: production
141+
IT_STACK_MODULE: odoo
142+
IT_STACK_LAB: "06"
143+
HOST: odoo-p06-db
144+
PORT: "5432"
145+
USER: odoo
146+
PASSWORD: OdooProd06!
147+
LDAP_HOST: odoo-p06-ldap
148+
LDAP_PORT: "389"
149+
LDAP_BASE: dc=lab,dc=local
150+
LDAP_ADMIN_DN: cn=admin,dc=lab,dc=local
151+
LDAP_ADMIN_PASSWORD: LdapProd06!
152+
KEYCLOAK_URL: http://odoo-p06-kc:8080
153+
KEYCLOAK_REALM: it-stack
154+
KEYCLOAK_CLIENT_ID: odoo
155+
KEYCLOAK_CLIENT_SECRET: odoo-prod-secret-06
156+
SNIPEIT_URL: ""
157+
SNIPEIT_API_TOKEN: ""
158+
volumes:
159+
- data:/var/lib/odoo
160+
- addons:/mnt/extra-addons
161+
healthcheck:
162+
test: ["CMD-SHELL", "curl -sf http://localhost:8069/web/login || exit 1"]
38163
interval: 30s
39164
timeout: 10s
40-
retries: 3
165+
retries: 5
41166
start_period: 120s
42-
networks:
43-
- it-stack-net
167+
deploy:
168+
resources:
169+
limits:
170+
cpus: "2.0"
171+
memory: 3G
172+
reservations:
173+
cpus: "0.5"
174+
memory: 512M
175+
networks: [lab06]
44176

45177
networks:
46-
it-stack-net:
47-
external: true
48-
name: it-stack-production
178+
lab06:
179+
driver: bridge
180+
name: it-stack-odoo-lab06
49181

50182
volumes:
51-
odoo_data:
52-
external: true
53-
name: it-stack-odoo-data
183+
db-data:
184+
redis-data:
185+
ldap-data:
186+
ldap-config:
187+
data:
188+
addons:

0 commit comments

Comments
 (0)