-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
200 lines (190 loc) · 6.69 KB
/
docker-compose.prod.yml
File metadata and controls
200 lines (190 loc) · 6.69 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
190
191
192
193
194
195
196
197
198
199
200
# ══════════════════════════════════════════════════════════════════════
# Geny — Docker Compose (Production with Nginx Reverse Proxy / Full)
#
# 도메인을 연결하여 단일 포트(80)로 backend / frontend를 라우팅합니다.
# TTS 로컬 엔진은 --profile tts-local 로 활성화할 수 있습니다.
#
# /api/* → backend:8000
# /health → backend:8000
# /static/assets/* → backend:8000
# /* → frontend:3000
#
# Usage:
# docker compose -f docker-compose.prod.yml up --build -d
# docker compose -f docker-compose.prod.yml --profile tts-local up --build -d
# docker compose -f docker-compose.prod.yml down
# docker compose -f docker-compose.prod.yml logs -f
#
# 경량 버전 (TTS 없음):
# docker compose -f docker-compose.prod-core.yml up --build -d
#
# 도메인 / SSL 설정:
# DOMAIN=geny.example.com → nginx server_name 에 반영
# SSL 은 별도의 certbot 또는 Cloudflare 등으로 처리 후
# nginx/nginx.conf 에 443 블록을 추가하세요.
#
# Port 변경:
# NGINX_PORT=58443 docker compose -f docker-compose.prod.yml up --build
#
# TTS 설정:
# GPT-SoVITS API URL → 설정 UI에서 http://gpt-sovits:9880 입력
# ══════════════════════════════════════════════════════════════════════
services:
# ── PostgreSQL Database ───────────────────────────────────────────
postgres:
image: postgres:16-alpine
container_name: geny-postgres-prod
init: true
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-geny}
POSTGRES_USER: ${POSTGRES_USER:-geny}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-geny123}
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
TZ: ${TIMEZONE:-Asia/Seoul}
volumes:
- geny-pgdata-prod:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-geny} -d ${POSTGRES_DB:-geny}"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
- geny-net-prod
# ── Backend (FastAPI + LangGraph + Claude CLI) ────────────────────
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: geny-backend-prod
init: true
restart: unless-stopped
expose:
- "8000"
env_file:
- path: ./backend/.env
required: false
environment:
- APP_HOST=0.0.0.0
- APP_PORT=8000
- GENY_AGENT_STORAGE_ROOT=/data/geny_agent_sessions
# PostgreSQL
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DB=${POSTGRES_DB:-geny}
- POSTGRES_USER=${POSTGRES_USER:-geny}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-geny123}
- AUTO_MIGRATION=true
- TIMEZONE=${TIMEZONE:-Asia/Seoul}
volumes:
- geny-tts-cache-prod:/app/cache/tts
- geny-voices-prod:/app/static/voices
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:8000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
networks:
- geny-net-prod
# ── Frontend (Next.js) ────────────────────────────────────────────
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- API_URL=http://backend:8000
- NEXT_PUBLIC_API_URL=
container_name: geny-frontend-prod
init: true
restart: unless-stopped
expose:
- "3000"
environment:
- API_URL=http://backend:8000
- NEXT_PUBLIC_API_URL=
- PORT=3000
- HOSTNAME=0.0.0.0
depends_on:
backend:
condition: service_healthy
networks:
- geny-net-prod
# ── Nginx Reverse Proxy ───────────────────────────────────────────
nginx:
image: nginx:1.27-alpine
container_name: geny-nginx-prod
init: true
restart: unless-stopped
ports:
- "${NGINX_PORT:-58443}:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
frontend:
condition: service_started
backend:
condition: service_healthy
networks:
- geny-net-prod
# ── GPT-SoVITS (Optional — TTS 로컬 엔진, GPU 필요) ──────────────
# xxxxrt666/gpt-sovits (공식 이미지, v2 API, 한국어 지원)
# api_v2.py → 포트 9880 서빙, webui.py → 포트 9874 (TTS Studio)
gpt-sovits:
image: xxxxrt666/gpt-sovits:latest-cu126
container_name: geny-gpt-sovits-prod
profiles: ["tts-local"]
init: true
restart: unless-stopped
working_dir: /workspace/GPT-SoVITS
command:
- /bin/bash
- "-c"
- |
echo '[1/3] Installing nvidia-npp-cu12...';
pip install --no-cache-dir nvidia-npp-cu12;
echo '[2/3] Fixing torchaudio...';
pip install --no-cache-dir --no-deps --force-reinstall torchaudio==2.10.0 --index-url https://download.pytorch.org/whl/cu126;
echo '[3/3] Starting GPT-SoVITS...';
rm -rf GPT_SoVITS/pretrained_models GPT_SoVITS/text/G2PWModel tools/asr/models tools/uvr5/uvr5_weights 2>/dev/null;
ln -sf /workspace/models/pretrained_models GPT_SoVITS/pretrained_models;
ln -sf /workspace/models/G2PWModel GPT_SoVITS/text/G2PWModel;
ln -sf /workspace/models/asr_models tools/asr/models;
ln -sf /workspace/models/uvr5_weights tools/uvr5/uvr5_weights;
python webui.py &
exec python api_v2.py -a 0.0.0.0 -p 9880
expose:
- "9880"
- "9874"
volumes:
- geny-voices-prod:/workspace/GPT-SoVITS/references:ro
tty: true
stdin_open: true
shm_size: 16G
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
environment:
- is_half=False
- GRADIO_ROOT_PATH=/tts-studio
- LD_LIBRARY_PATH=/root/conda/lib:/root/conda/lib/python3.12/site-packages/nvidia/npp/lib
networks:
- geny-net-prod
networks:
geny-net-prod:
driver: bridge
volumes:
geny-pgdata-prod:
driver: local
geny-tts-cache-prod:
driver: local
geny-voices-prod:
driver: local