要达到生产环境要求,推荐以下Docker优化配置:
- Resource constraints: in
docker-compose.yml
Add in:deploy:
resources:
limits:
cpus: '2'
memory: 1G - health checkup:配置服务探针:
healthcheck:
test: ['CMD-SHELL', 'curl -f http://localhost:8005/docs || exit 1']
interval: 30s - Persistent Storage:挂载模型缓存目录:
volumes:
- ./model_cache:/app/model_cache
高可用方案:
- utilization
docker-compose scale tts=3
创建多个实例 - 配合Nginx配置负载均衡,示例配置包含在项目
examples/
catalogs - 设置日志轮转:
logging:
driver: 'json-file'
options:
max-size: '10m'
This answer comes from the articleKitten-TTS-Server: a self-deployable lightweight text-to-speech serviceThe