-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose_mem_limits.yml
228 lines (216 loc) · 6.09 KB
/
docker-compose_mem_limits.yml
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
217
218
219
220
221
222
223
224
225
226
227
228
version: '3.8'
services:
postgres_pipeline:
image: postgres:16
profiles: ["core", "all"]
deploy:
resources:
limits:
memory: 4G
reservations:
memory: 512M
ports:
- "5432:5432"
environment:
POSTGRES_USER: devuser
POSTGRES_PASSWORD: devpass
POSTGRES_DB: dvmdash_pipeline
# Memory configuration for 4GB total memory
POSTGRES_SHARED_BUFFERS: 1GB # 25% of total memory
POSTGRES_EFFECTIVE_CACHE_SIZE: 3GB # 75% of total memory
POSTGRES_WORK_MEM: 32MB # For query workspaces
POSTGRES_MAINTENANCE_WORK_MEM: 256MB # For maintenance operations
POSTGRES_MAX_CONNECTIONS: 100 # Adjust based on your needs
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U devuser -d dvmdash_pipeline" ]
interval: 10s
timeout: 5s
retries: 5
volumes:
- ./infrastructure/postgres/pipeline_init.sql:/docker-entrypoint-initdb.d/init.sql
- postgres_pipeline_data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
profiles: ["core", "all"]
ports:
- "6379:6379"
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
event_collector:
build:
context: .
dockerfile: ./backend/event_collector/Dockerfile
profiles: ["collector", "all"]
environment:
- USE_TEST_DATA=true
- START_LISTENING=true
- REDIS_URL=redis://redis:6379/0
- LOG_LEVEL=DEBUG
- RELAYS=wss://relay.damus.io,wss://relay.primal.net,wss://relay.dvmdash.live,wss://relay.f7z.xyz,wss://relayable.org
- DAYS_LOOKBACK=7
healthcheck:
test: [ "CMD", "python", "-c", "import os, redis; r=redis.from_url('redis://redis:6379/0'); r.ping() if os.getenv('START_LISTENING')=='true' else exit(0)" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
volumes:
- ./backend:/app/backend
- event_collector_logs:/app/logs
- ./backend/event_collector/test_data:/test_data
depends_on:
redis:
condition: service_healthy
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
monthly_archiver:
build:
context: .
dockerfile: ./backend/monthly_archiver/Dockerfile
profiles: ["all"]
environment:
- REDIS_URL=redis://redis:6379/0
- LOG_LEVEL=DEBUG
- POSTGRES_USER=devuser
- POSTGRES_PASSWORD=devpass
- POSTGRES_DB=dvmdash_pipeline
- POSTGRES_HOST=postgres_pipeline
- DAILY_CLEANUP_INTERVAL_SECONDS=15 # use 24*60*60 (24 hours) for production
- MONTHLY_CLEANUP_BUFFER_DAYS=3
- BATCH_PROCESSOR_GRACE_PERIOD_BEFORE_UPDATE_SECONDS=15
volumes:
- ./backend/monthly_archiver:/app/backend/monthly_archiver
- ./backend/shared:/app/backend/shared
- monthly_archiver_logs:/app/logs
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
depends_on:
postgres_pipeline:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: [ "CMD", "python", "-c", "import redis; redis.from_url(os.getenv('REDIS_URL', 'redis://redis:6379/0')).ping()" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
batch_processor:
build:
context: .
dockerfile: ./backend/batch_processor/Dockerfile
profiles: [ "processor", "all" ]
environment:
- REDIS_URL=redis://redis:6379/0
- LOG_LEVEL=DEBUG
- POSTGRES_USER=devuser
- POSTGRES_PASSWORD=devpass
- POSTGRES_DB=dvmdash_pipeline
- POSTGRES_HOST=postgres_pipeline
- MAX_WAIT_SECONDS=3
- BATCH_SIZE=10000
- BACKTEST_MODE=true
volumes:
- ./backend/batch_processor:/app/backend/batch_processor
- ./backend/shared:/app/backend/shared
- batch_processor_logs:/app/logs
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
depends_on:
postgres_pipeline:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: [ "CMD", "python", "-c", "import redis; redis.from_url(os.getenv('REDIS_URL', 'redis://redis:6379/0')).ping()" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
api:
build:
context: .
dockerfile: ./api/Dockerfile
profiles: [ "all" ]
ports:
- "8000:8000"
environment:
- POSTGRES_USER=devuser
- POSTGRES_PASSWORD=devpass
- POSTGRES_DB=dvmdash_pipeline
- POSTGRES_HOST=postgres_pipeline
depends_on:
postgres_pipeline:
condition: service_healthy
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/docs" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
nostr_relay:
build:
context: ./infrastructure/nostr_rs_relay
dockerfile: Dockerfile
profiles: ["all"] # todo [ "core", "all" ]
ports:
- "8081:8080" # Using 8081 since 8080 might be used by other services
volumes:
- nostr_relay_data:/usr/src/app/db
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
volumes:
postgres_pipeline_data:
redis_data:
event_collector_logs:
batch_processor_logs:
monthly_archiver_logs:
nostr_relay_data: