-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
152 lines (133 loc) · 5.65 KB
/
docker-compose.prod.yml
File metadata and controls
152 lines (133 loc) · 5.65 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
# FangcunGuard Docker Compose - Production Configuration
# Uses pre-built images from Docker Hub (no source code required)
#
# Usage:
# 1. Create .env file with PLATFORM_IMAGE=your-registry/fangcunguard-platform:version
# 2. Run: docker compose -f docker-compose.prod.yml up -d
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: fangcunguard-postgres
restart: unless-stopped
environment:
POSTGRES_DB: fangcunguard
POSTGRES_USER: fangcunguard
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-your_password}
POSTGRES_HOST_AUTH_METHOD: md5
command: [
"postgres",
"-c", "max_connections=600",
"-c", "shared_buffers=256MB",
"-c", "effective_cache_size=1GB",
"-c", "maintenance_work_mem=64MB",
"-c", "checkpoint_completion_target=0.9",
"-c", "wal_buffers=16MB",
"-c", "default_statistics_target=100",
"-c", "random_page_cost=1.1",
"-c", "effective_io_concurrency=200",
"-c", "work_mem=4MB"
]
ports:
- "${POSTGRES_PORT:-54321}:5432"
volumes:
- fangcunguard-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U fangcunguard -d fangcunguard"]
interval: 5s
timeout: 5s
retries: 5
networks:
- fangcunguard-network
# Unified Platform Service (Frontend + Backend)
# Production mode: Uses pre-built image from registry
platform:
image: ${PLATFORM_IMAGE:-fangcunguard/fangcunguard-platform:latest}
container_name: fangcunguard-platform
restart: unless-stopped
ports:
- "${FRONTEND_PORT:-3000}:80"
- "${ADMIN_PORT:-5000}:5000"
- "${DETECTION_PORT:-5001}:5001"
- "${PROXY_PORT:-5002}:5002"
environment:
# Database configuration
- DATABASE_HOST=${DATABASE_HOST:-postgres}
- DATABASE_USER=${DATABASE_USER:-fangcunguard}
- DATABASE_NAME=${DATABASE_NAME:-fangcunguard}
- DATABASE_URL=postgresql://${DATABASE_USER:-fangcunguard}:${POSTGRES_PASSWORD:-your_password}@${DATABASE_HOST:-postgres}:5432/${DATABASE_NAME:-fangcunguard}
- RESET_DATABASE_ON_STARTUP=false
# Application configuration
- DEBUG=${DEBUG:-false}
- JWT_SECRET_KEY=${JWT_SECRET_KEY:-your-secret-key-change-in-production}
# Deployment mode configuration
# 'enterprise': Private enterprise deployment (default) - no subscription, no third-party package marketplace
# 'saas': SaaS deployment - with subscription system and third-party package marketplace
- DEPLOYMENT_MODE=${DEPLOYMENT_MODE:-enterprise}
# Data directory configuration
- DATA_DIR=/app/data
- LOG_LEVEL=${LOG_LEVEL:-INFO}
# CORS configuration
- CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000}
# Administrator configuration
- SUPER_ADMIN_USERNAME=${SUPER_ADMIN_USERNAME:-admin@yourdomain.com}
- SUPER_ADMIN_PASSWORD=${SUPER_ADMIN_PASSWORD:-CHANGE-THIS-PASSWORD-IN-PRODUCTION}
# Default language configuration
- DEFAULT_LANGUAGE=${DEFAULT_LANGUAGE:-en}
# Model API configuration (FangcunGuard Text Model)
- GUARDRAILS_MODEL_API_URL=${GUARDRAILS_MODEL_API_URL:-http://localhost:58002/v1}
- GUARDRAILS_MODEL_API_KEY=${GUARDRAILS_MODEL_API_KEY:-EMPTY}
- GUARDRAILS_MODEL_NAME=${GUARDRAILS_MODEL_NAME:-3Guard-Gen-8B}
# Multimodal model API configuration (Vision-Language)
- GUARDRAILS_VL_MODEL_API_URL=${GUARDRAILS_VL_MODEL_API_URL:-http://localhost:58003/v1}
- GUARDRAILS_VL_MODEL_API_KEY=${GUARDRAILS_VL_MODEL_API_KEY:-EMPTY}
- GUARDRAILS_VL_MODEL_NAME=${GUARDRAILS_VL_MODEL_NAME:-Qwen3Guard-VL}
# Embedding model API configuration
- EMBEDDING_API_BASE_URL=${EMBEDDING_API_BASE_URL:-http://localhost:58004/v1}
- EMBEDDING_API_KEY=${EMBEDDING_API_KEY:-EMPTY}
- EMBEDDING_MODEL_NAME=${EMBEDDING_MODEL_NAME:-bge-m3}
- EMBEDDING_MODEL_DIMENSION=${EMBEDDING_MODEL_DIMENSION:-1024}
- EMBEDDING_SIMILARITY_THRESHOLD=${EMBEDDING_SIMILARITY_THRESHOLD:-0.7}
- EMBEDDING_MAX_RESULTS=${EMBEDDING_MAX_RESULTS:-5}
# SMTP email configuration
- SMTP_SERVER=${SMTP_SERVER:-smtp.yourdomain.com}
- SMTP_PORT=${SMTP_PORT:-465}
- SMTP_USERNAME=${SMTP_USERNAME:-your-email@yourdomain.com}
- SMTP_PASSWORD=${SMTP_PASSWORD:-your-password}
- SMTP_USE_TLS=${SMTP_USE_TLS:-false}
- SMTP_USE_SSL=${SMTP_USE_SSL:-true}
# Service configuration
- ADMIN_PORT=5000
- ADMIN_UVICORN_WORKERS=${ADMIN_UVICORN_WORKERS:-2}
- ADMIN_MAX_CONCURRENT_REQUESTS=${ADMIN_MAX_CONCURRENT_REQUESTS:-50}
- DETECTION_PORT=5001
- DETECTION_UVICORN_WORKERS=${DETECTION_UVICORN_WORKERS:-32}
- DETECTION_MAX_CONCURRENT_REQUESTS=${DETECTION_MAX_CONCURRENT_REQUESTS:-400}
- DETECTION_HOST=${DETECTION_HOST:-localhost}
- PROXY_PORT=5002
- PROXY_UVICORN_WORKERS=${PROXY_UVICORN_WORKERS:-24}
- PROXY_MAX_CONCURRENT_REQUESTS=${PROXY_MAX_CONCURRENT_REQUESTS:-300}
# Frontend configuration
- VITE_BASE=/platform/
volumes:
- fangcunguard-platform-data:/mnt/data/fangcunguard-data
depends_on:
postgres:
condition: service_healthy
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- fangcunguard-network
healthcheck:
test: ["CMD", "sh", "-c", "curl -f http://localhost:5000/health && curl -f http://localhost:5001/health && curl -f http://localhost:5002/health && curl -f http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
networks:
fangcunguard-network:
driver: bridge
volumes:
fangcunguard-db-data:
driver: local
fangcunguard-platform-data:
driver: local