-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Swagger 설정 및 모집글 API 문서화 완료 #48
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
e36a1b9
ad697d8
f52332b
2ce1c71
1b33836
afef84f
d20dc23
5235264
6765a49
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,3 @@ | ||
| /gradlew text eol=lf | ||
| *.bat text eol=crlf | ||
| *.jar binary |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,71 @@ | ||||||
| name: CI/CD for Spring Boot + MySQL with Docker Compose | ||||||
|
|
||||||
| on: | ||||||
| push: | ||||||
| branches: [ "main", "order-service/main" ] | ||||||
| pull_request: | ||||||
| branches: [ "main", "order-service/main" ] | ||||||
|
|
||||||
| env: | ||||||
| SERVICE_NAME: order-service # 예: order-service | ||||||
| DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:latest | ||||||
| EC2_HOST: ${{ secrets.EC2_HOST }} | ||||||
| EC2_SSH_USER: ec2-user | ||||||
| PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||||||
| TIMEZONE: Asia/Seoul | ||||||
| DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||||||
| DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||
| PROJECT_PATH: /home/ec2-user/delivery-system/order-service # 예: /home/ec2-user/delivery-system/order-service | ||||||
|
|
||||||
| jobs: | ||||||
| build-and-push: | ||||||
| runs-on: ubuntu-latest | ||||||
| environment: order-service | ||||||
|
|
||||||
| steps: | ||||||
| - name: Checkout | ||||||
| uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Set up JDK 21 | ||||||
| uses: actions/setup-java@v4 | ||||||
| with: | ||||||
| java-version: '21' | ||||||
| distribution: 'temurin' | ||||||
|
|
||||||
| - name: Grant execute permission for gradlew | ||||||
| run: chmod +x ${{ env.SERVICE_NAME }}/gradlew | ||||||
|
|
||||||
| - name: Build Spring Boot Application | ||||||
| working-directory: ${{ env.SERVICE_NAME }} | ||||||
| run: ./gradlew build | ||||||
|
|
||||||
| - name: Log in to Docker Hub | ||||||
| uses: docker/login-action@v2 | ||||||
| with: | ||||||
| username: ${{ env.DOCKER_USERNAME }} | ||||||
| password: ${{ env.DOCKER_TOKEN }} | ||||||
|
|
||||||
| - name: Build Docker Image | ||||||
| run: docker build -t ${{ env.DOCKER_IMAGE }} ./${{ env.SERVICE_NAME }} | ||||||
|
|
||||||
| - name: Push Docker Image | ||||||
| run: docker push ${{ env.DOCKER_IMAGE }} | ||||||
|
|
||||||
| deploy-to-ec2: | ||||||
| runs-on: ubuntu-latest | ||||||
| if: github.event_name == 'push' | ||||||
| needs: build-and-push | ||||||
| environment: order-service | ||||||
|
|
||||||
| steps: | ||||||
| - name: Deploy to EC2 via SSH | ||||||
| uses: appleboy/[email protected] | ||||||
|
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 SSH Action 버전을 최신으로 업데이트하세요. 현재 사용 중인 - uses: appleboy/[email protected]
+ uses: appleboy/[email protected]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| with: | ||||||
| host: ${{ env.EC2_HOST }} | ||||||
| username: ${{ env.EC2_SSH_USER }} | ||||||
| key: ${{ env.PRIVATE_KEY }} | ||||||
| script: | | ||||||
| cd ${{ env.PROJECT_PATH }} | ||||||
| sudo docker compose pull | ||||||
| sudo docker compose down | ||||||
| sudo docker compose up -d | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: CI/CD for Spring Boot + MySQL with Docker Compose | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main", "payment-service/main" ] | ||
| pull_request: | ||
| branches: [ "main", "payment-service/main" ] | ||
|
|
||
| env: | ||
| SERVICE_NAME: payment-service # 예: order-service | ||
| DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:latest | ||
| EC2_HOST: ${{ secrets.EC2_HOST }} | ||
| EC2_SSH_USER: ec2-user | ||
| PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||
| TIMEZONE: Asia/Seoul | ||
| DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| PROJECT_PATH: /home/ec2-user/delivery-system/payment-service # 예: /home/ec2-user/delivery-system/order-service | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| environment: payment-service | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x ${{ env.SERVICE_NAME }}/gradlew | ||
|
|
||
| - name: Build Spring Boot Application | ||
| working-directory: ${{ env.SERVICE_NAME }} | ||
| run: ./gradlew build | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ env.DOCKER_USERNAME }} | ||
| password: ${{ env.DOCKER_TOKEN }} | ||
|
|
||
| - name: Build Docker Image | ||
| run: docker build -t ${{ env.DOCKER_IMAGE }} ./${{ env.SERVICE_NAME }} | ||
|
|
||
| - name: Push Docker Image | ||
| run: docker push ${{ env.DOCKER_IMAGE }} | ||
|
|
||
| deploy-to-ec2: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' | ||
| needs: build-and-push | ||
| environment: payment-service | ||
|
|
||
| steps: | ||
| - name: Deploy to EC2 via SSH | ||
| uses: appleboy/[email protected] | ||
| with: | ||
| host: ${{ env.EC2_HOST }} | ||
| username: ${{ env.EC2_SSH_USER }} | ||
| key: ${{ env.PRIVATE_KEY }} | ||
| script: | | ||
| cd ${{ env.PROJECT_PATH }} | ||
| sudo docker compose pull | ||
| sudo docker compose down | ||
| sudo docker compose up -d |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: CI/CD for Spring Boot + MySQL with Docker Compose | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main", "recruitment-service/main" ] | ||
| pull_request: | ||
| branches: [ "main", "recruitment-service/main" ] | ||
|
|
||
| env: | ||
| SERVICE_NAME: recruitment-service # 예: order-service | ||
| DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:latest | ||
| EC2_HOST: ${{ secrets.EC2_HOST }} | ||
| EC2_SSH_USER: ec2-user | ||
|
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. EC2 사용자와 프로젝트 경로 불일치 문제
- EC2_SSH_USER: ec2-user
+ EC2_SSH_USER: kmj02devAlso applies to: 18-18 🤖 Prompt for AI Agents |
||
| PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||
| TIMEZONE: Asia/Seoul | ||
| DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| PROJECT_PATH: /home/kmj02dev/delivery-system/recruitment-service # 예: /home/ec2-user/delivery-system/order-service | ||
| APPLICATION: ${{ secrets.APPLICATION }} | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| environment: recruitment-service | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Set up application.properties | ||
| run : | | ||
| mkdir -p "${{ env.SERVICE_NAME }}"/src/main/resources | ||
| echo "${{ env.APPLICATION }}" > "${{ env.SERVICE_NAME }}/src/main/resources/application.properties" | ||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x ${{ env.SERVICE_NAME }}/gradlew | ||
|
|
||
| - name: Build Spring Boot Application | ||
| working-directory: ${{ env.SERVICE_NAME }} | ||
| run: ./gradlew build | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ env.DOCKER_USERNAME }} | ||
| password: ${{ env.DOCKER_TOKEN }} | ||
|
|
||
| - name: Build Docker Image | ||
| run: docker build -t ${{ env.DOCKER_IMAGE }} ./${{ env.SERVICE_NAME }} | ||
|
|
||
| - name: Push Docker Image | ||
| run: docker push ${{ env.DOCKER_IMAGE }} | ||
|
|
||
| deploy-to-ec2: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' | ||
| needs: build-and-push | ||
| environment: recruitment-service | ||
|
|
||
| steps: | ||
| - name: Deploy to EC2 via SSH | ||
| uses: appleboy/[email protected] | ||
| with: | ||
| host: ${{ env.EC2_HOST }} | ||
| username: ${{ env.EC2_SSH_USER }} | ||
| key: ${{ env.PRIVATE_KEY }} | ||
| script: | | ||
| cd ${{ env.PROJECT_PATH }} | ||
| sudo docker compose pull | ||
| sudo docker compose down | ||
| sudo docker compose up -d | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: CI/CD for Spring Boot + MySQL with Docker Compose | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main", "store-service/main" ] | ||
| pull_request: | ||
| branches: [ "main", "store-service/main" ] | ||
|
|
||
| env: | ||
| SERVICE_NAME: store-service # 예: order-service | ||
| DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:latest | ||
| EC2_HOST: ${{ secrets.EC2_HOST }} | ||
| EC2_SSH_USER: ec2-user | ||
| PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||
| TIMEZONE: Asia/Seoul | ||
| DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| PROJECT_PATH: /home/ec2-user/delivery-system/store-service # 예: /home/ec2-user/delivery-system/order-service | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| environment: store-service | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x ${{ env.SERVICE_NAME }}/gradlew | ||
|
|
||
| - name: Build Spring Boot Application | ||
| working-directory: ${{ env.SERVICE_NAME }} | ||
| run: ./gradlew build | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ env.DOCKER_USERNAME }} | ||
| password: ${{ env.DOCKER_TOKEN }} | ||
|
|
||
| - name: Build Docker Image | ||
| run: docker build -t ${{ env.DOCKER_IMAGE }} ./${{ env.SERVICE_NAME }} | ||
|
|
||
| - name: Push Docker Image | ||
| run: docker push ${{ env.DOCKER_IMAGE }} | ||
|
|
||
| deploy-to-ec2: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' | ||
| needs: build-and-push | ||
| environment: store-service | ||
|
|
||
| steps: | ||
| - name: Deploy to EC2 via SSH | ||
| uses: appleboy/[email protected] | ||
| with: | ||
| host: ${{ env.EC2_HOST }} | ||
| username: ${{ env.EC2_SSH_USER }} | ||
| key: ${{ env.PRIVATE_KEY }} | ||
| script: | | ||
| cd ${{ env.PROJECT_PATH }} | ||
| sudo docker compose pull | ||
| sudo docker compose down | ||
| sudo docker compose up -d |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: CI/CD for Spring Boot + MySQL with Docker Compose | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main", "user-service/main" ] | ||
| pull_request: | ||
| branches: [ "main", "user-service/main" ] | ||
|
|
||
| env: | ||
| SERVICE_NAME: user-service # 예: order-service | ||
| DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:latest | ||
| EC2_HOST: ${{ secrets.EC2_HOST }} | ||
| EC2_SSH_USER: ec2-user | ||
| PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||
| TIMEZONE: Asia/Seoul | ||
| DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| PROJECT_PATH: /home/ec2-user/delivery-system/user-service # 예: /home/ec2-user/delivery-system/order-service | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-latest | ||
| environment: user-service | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x ${{ env.SERVICE_NAME }}/gradlew | ||
|
|
||
| - name: Build Spring Boot Application | ||
| working-directory: ${{ env.SERVICE_NAME }} | ||
| run: ./gradlew build | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ env.DOCKER_USERNAME }} | ||
| password: ${{ env.DOCKER_TOKEN }} | ||
|
|
||
| - name: Build Docker Image | ||
| run: docker build -t ${{ env.DOCKER_IMAGE }} ./${{ env.SERVICE_NAME }} | ||
|
|
||
| - name: Push Docker Image | ||
| run: docker push ${{ env.DOCKER_IMAGE }} | ||
|
|
||
| deploy-to-ec2: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' | ||
| needs: build-and-push | ||
| environment: user-service | ||
|
|
||
| steps: | ||
| - name: Deploy to EC2 via SSH | ||
| uses: appleboy/[email protected] | ||
| with: | ||
| host: ${{ env.EC2_HOST }} | ||
| username: ${{ env.EC2_SSH_USER }} | ||
| key: ${{ env.PRIVATE_KEY }} | ||
| script: | | ||
| cd ${{ env.PROJECT_PATH }} | ||
| sudo docker compose pull | ||
| sudo docker compose down | ||
| sudo docker compose up -d |
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.
EC2_SSH_USER와 PROJECT_PATH 간 불일치
EC2_SSH_USER를kmj02dev로 변경했으나,PROJECT_PATH에/home/ec2-user/...가 남아 있습니다. SSH 사용자와 디렉토리 경로가 다르면 배포 실패로 이어지니, 아래처럼 수정하세요.🤖 Prompt for AI Agents