-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
85 lines (72 loc) · 1.91 KB
/
docker-compose.yml
File metadata and controls
85 lines (72 loc) · 1.91 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
version: '3.8'
services:
# Production Chat Server
chat-server:
build: .
image: terminal-chat:latest
container_name: terminal-chat-server
hostname: chat-server
# Network configuration
ports:
- "${CHAT_PORT:-4444}:4444"
networks:
- chat-network
# Environment variables
environment:
- CHAT_PORT=4444
- CHAT_PASSWORD=${CHAT_PASSWORD:?CHAT_PASSWORD is required}
- CHAT_USERNAME=${SERVER_USERNAME:-ChatServer}
- PYTHONUNBUFFERED=1
# Persistent storage
volumes:
- chat-shared:/app/data/shared
- chat-logs:/app/logs
- ./data/outbox:/app/data/outbox:ro # Read-only for security
# Resource limits
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.25'
memory: 128M
# Restart policy
restart: unless-stopped
# Health check - verify process is running without connecting as a client
healthcheck:
test: ["CMD", "sh", "-c", "ps aux | grep -q '[p]ython3.*main.py.*listen' || exit 1"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
# Logging
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
labels: "service,environment"
# Labels for monitoring
labels:
- "com.terminal-chat.service=server"
- "com.terminal-chat.environment=production"
- "com.terminal-chat.version=1.1"
# Command (use shell form for env var expansion)
command: listen 4444 $CHAT_PASSWORD ${SERVER_USERNAME:-ChatServer}
# Networks
networks:
chat-network:
driver: bridge
name: terminal-chat-network
ipam:
config:
- subnet: 172.28.0.0/16
# Volumes
volumes:
chat-shared:
driver: local
name: terminal-chat-shared
chat-logs:
driver: local
name: terminal-chat-logs