hoony
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
services:
|
||||
kamco-changedetection-api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-dev
|
||||
image: kamco-cd-training-api:${IMAGE_TAG:-latest}
|
||||
container_name: kamco-cd-training-api
|
||||
image: kamco-train-app:latest
|
||||
container_name: kamco-train-api
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
@@ -12,11 +9,11 @@ services:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
ports:
|
||||
- "7200:8080"
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=dev
|
||||
- TZ=Asia/Seoul
|
||||
- cors.allowed-origins=*
|
||||
- cors.allowed-origins[0]=*
|
||||
volumes:
|
||||
- /data/training:/data/training
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
services:
|
||||
kamco-train-api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
image: kamco-train-api:${IMAGE_TAG:-latest}
|
||||
kamco-changedetection-api:
|
||||
image: kamco-train-app:latest
|
||||
container_name: kamco-train-api
|
||||
deploy:
|
||||
resources:
|
||||
@@ -17,7 +14,10 @@ services:
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=prod
|
||||
- TZ=Asia/Seoul
|
||||
- cors.allowed-origins=*
|
||||
- cors.allowed-origins[0]=*
|
||||
volumes:
|
||||
- /data/training:/data/training
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
networks:
|
||||
- kamco-cds
|
||||
|
||||
@@ -15,20 +15,13 @@ http {
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# 업로드 파일 크기 / 타임아웃 (10GB, 10분)
|
||||
client_max_body_size 10G;
|
||||
client_body_timeout 600s;
|
||||
# 업로드 파일 크기 제한 (10GB)
|
||||
client_max_body_size 10G;
|
||||
|
||||
# Upstream 설정
|
||||
upstream api_backend {
|
||||
server kamco-train-api:8080;
|
||||
}
|
||||
|
||||
upstream web_backend {
|
||||
server kamco-train-web:3002;
|
||||
}
|
||||
# Docker 내부 DNS - 시작 시 upstream 조회 실패 방지
|
||||
resolver 127.0.0.11 valid=30s ipv6=off;
|
||||
|
||||
# HTTP → HTTPS 리다이렉트 서버
|
||||
server {
|
||||
@@ -36,13 +29,12 @@ http {
|
||||
server_name api.train-kamco.com train-kamco.com;
|
||||
|
||||
# 모든 HTTP 요청을 HTTPS로 리다이렉트
|
||||
return 301 https://$host$request_uri;
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
# HTTPS 서버 설정
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
listen 443 ssl http2;
|
||||
server_name api.train-kamco.com;
|
||||
|
||||
# SSL 인증서 설정 (사설 인증서 - 멀티 도메인)
|
||||
@@ -66,20 +58,10 @@ http {
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
|
||||
# CORS 헤더
|
||||
add_header Access-Control-Allow-Origin "https://train-kamco.com" always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, PATCH, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Authorization, Content-Type, Cookie, X-Requested-With" always;
|
||||
add_header Access-Control-Allow-Credentials "true" always;
|
||||
|
||||
# 프록시 설정
|
||||
location / {
|
||||
# OPTIONS preflight 처리
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
|
||||
proxy_pass http://api_backend;
|
||||
set $api http://kamco-train-api:8080;
|
||||
proxy_pass $api;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# 프록시 헤더 설정
|
||||
@@ -94,27 +76,29 @@ http {
|
||||
proxy_set_header Cookie $http_cookie;
|
||||
proxy_set_header Authorization $http_authorization;
|
||||
|
||||
# 타임아웃 설정 (10분)
|
||||
proxy_connect_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
proxy_read_timeout 600s;
|
||||
# 타임아웃 설정 (대용량 파일 업로드 지원)
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
|
||||
# 대용량 업로드: 버퍼링 없이 백엔드로 스트리밍
|
||||
proxy_request_buffering off;
|
||||
proxy_buffering off;
|
||||
# 버퍼 설정
|
||||
proxy_buffering on;
|
||||
proxy_buffer_size 4k;
|
||||
proxy_buffers 8 4k;
|
||||
proxy_busy_buffers_size 8k;
|
||||
}
|
||||
|
||||
# 헬스체크 엔드포인트
|
||||
location /monitor/health {
|
||||
proxy_pass http://api_backend/monitor/health;
|
||||
set $api http://kamco-train-api:8080;
|
||||
proxy_pass $api/monitor/health;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
|
||||
# HTTPS 서버 설정 - Next.js Web Application
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
listen 443 ssl http2;
|
||||
server_name train-kamco.com;
|
||||
|
||||
# SSL 인증서 설정 (사설 인증서 - 멀티 도메인)
|
||||
@@ -140,7 +124,8 @@ http {
|
||||
|
||||
# API 프록시 설정 (Web에서 API 호출 시)
|
||||
location /api/ {
|
||||
proxy_pass http://api_backend/api/;
|
||||
set $api http://kamco-train-api:8080;
|
||||
proxy_pass $api/api/;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# 프록시 헤더 설정
|
||||
@@ -154,19 +139,16 @@ http {
|
||||
proxy_pass_request_headers on;
|
||||
proxy_set_header Cookie $http_cookie;
|
||||
|
||||
# 타임아웃 설정 (10분)
|
||||
proxy_connect_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
proxy_read_timeout 600s;
|
||||
|
||||
# 대용량 업로드: 버퍼링 없이 백엔드로 스트리밍
|
||||
proxy_request_buffering off;
|
||||
proxy_buffering off;
|
||||
# 타임아웃 설정
|
||||
proxy_connect_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
proxy_read_timeout 300s;
|
||||
}
|
||||
|
||||
# 프록시 설정
|
||||
location / {
|
||||
proxy_pass http://web_backend;
|
||||
set $web http://kamco-train-web:3002;
|
||||
proxy_pass $web;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# 프록시 헤더 설정
|
||||
@@ -180,10 +162,10 @@ http {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# 타임아웃 설정 (10분)
|
||||
# 타임아웃 설정
|
||||
proxy_connect_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
proxy_read_timeout 600s;
|
||||
|
||||
# 버퍼 설정
|
||||
proxy_buffering on;
|
||||
|
||||
Reference in New Issue
Block a user