-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
216 lines (204 loc) · 5.22 KB
/
docker-compose.prod.yml
File metadata and controls
216 lines (204 loc) · 5.22 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
version: '3.8'
services:
# Main application service (production)
app:
build:
context: .
target: production
container_name: everything-opencode-prod
ports:
- '80:3000'
environment:
NODE_ENV: production
PORT: 3000
LOG_LEVEL: info
MAX_MEMORY: 512
restart: unless-stopped
healthcheck:
test: ['CMD', 'node', 'scripts/verify-installation.js']
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
logging:
driver: 'json-file'
options:
max-size: '10m'
max-file: '3'
# PineScript Optimizer service (production)
optimizer:
build:
context: .
target: pinescript-optimizer
container_name: pinescript-optimizer-prod
ports:
- '3001:3001'
environment:
NODE_ENV: production
OPTIMIZER_PORT: 3001
LOG_LEVEL: info
restart: unless-stopped
command: node scripts/pinescript/optimizer.js --server --port 3001 --production
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
# Debug Server service (production)
debug-server:
build:
context: .
target: debug-server
container_name: debug-server-prod
ports:
- '3002:3000'
environment:
NODE_ENV: production
DEBUG_SERVER_PORT: 3000
LOG_LEVEL: info
SECURITY_ENABLED: 'true'
restart: unless-stopped
command: node scripts/pinescript/debug-server.js --port 3000 --security --production
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
# Load balancer / reverse proxy
nginx:
image: nginx:alpine
container_name: everything-opencode-nginx
ports:
- '443:443'
- '80:80'
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- app
- optimizer
- debug-server
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.25'
memory: 128M
# Monitoring stack
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- '9090:9090'
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- '3000:3000'
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
GF_INSTALL_PLUGINS: 'grafana-piechart-panel'
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/dashboards:/etc/grafana/provisioning/dashboards
- ./monitoring/datasources:/etc/grafana/provisioning/datasources
restart: unless-stopped
depends_on:
- prometheus
# Log aggregation
loki:
image: grafana/loki:latest
container_name: loki
ports:
- '3100:3100'
command: -config.file=/etc/loki/local-config.yaml
volumes:
- loki_data:/loki
restart: unless-stopped
promtail:
image: grafana/promtail:latest
container_name: promtail
volumes:
- /var/log:/var/log
- ./monitoring/promtail-config.yml:/etc/promtail/config.yml:ro
command: -config.file=/etc/promtail/config.yml
restart: unless-stopped
depends_on:
- loki
# Database (if needed for production)
# postgres:
# image: postgres:15-alpine
# container_name: everything-opencode-db-prod
# environment:
# POSTGRES_USER: ${DB_USER:-opencode}
# POSTGRES_PASSWORD: ${DB_PASSWORD:-opencode123}
# POSTGRES_DB: ${DB_NAME:-everything_opencode}
# volumes:
# - postgres_data:/var/lib/postgresql/data
# restart: unless-stopped
# deploy:
# resources:
# limits:
# cpus: '0.5'
# memory: 512M
# reservations:
# cpus: '0.25'
# memory: 256M
# Redis cache (if needed for production)
# redis:
# image: redis:7-alpine
# container_name: everything-opencode-cache-prod
# command: redis-server --appendonly yes
# volumes:
# - redis_data:/data
# restart: unless-stopped
# deploy:
# resources:
# limits:
# cpus: '0.25'
# memory: 128M
# Backup service
backup:
image: alpine:latest
container_name: backup-service
volumes:
- backup_data:/backup
- ./backup/backup.sh:/backup.sh:ro
environment:
BACKUP_SCHEDULE: '0 2 * * *'
RETENTION_DAYS: '7'
command: sh -c "chmod +x /backup.sh && crond -f"
restart: unless-stopped
# Volumes for persistent data
volumes:
postgres_data:
redis_data:
prometheus_data:
grafana_data:
loki_data:
backup_data: