-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
111 lines (102 loc) · 3.26 KB
/
Copy pathdocker-compose.yml
File metadata and controls
111 lines (102 loc) · 3.26 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
# ========================================================
# Zero-Trust API Gateway — Docker Compose
# ========================================================
# Services:
# gateway : Spring Boot gateway (port 8080)
# backend : Dummy backend services (port 8081)
# redis : Redis cache/rate-limiter (port 6379)
# postgres : PostgreSQL database (port 5432)
# frontend : React admin dashboard (port 3000)
# ========================================================
version: '3.9'
services:
# ─── PostgreSQL Database ─────────────────────────────────
postgres:
image: postgres:16-alpine
container_name: zt-postgres
environment:
POSTGRES_DB: gateway_db
POSTGRES_USER: gateway_user
POSTGRES_PASSWORD: gateway_pass
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-db.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gateway_user -d gateway_db"]
interval: 10s
timeout: 5s
retries: 5
networks:
- gateway-net
# ─── Redis Cache ─────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: zt-redis
ports:
- "6379:6379"
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- gateway-net
# ─── Dummy Backend Services ──────────────────────────────
backend:
build: ./dummy-backend
container_name: zt-backend
ports:
- "8081:8081"
networks:
- gateway-net
# ─── Zero-Trust API Gateway ──────────────────────────────
gateway:
build: ./gateway-service
container_name: zt-gateway
ports:
- "8080:8080"
environment:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: gateway_db
POSTGRES_USER: gateway_user
POSTGRES_PASSWORD: gateway_pass
REDIS_HOST: redis
REDIS_PORT: 6379
JWT_SECRET: z3r0TruStG4t3w4yS3cr3tK3yTh4tIsL0ngEn0ughF0rHS512Alg0r1thm!!2024
USER_SERVICE_URL: http://backend:8081
ORDER_SERVICE_URL: http://backend:8081
PAYMENT_SERVICE_URL: http://backend:8081
CORS_ORIGINS: http://localhost:3000
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
backend:
condition: service_started
networks:
- gateway-net
# ─── React Admin Dashboard ──────────────────────────────
frontend:
build: ./admin-dashboard
container_name: zt-frontend
ports:
- "3000:3000"
environment:
VITE_API_URL: http://localhost:8080
depends_on:
- gateway
networks:
- gateway-net
volumes:
postgres_data:
redis_data:
networks:
gateway-net:
driver: bridge