-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
137 lines (127 loc) · 3.84 KB
/
Copy pathdocker-compose.yml
File metadata and controls
137 lines (127 loc) · 3.84 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
services:
# PostgreSQL database - authoritative data source
db:
image: postgres:16-alpine
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_DB: deeprecall
POSTGRES_USER: deeprecall
POSTGRES_PASSWORD: deeprecall
volumes:
- postgres_data:/var/lib/postgresql/data
command:
- "postgres"
- "-c"
- "wal_level=logical"
- "-c"
- "max_replication_slots=10"
- "-c"
- "max_wal_senders=10"
- "-c"
- "synchronous_commit=on" # Force immediate WAL flush (slower but immediate)
- "-c"
- "fsync=on" # Force disk sync
healthcheck:
test: ["CMD-SHELL", "pg_isready -U deeprecall"]
interval: 5s
timeout: 5s
retries: 5
# Database migration runner - runs once on startup
db-migrate:
image: postgres:16-alpine
volumes:
- ./migrations:/migrations:ro
environment:
POSTGRES_HOST: db
POSTGRES_DB: deeprecall
POSTGRES_USER: deeprecall
POSTGRES_PASSWORD: deeprecall
depends_on:
db:
condition: service_healthy
entrypoint: ["/bin/sh", "/migrations/init-db.sh"]
restart: "no" # Only run once
# ElectricSQL sync service
electric:
image: electricsql/electric:latest
restart: unless-stopped
ports:
- "5133:3000" # Map internal 3000 to external 5133
environment:
DATABASE_URL: postgresql://deeprecall:deeprecall@db:5432/deeprecall
ELECTRIC_WRITE_TO_PG_MODE: "direct_writes"
LOGICAL_PUBLISHER_HOST: db
LOGICAL_PUBLISHER_PORT: 5432
PG_PROXY_PASSWORD: deeprecall
# Development mode - disable auth (NOT FOR PRODUCTION!)
ELECTRIC_INSECURE: "true"
depends_on:
db:
condition: service_healthy
db-migrate:
condition: service_completed_successfully
# Health check disabled - Electric logs show when it's ready
# healthcheck:
# test: ["CMD-SHELL", "wget --spider -q http://localhost:3000/ || exit 1"]
# interval: 10s
# timeout: 5s
# retries: 5
# start_period: 10s
# Next.js web application
frontend:
build:
context: .
dockerfile: ./apps/web/Dockerfile
restart: unless-stopped
ports:
- "3000:3000"
volumes:
# Mount entire workspace (for monorepo packages)
- .:/workspace:delegated
# Named volume for ALL node_modules (hoisted mode = single node_modules at root)
- node_modules:/workspace/node_modules
# Named volume for Next.js build cache
- next_cache:/workspace/apps/web/.next
# Data directory bind mount (outside workspace mount to avoid conflicts)
- ./data:/workspace/data:consistent
environment:
# Database connections
DATABASE_URL: postgresql://deeprecall:deeprecall@db:5432/deeprecall
ELECTRIC_URL: http://electric:3000
# Build configuration
npm_config_target_platform: linux
npm_config_target_arch: x64
depends_on:
db:
condition: service_healthy
db-migrate:
condition: service_completed_successfully
electric:
condition: service_started # Just wait for it to start, not be healthy
# GPU support for WebGL/hardware acceleration
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
volumes:
# PostgreSQL data
postgres_data:
# Named volumes are managed by Docker
node_modules: # Single hoisted node_modules at workspace root
next_cache:
# python:
# build:
# context: ./python
# dockerfile: Dockerfile
# ports:
# - "8000:8000"
# environment:
# - USE_CUDA=true
# volumes:
# - ./python/:/app/
# runtime: nvidia