-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
140 lines (119 loc) · 3.29 KB
/
Copy pathdocker-compose.yml
File metadata and controls
140 lines (119 loc) · 3.29 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
# =========================================
# PII Anonymization Gateway - Docker Compose
# =========================================
# Production-ready setup with Redis
version: '3.8'
services:
# =========================================
# PII Gateway API
# =========================================
api:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: pii-gateway-api
restart: unless-stopped
ports:
- "8000:8000"
environment:
# App Settings
- APP_NAME=PII Anonymization Gateway
- APP_VERSION=1.0.0
- DEBUG=false
# OpenAI Settings (use .env file for secrets)
- OPENAI_API_KEY=${OPENAI_API_KEY}
- OPENAI_MODEL=${OPENAI_MODEL:-gpt-3.5-turbo}
- OPENAI_MAX_TOKENS=${OPENAI_MAX_TOKENS:-1000}
- OPENAI_TEMPERATURE=${OPENAI_TEMPERATURE:-0.7}
# Redis Settings
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- REDIS_DB=0
- REDIS_TTL_SECONDS=${REDIS_TTL_SECONDS:-3600}
# Presidio Settings
- PRESIDIO_LANGUAGE=en
- PRESIDIO_SCORE_THRESHOLD=0.5
depends_on:
redis:
condition: service_healthy
networks:
- pii-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Resource limits (adjust based on your needs)
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
# =========================================
# Redis - State Management
# =========================================
redis:
image: redis:7-alpine
container_name: pii-gateway-redis
restart: unless-stopped
ports:
- "6379:6379"
# Optional: Enable password authentication
command: >
redis-server
--appendonly yes
--maxmemory 256mb
--maxmemory-policy allkeys-lru
${REDIS_PASSWORD:+--requirepass ${REDIS_PASSWORD}}
volumes:
- redis-data:/data
networks:
- pii-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
# =========================================
# Redis Commander - Admin UI (Optional)
# =========================================
redis-commander:
image: rediscommander/redis-commander:latest
container_name: pii-gateway-redis-ui
restart: unless-stopped
ports:
- "8081:8081"
environment:
- REDIS_HOSTS=local:redis:6379
- HTTP_USER=${REDIS_UI_USER:-admin}
- HTTP_PASSWORD=${REDIS_UI_PASSWORD:-admin}
depends_on:
- redis
networks:
- pii-network
profiles:
- debug # Only starts with: docker-compose --profile debug up
# =========================================
# Networks
# =========================================
networks:
pii-network:
driver: bridge
name: pii-gateway-network
# =========================================
# Volumes
# =========================================
volumes:
redis-data:
name: pii-gateway-redis-data