Synology DS1525+ 최적화 배포 환경 완성: 32GB RAM/SSD캐시 최적화, 자동 배포 스크립트, 모니터링 도구
This commit is contained in:
134
docker-compose.prod.yml
Normal file
134
docker-compose.prod.yml
Normal file
@@ -0,0 +1,134 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Nginx 리버스 프록시 (프로덕션)
|
||||
nginx:
|
||||
build: ./nginx
|
||||
container_name: document-server-nginx-prod
|
||||
ports:
|
||||
- "24100:80"
|
||||
volumes:
|
||||
- ./frontend:/usr/share/nginx/html:ro
|
||||
- ./uploads:/usr/share/nginx/html/uploads:ro
|
||||
- nginx_cache:/var/cache/nginx
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- document-network
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- NGINX_WORKER_PROCESSES=auto
|
||||
- NGINX_WORKER_CONNECTIONS=1024
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Backend API 서버 (프로덕션)
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: document-server-backend-prod
|
||||
ports:
|
||||
- "24102:8000"
|
||||
volumes:
|
||||
- ./uploads:/app/uploads
|
||||
- backend_logs:/app/logs
|
||||
environment:
|
||||
- DATABASE_URL=postgresql+asyncpg://docuser:${DB_PASSWORD:-docpass}@database:5432/document_db
|
||||
- SECRET_KEY=${SECRET_KEY:-production-secret-key-change-this}
|
||||
- ADMIN_EMAIL=${ADMIN_EMAIL:-admin@test.com}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123}
|
||||
- DEBUG=false
|
||||
- ALLOWED_ORIGINS=http://localhost:24100,https://your-domain.com
|
||||
depends_on:
|
||||
database:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- document-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 2G
|
||||
reservations:
|
||||
memory: 512M
|
||||
|
||||
# PostgreSQL 데이터베이스 (프로덕션)
|
||||
database:
|
||||
image: postgres:15-alpine
|
||||
container_name: document-server-db-prod
|
||||
ports:
|
||||
- "24101:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=document_db
|
||||
- POSTGRES_USER=docuser
|
||||
- POSTGRES_PASSWORD=${DB_PASSWORD:-docpass}
|
||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --locale=C
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./database/init:/docker-entrypoint-initdb.d:ro
|
||||
- ./config/postgresql.prod.conf:/etc/postgresql/postgresql.conf:ro
|
||||
networks:
|
||||
- document-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U docuser -d document_db"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 4G
|
||||
reservations:
|
||||
memory: 1G
|
||||
|
||||
# Redis (캐싱 및 세션) - 프로덕션
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: document-server-redis-prod
|
||||
ports:
|
||||
- "24103:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
- ./config/redis.prod.conf:/usr/local/etc/redis/redis.conf:ro
|
||||
networks:
|
||||
- document-network
|
||||
restart: unless-stopped
|
||||
command: redis-server /usr/local/etc/redis/redis.conf
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1G
|
||||
reservations:
|
||||
memory: 256M
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
nginx_cache:
|
||||
driver: local
|
||||
backend_logs:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
document-network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.20.0.0/16
|
||||
Reference in New Issue
Block a user