-
Notifications
You must be signed in to change notification settings - Fork 0
[DEPLOY] ECS+Fargate 기반 Ci Cd 구축 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: CD | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to Amazon ECR | ||
| uses: aws-actions/amazon-ecr-login@v2 | ||
|
|
||
| - name: Build Docker image | ||
| run: | | ||
| docker build -t focussu-backend:latest ./backend | ||
| docker tag focussu-backend:latest ${{ secrets.ECR_REPO_URI }}:latest | ||
|
|
||
| - name: Push Docker image | ||
| run: docker push ${{ secrets.ECR_REPO_URI }}:latest | ||
|
|
||
| - name: Run deploy script | ||
| run: bash ./deploy/deploy-prod.sh | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| AWS_DEFAULT_REGION: ap-northeast-2 | ||
| BACKEND_IMAGE: ${{ secrets.ECR_REPO_URI }}:latest | ||
| SPRING_PROFILES_ACTIVE: prod | ||
| RDS_ENDPOINT: ${{ secrets.RDS_ENDPOINT }} | ||
| RDS_PORT: ${{ secrets.RDS_PORT }} | ||
| RDS_DATABASE: ${{ secrets.RDS_DATABASE }} | ||
| RDS_USER: ${{ secrets.RDS_USER }} | ||
| RDS_PASSWORD: ${{ secrets.RDS_PASSWORD }} | ||
| KAFKA_BOOTSTRAP_SERVERS: ${{ secrets.KAFKA_BOOTSTRAP_SERVERS }} | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| build-only: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./backend | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: 17 | ||
| distribution: temurin | ||
|
|
||
| - name: Grant execute permission to Gradle wrapper | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: Build without tests | ||
| run: ./gradlew build -x test --no-daemon |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,16 @@ | ||
| # src/main/resources/application-dev.yml | ||
|
|
||
| server: | ||
| port: 8080 | ||
| port: 80 | ||
|
|
||
| spring: | ||
| config: | ||
| import: optional:classpath:application-secret.yml | ||
|
|
||
| application: | ||
| name: focussu-backend | ||
|
|
||
| datasource: | ||
| url: jdbc:mysql://focussu-mysql:3306/focussu-db?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true | ||
| username: admin | ||
| password: wlqwndgo1! | ||
|
Comment on lines
+12
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 평문 비밀번호 노출 주의 |
||
| driver-class-name: com.mysql.cj.jdbc.Driver | ||
|
|
||
| jpa: | ||
|
|
@@ -31,14 +32,14 @@ spring: | |
| listener: | ||
| missing-topics-fatal: false | ||
|
|
||
| data: | ||
| redis: | ||
| port: 6379 | ||
| host: redis | ||
|
|
||
| springdoc: | ||
| default-produces-media-type: application/json | ||
| api-docs: | ||
| resolve-schema-properties: true | ||
| swagger-ui: | ||
| path: /docs | ||
|
|
||
| security: | ||
| jwt: | ||
| secret-key: de740246db0e808088253b1bbd8afb062dfcf5e661f20cb41cc7283366d1d8fcccbdbacf3ef8af9ac7159c9ac3a4302fc2321dba0d510a5695a62dd9728ea1ade417542d25e6d80312bc66b13852621f3be0a0188c9e122fedb30186455a4ee2f6ad6bf6daac10db65e9386f3bdf099bee7a18f2e1ef572ab212d7c3a87248d5f1e55243559adfc539df7a2d9110840a825ef27d14899ce630eed7e5366485b642d0f516f468b20af3a6bd67051f00be7a27f122c785f80091bcff6e510330a6f3f30629397a4439281559647cd9c6922d560fd2bd158b527357ff01377eb5333ea9e77f48908b9f96781eaa0fc5f67e7fa4d54d6088ef26c61e43ffb647412b | ||
| expiration-time: 86400 | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # src/main/resources/application-prod.yml | ||
|
|
||
| spring: | ||
| config: | ||
| import: optional:application-secret.yml | ||
|
Comment on lines
+3
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 시크릿 파일 import 경로 일관성 |
||
|
|
||
| application: | ||
| name: focussu-backend | ||
|
|
||
| datasource: | ||
| url: jdbc:mysql://${RDS_ENDPOINT}:${RDS_PORT}/${RDS_DATABASE}?serverTimezone=UTC | ||
| driver-class-name: com.mysql.cj.jdbc.Driver | ||
|
|
||
| jpa: | ||
| hibernate: | ||
| ddl-auto: none | ||
| show-sql: false | ||
| properties: | ||
| hibernate: | ||
| dialect: org.hibernate.dialect.MySQL8Dialect | ||
|
|
||
| kafka: | ||
| bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS} | ||
| properties: | ||
| security.protocol: SSL | ||
|
|
||
|
Comment on lines
+22
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kafka 설정 환경 변수 누락 |
||
| server: | ||
| port: 80 | ||
|
|
||
| springdoc: | ||
| default-produces-media-type: application/json | ||
| api-docs: | ||
| resolve-schema-properties: true | ||
| swagger-ui: | ||
| path: /docs | ||
|
|
||
| security: | ||
| jwt: | ||
| secret-key: ${JWT_SECRET_KEY} | ||
| expiration-time: ${JWT_EXPIRATION_TIME} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # src/main/resources/application.yml | ||
|
|
||
| spring: | ||
| profiles: | ||
| active: prod | ||
| config: | ||
| import: optional:classpath:application-secret.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Base 엔터티에 @Setter 추가는 재고해 볼 필요가 있습니다
BaseEntity에@Setter어노테이션을 추가하면 감사(audit) 필드와 같은 중요 필드에 무분별한 접근이 가능해져 데이터 무결성에 위험을 초래할 수 있습니다.다음과 같은 접근 방식을 고려해보세요:
createdAt,updatedAt)는 불변으로 유지isDeleted필드는 전용 메서드(예:markAsDeleted())를 통해서만 변경 가능하도록 제한📝 Committable suggestion