-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
141 lines (134 loc) · 4.92 KB
/
Copy pathcompose.yaml
File metadata and controls
141 lines (134 loc) · 4.92 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
services:
# ── MongoDB ────────────────────────────────────────────────────────────────
mongo:
image: mongo:7
restart: "unless-stopped"
volumes:
- mongo_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
# ── Redis ──────────────────────────────────────────────────────────────────
redis:
image: redis:7-alpine
restart: "unless-stopped"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ── PostgreSQL ─────────────────────────────────────────────────────────────
postgres:
image: postgres:15-alpine
restart: "unless-stopped"
environment:
POSTGRES_USER: fintrack
POSTGRES_PASSWORD: fintrack
POSTGRES_DB: fintrack
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U fintrack -d fintrack"]
interval: 10s
timeout: 5s
retries: 5
# ── API ────────────────────────────────────────────────────────────────────
api:
build:
context: .
dockerfile: apps/api/Dockerfile
restart: "unless-stopped"
env_file:
# Copy apps/api/.env.example → apps/api/.env and fill in your values
# before running docker compose up.
- apps/api/.env
environment:
# NODE_ENV must be set here — .env defaults to development for local dev.
- NODE_ENV=production
# Override hosts: localhost (in .env) → internal compose service names.
- DATABASE_URL=postgresql://fintrack:fintrack@postgres:5432/fintrack?schema=public
- DIRECT_URL=postgresql://fintrack:fintrack@postgres:5432/fintrack?schema=public
- REDIS_URL=redis://redis:6379
- MONGO_URL=mongodb://mongo:27017/fintrack
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
mongo:
condition: service_healthy
healthcheck:
test:
["CMD-SHELL", "wget -qO- http://localhost:8000/api/health || exit 1"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
# ── Telegram bot ───────────────────────────────────────────────────────────
bot:
build:
context: .
dockerfile: apps/bot/Dockerfile
restart: "unless-stopped"
env_file:
# Copy apps/bot/.env.example → apps/bot/.env and set TELEGRAM_BOT_TOKEN
- apps/bot/.env
environment:
- NODE_ENV=production
- API_URL=http://api:8000/api
- REDIS_URL=redis://redis:6379
depends_on:
api:
condition: service_healthy
redis:
condition: service_healthy
# ── Next.js web ────────────────────────────────────────────────────────────
web:
build:
context: .
dockerfile: apps/web/Dockerfile
args:
# Nginx forwards /api/* → api:8000, so the browser always calls its
# own origin (/api/…) and never needs the internal service address.
NEXT_PUBLIC_API_URL: /api
NEXT_PUBLIC_TELEGRAM_BOT_ID: ${NEXT_PUBLIC_TELEGRAM_BOT_ID:-}
restart: "unless-stopped"
env_file:
- apps/web/.env
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:5173/FinTrack/ || exit 1"]
interval: 15s
timeout: 5s
retries: 5
start_period: 60s
# ── Nginx reverse proxy ────────────────────────────────────────────────────
nginx:
image: nginx:alpine
restart: "unless-stopped"
ports:
- "8080:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./nginx/proxy_headers.conf:/etc/nginx/proxy_headers.conf:ro
depends_on:
web:
condition: service_healthy
api:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/FinTrack/ || exit 1"]
interval: 20s
timeout: 5s
retries: 3
start_period: 10s
volumes:
postgres_data:
redis_data:
mongo_data: