-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
117 lines (113 loc) · 3.27 KB
/
docker-compose.prod.yml
File metadata and controls
117 lines (113 loc) · 3.27 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
# Production Docker Compose
# Usage: docker compose -f docker-compose.prod.yml up -d
# Redis et App dans le même réseau Docker, communication via le nom du service
services:
redis:
image: redis:7-alpine
container_name: etf_redis
volumes:
- redis_data:/data
command:
- redis-server
- --appendonly
- "yes"
- --bind
- 0.0.0.0
- --requirepass
- ${REDIS_PASSWORD}
- --protected-mode
- "no"
- --timeout
- "0"
- --tcp-backlog
- "511"
- --rename-command
- FLUSHDB
- ""
- --rename-command
- FLUSHALL
- ""
- --rename-command
- CONFIG
- ""
networks:
- etf_network
restart: always
healthcheck:
test: ["CMD-SHELL", "redis-cli ${REDIS_PASSWORD:+-a $REDIS_PASSWORD} ping | grep -q PONG"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
deploy:
resources:
limits:
cpus: '1.0'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
app:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: etf_app
ports:
- "${PORT:-3000}:${PORT:-3000}"
environment:
- NODE_ENV=production
- PORT=${PORT:-3000}
- APP_ROLE=${APP_ROLE:-master}
- WORKER_COUNT=${WORKER_COUNT:-3}
- MONGODB_URI=${MONGODB_URI}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- REDIS_TTL=${REDIS_TTL:-3600}
- CACHE_ENABLED=${CACHE_ENABLED:-true}
- CACHE_TTL=${CACHE_TTL:-300}
- CACHE_NAMESPACE=${CACHE_NAMESPACE:-etf_api}
- CORS_ENABLED=${CORS_ENABLED:-true}
- CORS_ORIGINS=${CORS_ORIGINS:-*}
- RATE_LIMIT_ENABLED=${RATE_LIMIT_ENABLED:-true}
- RATE_LIMIT_WINDOW_MS=${RATE_LIMIT_WINDOW_MS:-60000}
- RATE_LIMIT_MAX_REQUESTS=${RATE_LIMIT_MAX_REQUESTS:-100}
- RATE_LIMIT_NAMESPACE=${RATE_LIMIT_NAMESPACE:-ratelimit}
- RPC_RATE_LIMIT_MAINNET=${RPC_RATE_LIMIT_MAINNET:-300/60}
- RPC_RATE_LIMIT_ARBITRUM=${RPC_RATE_LIMIT_ARBITRUM:-300/60}
- RPC_RETRY_MAX_RETRIES=${RPC_RETRY_MAX_RETRIES:-5}
- RPC_RETRY_BASE_DELAY=${RPC_RETRY_BASE_DELAY:-1000}
- RPC_RETRY_MAX_DELAY=${RPC_RETRY_MAX_DELAY:-300000}
- RPC_MAINNET_URLS=${RPC_MAINNET_URLS:-}
- RPC_ARBITRUM_URLS=${RPC_ARBITRUM_URLS:-}
- RPC_HEALTH_MAX_CONSECUTIVE_ERRORS=${RPC_HEALTH_MAX_CONSECUTIVE_ERRORS:-3}
- RPC_HEALTH_RATE_LIMIT_COOLDOWN_MS=${RPC_HEALTH_RATE_LIMIT_COOLDOWN_MS:-60000}
- RPC_HEALTH_ERROR_RECOVERY_DELAY_MS=${RPC_HEALTH_ERROR_RECOVERY_DELAY_MS:-60000}
- PRIVATE_KEY=${PRIVATE_KEY:-}
- DEBUG_TVL=${DEBUG_TVL:-false}
networks:
- etf_network
depends_on:
redis:
condition: service_healthy
restart: always
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:${PORT:-3000}/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
interval: 30s
timeout: 5s
start_period: 30s
retries: 5
deploy:
resources:
limits:
cpus: '4.0'
memory: 4G
reservations:
cpus: '2.0'
memory: 2G
networks:
etf_network:
driver: bridge
volumes:
redis_data: