-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathdocker-compose.ingest.yml
More file actions
218 lines (206 loc) · 6.73 KB
/
docker-compose.ingest.yml
File metadata and controls
218 lines (206 loc) · 6.73 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
217
218
# ─────────────────────────────────────────────────────────────
# Crypto Vision — Docker Compose for Local Ingestion Pipeline
#
# Runs Pub/Sub emulator + all ingestion workers for local
# development and testing. Workers connect to the emulator
# instead of real GCP Pub/Sub.
#
# Usage:
# docker compose -f docker-compose.ingest.yml up
# docker compose -f docker-compose.ingest.yml up worker-market # single worker
#
# With shared Redis/Postgres from main compose:
# docker compose up -d redis postgres
# docker compose -f docker-compose.ingest.yml --profile with-infra up
#
# Environment-based worker selection:
# WORKERS=market,defi docker compose -f docker-compose.ingest.yml up
#
# Prerequisites:
# - .env file with API keys (COINGECKO_API_KEY, etc.)
# - Built project: npm run build
# ─────────────────────────────────────────────────────────────
services:
# ── Pub/Sub Emulator ──────────────────────────────────────
pubsub-emulator:
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:emulators
command: >
gcloud beta emulators pubsub start
--host-port=0.0.0.0:8085
--project=local-dev
ports:
- "8085:8085"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8085"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
# ── Shared Redis (when not using main compose) ────────────
redis:
image: redis:7-alpine
command: >
redis-server
--maxmemory 256mb
--maxmemory-policy allkeys-lru
--appendonly yes
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
profiles:
- with-infra
# ── Shared Postgres (when not using main compose) ─────────
postgres:
image: postgres:16-alpine
ports:
- "5432:5432"
environment:
POSTGRES_DB: cryptovision
POSTGRES_USER: cryptovision
POSTGRES_PASSWORD: cryptovision
volumes:
- ingest-postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cryptovision"]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
profiles:
- with-infra
# ── Market Worker (every 2 min) ───────────────────────────
worker-market:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-market.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
# ── DeFi Worker (every 5 min) ─────────────────────────────
worker-defi:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-defi.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
# ── News Worker (every 5 min) ─────────────────────────────
worker-news:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-news.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
# ── DEX Worker (every 2 min) ──────────────────────────────
worker-dex:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-dex.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
# ── Derivatives Worker (every 10 min) ─────────────────────
worker-derivatives:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-derivatives.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
# ── On-Chain Worker (every 5 min) ─────────────────────────
worker-onchain:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-onchain.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
# ── Governance Worker (every 30 min) ──────────────────────
worker-governance:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-governance.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
# ── Macro Worker (every 60 min) ───────────────────────────
worker-macro:
build:
context: .
dockerfile: Dockerfile.worker
command: node dist/src/workers/ingest-macro.js
env_file: .env
environment:
PUBSUB_EMULATOR_HOST: pubsub-emulator:8085
GCP_PROJECT_ID: local-dev
NODE_ENV: development
LOG_LEVEL: debug
depends_on:
pubsub-emulator:
condition: service_healthy
restart: unless-stopped
volumes:
ingest-postgres-data:
driver: local