정리
This commit is contained in:
@@ -14,6 +14,23 @@ RUN npm install
|
||||
# 소스 코드 복사
|
||||
COPY . .
|
||||
|
||||
# 환경변수 설정 (Docker 환경용)
|
||||
ENV NODE_ENV=production
|
||||
ENV POSTGRES_HOST=192.168.11.46
|
||||
ENV POSTGRES_PORT=5431
|
||||
ENV POSTGRES_USER=genome
|
||||
ENV POSTGRES_PASSWORD=genome1@3
|
||||
ENV POSTGRES_DB=genome_db
|
||||
ENV POSTGRES_SYNCHRONIZE=false
|
||||
ENV POSTGRES_LOGGING=false
|
||||
ENV REDIS_URL=redis://192.168.11.46:6379
|
||||
ENV REDIS_HOST=192.168.11.46
|
||||
ENV REDIS_PORT=6379
|
||||
ENV JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
|
||||
ENV JWT_EXPIRES_IN=24h
|
||||
ENV JWT_REFRESH_SECRET=your-refresh-token-secret
|
||||
ENV JWT_REFRESH_EXPIRES_IN=7d
|
||||
|
||||
# NestJS 빌드
|
||||
RUN npm run build
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
container_name: nextjs-app
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- NEXT_PUBLIC_API_URL=/backend/api
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: nestjs-app
|
||||
ports:
|
||||
- "4000:4000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
|
||||
- POSTGRES_HOST=postgres
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- REDIS_HOST=redis
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
- /app/node_modules
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: postgres-db
|
||||
ports:
|
||||
- "5431:5432"
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: redis-cache
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
# nginx:
|
||||
# image: nginx:alpine
|
||||
# container_name: nginx-proxy
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# volumes:
|
||||
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
# - ./nginx/ssl:/etc/nginx/ssl
|
||||
# depends_on:
|
||||
# - frontend
|
||||
# - backend
|
||||
# networks:
|
||||
# - app-network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
@@ -1,80 +0,0 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile.prod
|
||||
container_name: nextjs-app-prod
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-https://your-domain.com}
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile.prod
|
||||
container_name: nestjs-app-prod
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- DATABASE_URL=postgresql://${POSTGRES_USER:-prod_user}:${POSTGRES_PASSWORD:-CHANGE_THIS_STRONG_PASSWORD}@postgres:5432/${POSTGRES_DB:-prod_db}
|
||||
- REDIS_URL=redis://redis:${REDIS_PORT:-6379}
|
||||
- JWT_SECRET=${JWT_SECRET:-SUPER_SECURE_JWT_SECRET_AT_LEAST_32_CHARACTERS_LONG}
|
||||
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-1h}
|
||||
- CORS_ORIGIN=${CORS_ORIGIN:-https://your-domain.com}
|
||||
- RATE_LIMIT_WINDOW_MS=${RATE_LIMIT_WINDOW_MS:-900000}
|
||||
- RATE_LIMIT_MAX_REQUESTS=${RATE_LIMIT_MAX_REQUESTS:-50}
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: postgres-db-prod
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-prod_user}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-CHANGE_THIS_STRONG_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-prod_db}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: redis-cache-prod
|
||||
environment:
|
||||
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-proxy-prod
|
||||
ports:
|
||||
- "${NGINX_HTTP_PORT:-80}:80"
|
||||
- "${NGINX_HTTPS_PORT:-443}:443"
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./nginx/ssl:/etc/nginx/ssl
|
||||
depends_on:
|
||||
- frontend
|
||||
- backend
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
@@ -1,44 +0,0 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: postgres-db
|
||||
ports:
|
||||
- "${POSTGRES_PORT:-5432}:5432"
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-turbo123}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-genome_db}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-user}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: redis-cache
|
||||
ports:
|
||||
- "${REDIS_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
@@ -1,45 +0,0 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
upstream frontend {
|
||||
server frontend:3000;
|
||||
}
|
||||
|
||||
upstream backend {
|
||||
server backend:4000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# Frontend routes
|
||||
location / {
|
||||
proxy_pass http://frontend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Backend API routes
|
||||
location /api/ {
|
||||
proxy_pass http://backend/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# WebSocket support for Next.js hot reload
|
||||
location /_next/webpack-hmr {
|
||||
proxy_pass http://frontend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
||||
}
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "next_nest_docker_template-main",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
||||
102
postgres/.env
102
postgres/.env
@@ -1,102 +0,0 @@
|
||||
# ==============================================
|
||||
# DEVELOPMENT ENVIRONMENT VARIABLES
|
||||
# ==============================================
|
||||
# Copy this file to .env.local for local development
|
||||
# DO NOT commit sensitive values to version control
|
||||
|
||||
# ==============================================
|
||||
# DATABASE CONFIGURATION
|
||||
# ==============================================
|
||||
DATABASE_URL=postgresql://user:password@localhost:5431/genome_db
|
||||
POSTGRES_HOST=localhost
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=turbo123
|
||||
POSTGRES_DB=postgres
|
||||
POSTGRES_PORT=5431
|
||||
POSTGRES_SYNCHRONIZE=true
|
||||
POSTGRES_LOGGING=true
|
||||
|
||||
# ==============================================
|
||||
# REDIS CONFIGURATION
|
||||
# ==============================================
|
||||
REDIS_URL=redis://localhost:6379
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=6379
|
||||
|
||||
# ==============================================
|
||||
# BACKEND CONFIGURATION
|
||||
# ==============================================
|
||||
BACKEND_PORT=4000
|
||||
NODE_ENV=development
|
||||
|
||||
# ==============================================
|
||||
# JWT AUTHENTICATION
|
||||
# ==============================================
|
||||
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
|
||||
JWT_EXPIRES_IN=24h
|
||||
JWT_REFRESH_SECRET=your-refresh-token-secret
|
||||
JWT_REFRESH_EXPIRES_IN=7d
|
||||
|
||||
# ==============================================
|
||||
# CORS CONFIGURATION
|
||||
# ==============================================
|
||||
CORS_ORIGIN=http://localhost:3000,http://192.168.11.249:3000,http://123.143.174.11:5243
|
||||
CORS_CREDENTIALS=true
|
||||
|
||||
# ==============================================
|
||||
# SECURITY SETTINGS
|
||||
# ==============================================
|
||||
RATE_LIMIT_WINDOW_MS=900000
|
||||
RATE_LIMIT_MAX_REQUESTS=100
|
||||
BCRYPT_SALT_ROUNDS=12
|
||||
|
||||
# ==============================================
|
||||
# FILE UPLOAD
|
||||
# ==============================================
|
||||
MAX_FILE_SIZE=10485760
|
||||
UPLOAD_DESTINATION=./uploads
|
||||
ALLOWED_FILE_TYPES=jpg,jpeg,png,gif,pdf,doc,docx
|
||||
|
||||
# ==============================================
|
||||
# EMAIL CONFIGURATION
|
||||
# ==============================================
|
||||
SMTP_HOST=smtp.gmail.com
|
||||
SMTP_PORT=587
|
||||
SMTP_SECURE=false
|
||||
SMTP_USER=your-email@gmail.com
|
||||
SMTP_PASS=your-app-password
|
||||
FROM_EMAIL=noreply@yourdomain.com
|
||||
|
||||
# ==============================================
|
||||
# LOGGING
|
||||
# ==============================================
|
||||
LOG_LEVEL=debug
|
||||
LOG_FORMAT=dev
|
||||
LOG_FILE_ENABLED=true
|
||||
LOG_FILE_PATH=./logs
|
||||
|
||||
# ==============================================
|
||||
# EXTERNAL SERVICES
|
||||
# ==============================================
|
||||
# AWS_ACCESS_KEY_ID=your-aws-access-key
|
||||
# AWS_SECRET_ACCESS_KEY=your-aws-secret
|
||||
# AWS_REGION=us-east-1
|
||||
# AWS_S3_BUCKET=your-bucket-name
|
||||
|
||||
# ==============================================
|
||||
# MONITORING
|
||||
# ==============================================
|
||||
# SENTRY_DSN=your-sentry-dsn
|
||||
# HEALTH_CHECK_ENABLED=true
|
||||
|
||||
# ==============================================
|
||||
# FRONTEND CONFIGURATION
|
||||
# ==============================================
|
||||
FRONTEND_PORT=3000
|
||||
NEXT_PUBLIC_API_URL=http://192.168.11.249:4000
|
||||
|
||||
# ==============================================
|
||||
# NGINX CONFIGURATION
|
||||
# ==============================================
|
||||
NGINX_HTTP_PORT=80
|
||||
NGINX_HTTPS_PORT=443
|
||||
@@ -1,47 +0,0 @@
|
||||
version: "1.0"
|
||||
# 개발 편의를 위한 옵션 폴더
|
||||
# 개발 편의성 (컨테이너 재빌드 안 함)
|
||||
# DB PostgreSQL, Redis만 Docker 컨테이너로 실행
|
||||
# Frontend/Backend는 로컬에서 직접 실행
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: postgres-db
|
||||
ports:
|
||||
- "${POSTGRES_PORT:-5431}:5432"
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-turbo123}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-genomic}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-user}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: redis-cache
|
||||
ports:
|
||||
- "${REDIS_PORT:-6379}:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user