Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
189 lines (183 loc) · 5.41 KB
/
Copy pathdocker-compose.yml
File metadata and controls
189 lines (183 loc) · 5.41 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
services:
# ============================================================================
# Gateway Service
# ============================================================================
gateway:
build:
context: .
dockerfile: ./apps/gateway/Dockerfile
target: runner
ports:
- "3001:3001"
environment:
- NODE_ENV=production
- PORT=3001
- HOST=0.0.0.0
- DB_HOST=postgres
- DB_PORT=5432
- DB_NAME=gravity
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- REDIS_HOST=redis
- REDIS_PORT=6379
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
- JWT_SECRET=${JWT_SECRET}
- CORS_ORIGINS=${CORS_ORIGINS}
- LOG_LEVEL=info
- ENABLE_METRICS=true
depends_on:
redis:
condition: service_healthy
networks:
- gravity-net
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", 'require("http").get("http://localhost:3001/health", ({ statusCode }) => process.exit(statusCode === 200 ? 0 : 1)).on("error", () => process.exit(1))']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
cpus: '1'
memory: 1G
reservations:
cpus: '0.5'
memory: 512M
# ============================================================================
# Dashboard (Next.js) Service
# ============================================================================
dashboard:
build:
context: .
dockerfile: ./apps/dashboard/Dockerfile
target: runner
args:
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL}
NEXT_PUBLIC_POLAR_PRO_PRODUCT_ID: ${NEXT_PUBLIC_POLAR_PRO_PRODUCT_ID}
NEXT_PUBLIC_POLAR_BUSINESS_PRODUCT_ID: ${NEXT_PUBLIC_POLAR_BUSINESS_PRODUCT_ID}
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- PORT=3000
- NEXT_PUBLIC_API_URL=http://gateway:3001
- NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}
- NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}
- SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}
- APP_URL=${APP_URL}
- POLAR_PRO_PRODUCT_ID=${POLAR_PRO_PRODUCT_ID}
- POLAR_BUSINESS_PRODUCT_ID=${POLAR_BUSINESS_PRODUCT_ID}
- POLAR_WEBHOOK_SECRET=${POLAR_WEBHOOK_SECRET}
depends_on:
- gateway
networks:
- gravity-net
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", 'require("http").get("http://localhost:3000/api/health", ({ statusCode }) => process.exit(statusCode === 200 ? 0 : 1)).on("error", () => process.exit(1))']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
# ============================================================================
# PostgreSQL Database
# ============================================================================
# Optional generic PostgreSQL for local experiments. The application uses
# Supabase for account data; its Supabase schema cannot run in this service
# because it depends on Supabase-managed auth and realtime schemas.
postgres:
image: postgres:15-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=gravity
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- gravity-net
restart: unless-stopped
profiles:
- legacy-postgres
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${DB_USER} -d gravity" ]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
# ============================================================================
# Redis Cache
# ============================================================================
redis:
image: redis:7-alpine
ports:
- "6379:6379"
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
networks:
- gravity-net
restart: unless-stopped
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.25'
memory: 256M
reservations:
cpus: '0.125'
memory: 128M
# ============================================================================
# Nginx Reverse Proxy (Optional)
# ============================================================================
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- gateway
- dashboard
networks:
- gravity-net
restart: unless-stopped
profiles:
- production
volumes:
postgres_data:
driver: local
redis_data:
driver: local
networks:
gravity-net:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16