-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
163 lines (155 loc) · 4.56 KB
/
docker-compose.yml
File metadata and controls
163 lines (155 loc) · 4.56 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
version: "3.9"
services:
# ── PostgreSQL ──
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: contenthub
POSTGRES_USER: ${POSTGRES_USER:-contenthub}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- "127.0.0.1:5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-contenthub}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- internal
# ── Next.js Frontend + API ──
nextjs:
build:
context: ./frontend
dockerfile: Dockerfile
args:
NEXT_PUBLIC_WS_URL: wss://${DOMAIN}
NEXT_PUBLIC_APP_URL: https://${DOMAIN}
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-contenthub}:${POSTGRES_PASSWORD}@postgres:5432/contenthub
JWT_SECRET: ${JWT_SECRET}
WS_SERVER_URL: http://ws-server:3001
WS_INTERNAL_API_KEY: ${WS_INTERNAL_API_KEY}
NEXT_PUBLIC_APP_URL: https://${DOMAIN}
NODE_ENV: production
# Email
RESEND_API_KEY: ${RESEND_API_KEY:-}
EMAIL_FROM: ${EMAIL_FROM:-}
# Aliyun OSS
OSS_REGION: ${OSS_REGION:-}
OSS_BUCKET: ${OSS_BUCKET:-}
OSS_ACCESS_KEY_ID: ${OSS_ACCESS_KEY_ID:-}
OSS_ACCESS_KEY_SECRET: ${OSS_ACCESS_KEY_SECRET:-}
OSS_ENDPOINT: ${OSS_ENDPOINT:-}
OSS_BUCKET_DOMAIN: ${OSS_BUCKET_DOMAIN:-}
# Aliyun SMS
SMS_ACCESS_KEY_ID: ${SMS_ACCESS_KEY_ID:-}
SMS_ACCESS_KEY_SECRET: ${SMS_ACCESS_KEY_SECRET:-}
# LLM
key: ${LLM_API_KEY:-}
baseurl: ${LLM_BASE_URL:-}
model: ${LLM_MODEL:-qwen3-max}
# Backend integration (optional)
BACKEND_WEBHOOK_URL: ${BACKEND_WEBHOOK_URL:-}
BACKEND_API_KEY: ${BACKEND_API_KEY:-}
BACKEND_CORS_ORIGIN: ${BACKEND_CORS_ORIGIN:-}
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3000/api/health').then(r=>{if(!r.ok)throw 1})"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- internal
# ── WebSocket Server (Socket.io) ──
ws-server:
build:
context: ./ws-server
dockerfile: Dockerfile
restart: unless-stopped
environment:
PORT: "3001"
JWT_SECRET: ${JWT_SECRET}
WS_INTERNAL_API_KEY: ${WS_INTERNAL_API_KEY}
ALLOWED_ORIGINS: https://${DOMAIN}
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3001/health').then(r=>{if(!r.ok)throw 1})"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
- internal
# ── Backend Task Creator (Vue + Express) ──
task-creator:
build:
context: ./backend-task-creator
dockerfile: Dockerfile
args:
VITE_FRONTEND_URL: https://${DOMAIN}
VITE_BACKEND_API_KEY: ${BACKEND_API_KEY:-}
restart: unless-stopped
depends_on:
- nextjs
environment:
NODE_ENV: production
OSS_REGION: ${OSS_REGION:-}
OSS_BUCKET: ${OSS_BUCKET:-}
OSS_ACCESS_KEY_ID: ${OSS_ACCESS_KEY_ID:-}
OSS_ACCESS_KEY_SECRET: ${OSS_ACCESS_KEY_SECRET:-}
FRONTEND_URL: http://nextjs:3000
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://localhost:3003/api/presign',{method:'POST',headers:{'Content-Type':'application/json'},body:'{}'}).then(r=>{if(r.status===503)throw 1})"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
- internal
# ── Nginx Reverse Proxy ──
nginx:
image: nginx:1.27-alpine
restart: unless-stopped
depends_on:
- nextjs
- ws-server
- task-creator
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
- certbot-etc:/etc/letsencrypt:ro
- certbot-var:/var/lib/letsencrypt
- certbot-webroot:/var/www/certbot:ro
healthcheck:
test: ["CMD", "nginx", "-t"]
interval: 60s
timeout: 5s
retries: 3
networks:
- internal
# ── Certbot (SSL auto-renewal) ──
certbot:
image: certbot/certbot
volumes:
- certbot-etc:/etc/letsencrypt
- certbot-var:/var/lib/letsencrypt
- certbot-webroot:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done'"
volumes:
pgdata:
certbot-etc:
certbot-var:
certbot-webroot:
networks:
internal:
driver: bridge