-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (116 loc) · 3.48 KB
/
docker-compose.yml
File metadata and controls
122 lines (116 loc) · 3.48 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
services:
db:
image: timescale/timescaledb:latest-pg16
environment:
POSTGRES_DB: ${DB_NAME:-tradeclaw}
POSTGRES_USER: ${DB_USER:-tradeclaw}
POSTGRES_PASSWORD: ${DB_PASSWORD:?Set DB_PASSWORD in .env}
volumes:
- db_data:/var/lib/postgresql/data
- ./scripts/init-db.sh:/docker-entrypoint-initdb.d/init.sh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-tradeclaw}"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
redis:
image: redis:7-alpine
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
restart: unless-stopped
migrate:
image: timescale/timescaledb:latest-pg16
environment:
PGHOST: db
PGPORT: "5432"
PGUSER: ${DB_USER:-tradeclaw}
PGPASSWORD: ${DB_PASSWORD:?Set DB_PASSWORD in .env}
PGDATABASE: ${DB_NAME:-tradeclaw}
depends_on:
db:
condition: service_healthy
volumes:
- ./apps/web/migrations:/migrations:ro
entrypoint: >
sh -c 'for f in /migrations/*.sql; do
echo "Running $$f ...";
psql -v ON_ERROR_STOP=1 -f "$$f";
done && echo "Migrations complete"'
restart: "no"
app:
build:
context: .
dockerfile: Dockerfile
target: production
ports:
- "${APP_PORT:-3000}:3000"
environment:
DATABASE_URL: postgres://${DB_USER:-tradeclaw}:${DB_PASSWORD:?Set DB_PASSWORD in .env}@db:5432/${DB_NAME:-tradeclaw}
REDIS_URL: redis://redis:6379
NODE_ENV: production
AUTH_SECRET: ${AUTH_SECRET:?Set AUTH_SECRET in .env}
APP_URL: ${APP_URL:-http://localhost:3000}
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
migrate:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
scanner:
build:
context: .
dockerfile: Dockerfile.scanner
environment:
DATABASE_URL: postgres://${DB_USER:-tradeclaw}:${DB_PASSWORD:?Set DB_PASSWORD in .env}@db:5432/${DB_NAME:-tradeclaw}
REDIS_URL: redis://redis:6379
SCAN_INTERVAL: ${SCAN_INTERVAL:-60}
SCAN_INSTRUMENTS: ${SCAN_INSTRUMENTS:-all}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN:-}
TELEGRAM_CHAT_ID: ${TELEGRAM_CHAT_ID:-}
DISCORD_WEBHOOK_URL: ${DISCORD_WEBHOOK_URL:-}
WEBHOOK_URL: ${WEBHOOK_URL:-}
MIN_CONFIDENCE: ${MIN_CONFIDENCE:-70}
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
ws-server:
build:
context: .
dockerfile: Dockerfile.ws-server
ports:
- "${WS_SERVER_PORT:-4000}:4000"
environment:
DATABASE_URL: postgres://${DB_USER:-tradeclaw}:${DB_PASSWORD:?Set DB_PASSWORD in .env}@db:5432/${DB_NAME:-tradeclaw}
REDIS_URL: redis://redis:6379
WS_SERVER_PORT: "4000"
NODE_ENV: production
AUTH_SECRET: ${AUTH_SECRET:?Set AUTH_SECRET in .env}
depends_on:
redis:
condition: service_healthy
db:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:4000/health"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
db_data:
redis_data: