도커 재수정
This commit is contained in:
@@ -37,9 +37,11 @@ COPY --from=build /app/dist ./dist
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
|
||||
# Create logs and uploads directories and set permissions
|
||||
RUN mkdir -p logs uploads && chown -R appuser:appgroup logs uploads && chmod -R 755 logs uploads
|
||||
# Create logs directory and set permissions
|
||||
RUN mkdir -p logs && chown -R appuser:appgroup logs && chmod -R 755 logs
|
||||
|
||||
EXPOSE 8080
|
||||
# uploads 디렉토리는 볼륨으로 마운트되므로 생성하지 않음
|
||||
|
||||
EXPOSE 3001
|
||||
USER appuser
|
||||
CMD ["node", "dist/app.js"]
|
||||
|
||||
@@ -1,29 +1,37 @@
|
||||
services:
|
||||
# Node.js 백엔드 (운영용)
|
||||
backend:
|
||||
# Node.js 백엔드
|
||||
plm-backend:
|
||||
build:
|
||||
context: ../../backend-node
|
||||
dockerfile: ../docker/prod/backend.Dockerfile # 운영용 Dockerfile
|
||||
container_name: pms-backend-prod
|
||||
network_mode: "host" # 호스트 네트워크 모드
|
||||
dockerfile: ../docker/prod/backend.Dockerfile
|
||||
container_name: plm-backend
|
||||
restart: always
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=8080
|
||||
- HOST=0.0.0.0 # 모든 인터페이스에서 바인딩
|
||||
- DATABASE_URL=postgresql://postgres:ph0909!!@39.117.244.52:11132/plm
|
||||
- JWT_SECRET=ilshin-plm-super-secret-jwt-key-2024
|
||||
- JWT_EXPIRES_IN=24h
|
||||
- CORS_ORIGIN=http://192.168.0.70:5555,http://39.117.244.52:5555,http://localhost:9771
|
||||
- CORS_CREDENTIALS=true
|
||||
- LOG_LEVEL=info
|
||||
restart: unless-stopped
|
||||
NODE_ENV: production
|
||||
PORT: "3001"
|
||||
DATABASE_URL: postgresql://postgres:ph0909!!@39.117.244.52:11132/plm
|
||||
JWT_SECRET: ilshin-plm-super-secret-jwt-key-2024
|
||||
JWT_EXPIRES_IN: 24h
|
||||
CORS_ORIGIN: https://v1.vexplor.com
|
||||
CORS_CREDENTIALS: "true"
|
||||
LOG_LEVEL: info
|
||||
volumes:
|
||||
- /home/vexplor/backend_data:/app/uploads
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.backend.rule=Host(`api.vexplor.com`)
|
||||
- traefik.http.routers.backend.entrypoints=websecure,web
|
||||
- traefik.http.routers.backend.tls=true
|
||||
- traefik.http.routers.backend.tls.certresolver=le
|
||||
- traefik.http.services.backend.loadbalancer.server.port=3001
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
|
||||
networks:
|
||||
pms-network:
|
||||
driver: bridge
|
||||
default:
|
||||
name: toktork_server_default
|
||||
external: true
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
services:
|
||||
# Next.js 프론트엔드만
|
||||
frontend:
|
||||
# Next.js 프론트엔드
|
||||
plm-frontend:
|
||||
build:
|
||||
context: ../../frontend
|
||||
dockerfile: ../docker/prod/frontend.Dockerfile
|
||||
args:
|
||||
- NEXT_PUBLIC_API_URL=http://39.117.244.52:8080/api
|
||||
container_name: pms-frontend-linux
|
||||
ports:
|
||||
- "5555:5555"
|
||||
- NEXT_PUBLIC_API_URL=https://api.vexplor.com
|
||||
container_name: plm-frontend
|
||||
restart: always
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- NEXT_PUBLIC_API_URL=http://39.117.244.52:8080/api
|
||||
networks:
|
||||
- pms-network
|
||||
restart: unless-stopped
|
||||
NODE_ENV: production
|
||||
NEXT_PUBLIC_API_URL: https://api.vexplor.com
|
||||
NEXT_TELEMETRY_DISABLED: "1"
|
||||
PORT: "3000"
|
||||
HOSTNAME: 0.0.0.0
|
||||
volumes:
|
||||
- /home/vexplor/frontend_data:/app/data
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.frontend.rule=Host(`v1.vexplor.com`)
|
||||
- traefik.http.routers.frontend.entrypoints=websecure,web
|
||||
- traefik.http.routers.frontend.tls=true
|
||||
- traefik.http.routers.frontend.tls.certresolver=le
|
||||
- traefik.http.services.frontend.loadbalancer.server.port=3000
|
||||
|
||||
networks:
|
||||
pms-network:
|
||||
driver: bridge
|
||||
default:
|
||||
name: toktork_server_default
|
||||
external: true
|
||||
|
||||
@@ -22,8 +22,8 @@ COPY . .
|
||||
# Disable telemetry during the build
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
# 빌드 시 환경변수 설정 (ARG로 받아서 ENV로 설정)
|
||||
ARG NEXT_PUBLIC_API_URL=http://192.168.0.70:8080/api
|
||||
# 빌드 시 환경변수 설정
|
||||
ARG NEXT_PUBLIC_API_URL=https://api.vexplor.com
|
||||
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||
|
||||
# Build the application
|
||||
@@ -55,9 +55,9 @@ COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 5555
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT 5555
|
||||
ENV PORT 3000
|
||||
ENV HOSTNAME "0.0.0.0"
|
||||
|
||||
# Next.js start 명령어 사용
|
||||
|
||||
@@ -85,8 +85,10 @@ echo "============================================"
|
||||
echo ""
|
||||
echo "📊 서비스 접속 정보:"
|
||||
echo " [DATABASE] PostgreSQL: http://39.117.244.52:11132"
|
||||
echo " [BACKEND] Spring Boot: http://localhost:8080/api"
|
||||
echo " [FRONTEND] Next.js: http://localhost:5555"
|
||||
echo " [BACKEND] API: https://api.vexplor.com"
|
||||
echo " [FRONTEND] Web: https://v1.vexplor.com"
|
||||
echo " [BACKEND LOCAL] http://localhost:3001/api"
|
||||
echo " [FRONTEND LOCAL] http://localhost:3000"
|
||||
echo ""
|
||||
echo "🔧 관리 명령어:"
|
||||
echo " 서비스 상태 확인:"
|
||||
@@ -119,7 +121,7 @@ echo ""
|
||||
echo "백엔드 헬스체크..."
|
||||
backend_healthy=false
|
||||
for i in {1..12}; do
|
||||
if curl -s http://localhost:8080/health >/dev/null 2>&1; then
|
||||
if curl -s http://localhost:3001/health >/dev/null 2>&1; then
|
||||
echo " ✅ 백엔드 서비스 정상"
|
||||
backend_healthy=true
|
||||
break
|
||||
@@ -142,14 +144,14 @@ if [ "$backend_healthy" = false ]; then
|
||||
docker-compose -f docker/prod/docker-compose.backend.prod.yml ps
|
||||
echo " 최근 로그:"
|
||||
docker-compose -f docker/prod/docker-compose.backend.prod.yml logs --tail=20
|
||||
echo " 포트 8080 사용 현황:"
|
||||
netstat -tln 2>/dev/null | grep ':8080' || echo " 포트 8080이 사용되지 않음"
|
||||
echo " 포트 3001 사용 현황:"
|
||||
netstat -tln 2>/dev/null | grep ':3001' || echo " 포트 3001이 사용되지 않음"
|
||||
fi
|
||||
|
||||
# 프론트엔드 헬스체크 (최대 30초 대기)
|
||||
echo "프론트엔드 헬스체크..."
|
||||
for i in {1..6}; do
|
||||
if curl -s http://localhost:5555 >/dev/null 2>&1; then
|
||||
if curl -s http://localhost:3000 >/dev/null 2>&1; then
|
||||
echo " ✅ 프론트엔드 서비스 정상"
|
||||
break
|
||||
else
|
||||
@@ -159,7 +161,9 @@ for i in {1..6}; do
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "🎯 시작 완료! 브라우저에서 http://localhost:5555 을 확인하세요."
|
||||
echo "🎯 시작 완료!"
|
||||
echo " 브라우저에서 https://v1.vexplor.com 을 확인하세요."
|
||||
echo " (로컬: http://localhost:3000)"
|
||||
echo ""
|
||||
|
||||
read -p "계속하려면 Enter 키를 누르세요..."
|
||||
Reference in New Issue
Block a user