14448af731
- 添加案例、新闻、产品详情页面的E2E测试 - 优化详情页面的客户端组件和页面逻辑 - 添加高性能Docker配置和Nginx配置 - 更新API服务和常量配置 - 添加性能优化文档和任务进度更新 - 修复ESLint错误和类型问题
125 lines
2.7 KiB
YAML
125 lines
2.7 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Nginx 负载均衡器
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: novalon-nginx
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./ssl:/etc/nginx/ssl:ro
|
|
depends_on:
|
|
- app1
|
|
- app2
|
|
- app3
|
|
restart: unless-stopped
|
|
networks:
|
|
- novalon-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# 应用实例 1
|
|
app1:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: novalon-app-1
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3001
|
|
env_file:
|
|
- .env.production
|
|
volumes:
|
|
- ./data:/app/data
|
|
- ./uploads:/app/uploads
|
|
restart: unless-stopped
|
|
networks:
|
|
- novalon-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
# 应用实例 2
|
|
app2:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: novalon-app-2
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3002
|
|
env_file:
|
|
- .env.production
|
|
volumes:
|
|
- ./data:/app/data
|
|
- ./uploads:/app/uploads
|
|
restart: unless-stopped
|
|
networks:
|
|
- novalon-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3002/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
# 应用实例 3
|
|
app3:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: novalon-app-3
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=3003
|
|
env_file:
|
|
- .env.production
|
|
volumes:
|
|
- ./data:/app/data
|
|
- ./uploads:/app/uploads
|
|
restart: unless-stopped
|
|
networks:
|
|
- novalon-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3003/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 1G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
networks:
|
|
novalon-network:
|
|
driver: bridge |