forked from sounak9725/IRF_Event_Logging
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.scale.yml
More file actions
169 lines (160 loc) · 3.86 KB
/
docker-compose.scale.yml
File metadata and controls
169 lines (160 loc) · 3.86 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
164
165
166
167
168
169
# Docker Compose configuration for scaled deployment
# Use this for running multiple bot instances with load balancing
version: '3.8'
services:
# NGINX Load Balancer
nginx:
image: nginx:alpine
container_name: irf-nginx-lb
restart: unless-stopped
ports:
- "3000:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- discord-bot-1
- discord-bot-2
networks:
- bot-network
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
interval: 10s
timeout: 5s
retries: 3
# Discord Bot Instance 1
discord-bot-1:
build:
context: .
dockerfile: Dockerfile
image: irf-event-logging-bot:latest
container_name: irf-discord-bot-1
restart: unless-stopped
env_file:
- .env
environment:
- NODE_ENV=production
- TZ=UTC
- INSTANCE_ID=1
- HEALTH_CHECK_PORT=3001
volumes:
- ./logs:/app/logs
- ./graphs:/app/graphs
- ./key_file.json:/app/key_file.json:ro
ports:
- "3001:3001"
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- bot-network
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3001/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Discord Bot Instance 2
discord-bot-2:
build:
context: .
dockerfile: Dockerfile
image: irf-event-logging-bot:latest
container_name: irf-discord-bot-2
restart: unless-stopped
env_file:
- .env
environment:
- NODE_ENV=production
- TZ=UTC
- INSTANCE_ID=2
- HEALTH_CHECK_PORT=3002
volumes:
- ./logs:/app/logs
- ./graphs:/app/graphs
- ./key_file.json:/app/key_file.json:ro
ports:
- "3002:3002"
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- bot-network
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3002/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Redis for shared state (optional)
redis:
image: redis:7-alpine
container_name: irf-redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis-data:/data
networks:
- bot-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
# Prometheus for metrics (optional)
prometheus:
image: prom/prometheus:latest
container_name: irf-prometheus
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
ports:
- "9090:9090"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
networks:
- bot-network
# Grafana for visualization (optional)
grafana:
image: grafana/grafana:latest
container_name: irf-grafana
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana-data:/var/lib/grafana
ports:
- "3030:3000"
depends_on:
- prometheus
networks:
- bot-network
networks:
bot-network:
driver: bridge
volumes:
redis-data:
prometheus-data:
grafana-data: