Repository navigation
Expand file tree
/
Copy pathdocker-compose.staging.yml
More file actions
163 lines (156 loc) · 5.42 KB
/
Copy pathdocker-compose.staging.yml
File metadata and controls
163 lines (156 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# ==============================================================================
# Docker Compose for Ephemeral Staging Deployment & DAST Security Testing
# ==============================================================================
# Consumes trusted, signed container images published to GitHub Container Registry (GHCR)
# ==============================================================================
services:
# 1. Identity Service (Django)
identity-service:
image: ${IDENTITY_IMAGE:-${IMAGE_PREFIX:-ghcr.io/o2sa}/devsecops-identity-service:${IMAGE_TAG:-latest}}
container_name: staging-identity-service
restart: unless-stopped
ports:
- '8001:8001'
environment:
- PYTHONUNBUFFERED=1
- PORT=8001
- DJANGO_DEBUG=False
- DJANGO_SECRET_KEY=${STAGING_DJANGO_SECRET_KEY:-staging-secret-key-for-ephemeral-dast-environment-only-256-bits}
- DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1,identity-service,web,dashboard
- CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:4200,http://127.0.0.1:4200
- DB_NAME=/app/data/db.sqlite3
- DJANGO_SUPERUSER_USERNAME=admin
- DJANGO_SUPERUSER_EMAIL=admin@devsecops.local
- DJANGO_SUPERUSER_PASSWORD=AdminPassword123!
volumes:
- staging-identity-data:/app/data
security_opt:
- no-new-privileges:true
healthcheck:
test:
[
'CMD-SHELL',
'python -c "import urllib.request, sys; sys.exit(0 if urllib.request.urlopen(''http://127.0.0.1:8001/health'').getcode() == 200 else 1)" || exit 1',
]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- staging-network
# 2. Notification Service (Express + TypeScript)
notification-service:
image: ${NOTIFICATION_IMAGE:-${IMAGE_PREFIX:-ghcr.io/o2sa}/devsecops-notification-service:${IMAGE_TAG:-latest}}
container_name: staging-notification-service
restart: unless-stopped
ports:
- '8003:8003'
environment:
- NODE_ENV=production
- PORT=8003
- JWT_SECRET=${STAGING_DJANGO_SECRET_KEY:-staging-secret-key-for-ephemeral-dast-environment-only-256-bits}
- CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:4200,http://127.0.0.1:4200
security_opt:
- no-new-privileges:true
healthcheck:
test:
[
'CMD-SHELL',
'node -e "const req = require(''http'').get(''http://127.0.0.1:8003/health'', (r) => process.exit(r.statusCode === 200 ? 0 : 1)); req.on(''error'', () => process.exit(1));" || exit 1',
]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- staging-network
# 3. Orders Service (Spring Boot)
orders-service:
image: ${ORDERS_IMAGE:-${IMAGE_PREFIX:-ghcr.io/o2sa}/devsecops-orders-service:${IMAGE_TAG:-latest}}
container_name: staging-orders-service
restart: unless-stopped
ports:
- '8002:8002'
environment:
- SERVER_PORT=8002
- DJANGO_SECRET_KEY=${STAGING_DJANGO_SECRET_KEY:-staging-secret-key-for-ephemeral-dast-environment-only-256-bits}
- NOTIFICATION_SERVICE_URL=http://notification-service:8003
- CORS_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:4200,http://127.0.0.1:4200
- MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE=health,info
depends_on:
identity-service:
condition: service_healthy
notification-service:
condition: service_healthy
security_opt:
- no-new-privileges:true
healthcheck:
test:
['CMD-SHELL', 'wget --no-verbose --tries=1 --spider http://127.0.0.1:8002/health || exit 1']
interval: 15s
timeout: 5s
retries: 5
start_period: 25s
networks:
- staging-network
# 4. Public Client Application (Next.js Web Portal)
web:
image: ${WEB_IMAGE:-${IMAGE_PREFIX:-ghcr.io/o2sa}/devsecops-web:${IMAGE_TAG:-latest}}
container_name: staging-web
restart: unless-stopped
ports:
- '3000:3000'
environment:
- NODE_ENV=production
- PORT=3000
depends_on:
identity-service:
condition: service_healthy
orders-service:
condition: service_healthy
security_opt:
- no-new-privileges:true
healthcheck:
test:
[
'CMD-SHELL',
'node -e "const req = require(''http'').get(''http://127.0.0.1:3000/api/health'', (r) => process.exit(r.statusCode === 200 ? 0 : 1)); req.on(''error'', () => process.exit(1));" || exit 1',
]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
networks:
- staging-network
# 5. Admin / Operations Dashboard (Angular)
dashboard:
image: ${DASHBOARD_IMAGE:-${IMAGE_PREFIX:-ghcr.io/o2sa}/devsecops-dashboard:${IMAGE_TAG:-latest}}
container_name: staging-dashboard
restart: unless-stopped
ports:
- '4200:8080'
depends_on:
identity-service:
condition: service_healthy
orders-service:
condition: service_healthy
security_opt:
- no-new-privileges:true
healthcheck:
test:
[
'CMD-SHELL',
'wget --no-verbose --tries=1 --spider http://127.0.0.1:8080/health.json || exit 1',
]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- staging-network
volumes:
staging-identity-data:
driver: local
networks:
staging-network:
driver: bridge