diff --git a/deployment_guide.md b/deployment_guide.md index 137b90c..3676829 100644 --- a/deployment_guide.md +++ b/deployment_guide.md @@ -12,14 +12,50 @@ kubectl create namespace etri-aisw ``` -### 1-2. ECR 이미지 푸시 -빌드된 이미지를 AWS ECR 레포지토리에 푸시합니다. -- **Server**: `{AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/autoflow-server:latest` -- **Web**: `{AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/autoflow-web:latest` +### 1-2. ECR 로그인 +이미지를 푸시하기 위해 ECR에 로그인합니다. +```bash +aws ecr get-login-password --region {REGION} | docker login --username AWS --password-stdin {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com +``` + +--- + +## 2. Docker 이미지 빌드 및 ECR 푸시 + +### 2-1. 서버(Spring Boot) 이미지 빌드 +```bash +cd autoflow-server-mgmt + +# JAR 파일 빌드 +./gradlew bootJar + +# Docker 이미지 빌드 +docker build -t autoflow-server:latest . + +# ECR 태그 및 푸시 +docker tag autoflow-server:latest {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/autoflow-server:latest +docker push {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/autoflow-server:latest +``` + +### 2-2. 웹 콘솔(Vue.js) 이미지 빌드 +```bash +cd ../autoflow-web-console + +# 정적 파일 빌드 +npm install +npm run build + +# Docker 이미지 빌드 +docker build -t autoflow-web:latest . + +# ECR 태그 및 푸시 +docker tag autoflow-web:latest {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/autoflow-web:latest +docker push {AWS_ACCOUNT_ID}.dkr.ecr.{REGION}.amazonaws.com/autoflow-web:latest +``` --- -## 2. 매니페스트 파일 수정 +## 3. 매니페스트 파일 수정 배포 전 `kubernetes-aws.yaml` 파일의 아래 항목들을 실제 환경에 맞게 수정해야 합니다. @@ -34,7 +70,7 @@ Ingress 리소스의 `annotations` 섹션에서 다음 값을 수정합니다. --- -## 3. 리소스 배포 절차 +## 4. 리소스 배포 절차 ### 단계 1: MariaDB 초기화 SQL 배포 데이터베이스 스키마 자동 생성을 위해 ConfigMap을 먼저 배포합니다. @@ -57,7 +93,7 @@ kubectl apply -f kubernetes-aws.yaml --- -## 4. 배포 확인 및 검증 +## 5. 배포 확인 및 검증 ### 4-1. Pod 상태 확인 모든 Pod가 `Running` 상태인지 확인합니다. @@ -79,7 +115,7 @@ kubectl logs -n etri-aisw -l app=mariadb --- -## 5. 문제 해결 (Troubleshooting) +## 6. 문제 해결 (Troubleshooting) - **Pod Pending**: `cpu` 노드 그룹의 자원이 부족하거나 `nodeSelector`가 일치하지 않는지 확인하세요. - **ImagePullBackOff**: ECR 접근 권한(IAM Role) 또는 이미지 경로를 확인하세요. diff --git a/src/main/resources/application-aws.properties b/src/main/resources/application-aws.properties index bce0d70..593465f 100644 --- a/src/main/resources/application-aws.properties +++ b/src/main/resources/application-aws.properties @@ -2,31 +2,27 @@ server.port = 8080 server.servlet.context-path=/autoflow-server-mgmt -spring.profiles.active=prod - -# RDS MariaDB Configuration -# Replace with your RDS endpoint -spring.datasource.url=jdbc:mariadb://${RDS_HOSTNAME}:3306/autoflow +# MariaDB Configuration (K8s 내부 서비스 연결) +# RDS가 아닌 K8s 내부 MariaDB Pod를 바라보도록 설정 +spring.datasource.url=jdbc:mariadb://${DB_HOST:mariadb}:3306/${DB_NAME:appdb} spring.datasource.driver-class-name=org.mariadb.jdbc.Driver -spring.datasource.username=${RDS_USERNAME} -spring.datasource.password=${RDS_PASSWORD} +spring.datasource.username=${DB_USERNAME:appuser} +spring.datasource.password=${DB_PASSWORD:etriuser} spring.jpa.database-platform=org.hibernate.dialect.MariaDBDialect +# 개발 초기라면 update, 운영 초기라면 none 또는 validate 권장 spring.jpa.hibernate.ddl-auto=none spring.sql.init.mode=never -# App Properties (JWT) - Should be injected via env variables in K8s +# App Properties (JWT) cuuva.app.jwtCookieName=cuuva-jwt cuuva.app.jwtRefreshCookieName=cuuva-jwt-refresh cuuva.app.jwtSecret=${JWT_SECRET} # Storage Provider (S3) -storage.provider=s3 +storage.provider=minio cloud.aws.region.static=ap-northeast-2 cloud.aws.s3.bucket=${S3_BUCKET_NAME} -# IAM Role should be used instead of hardcoded keys in EKS -# cloud.aws.credentials.access-key=${AWS_ACCESS_KEY} -# cloud.aws.credentials.secret-key=${AWS_SECRET_KEY} # Swagger UI springdoc.swagger-ui.path=/swagger-ui @@ -40,4 +36,4 @@ spring.servlet.multipart.max-file-size=500MB spring.servlet.multipart.max-request-size=500MB # ALB / Forwarded Headers -server.forward-headers-strategy=native +server.forward-headers-strategy=native \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f7f8117..200bef0 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ #????? ?? ?? server.port = 8080 -spring.profiles.active=local +spring.profiles.active=aws spring.datasource.url=jdbc:mariadb://192.168.10.143:3306/autoflow spring.datasource.driver-class-name=org.mariadb.jdbc.Driver