Skip to content
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

v0.0.2 #110

Merged
merged 54 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
eec192e
chore: ν”„λ‘œμ νŠΈ μ„ΈνŒ… (#2)
char-yb Jun 21, 2024
7faa099
chore: develop PR on check workflow μž‘μ„± (#7)
char-yb Jun 22, 2024
483587d
chore: Spring Actuator ꡬ성 (#8)
char-yb Jun 24, 2024
44c8b26
chore: domain ꡬ쑰 μ•„ν‚€ν…μ²˜ ꡬ성 (#12)
char-yb Jun 24, 2024
4d775ee
chore: SwaggerConfig μž‘μ„± (#14)
dbscks97 Jun 25, 2024
2c31cf2
[WALWAL-104] Spotless ꡬ성 (#19)
char-yb Jun 26, 2024
a1b6c7b
[WALWAL-84] jacoco μ„ΈνŒ… μΆ”κ°€ (#16)
kwanok Jun 26, 2024
d661af7
feat: BaseTimeEntity μΆ”κ°€ (#22)
char-yb Jun 27, 2024
9456468
[WALWAL-88] νšŒμ› μ—”ν‹°ν‹° ꡬ성 (#26)
char-yb Jun 29, 2024
2adb3a6
[WALWAL-108] Querydsl ν™˜κ²½ ꡬ성 (#25)
char-yb Jun 30, 2024
73109c5
[WALWAL-114] record -> class λ³€κ²½ (#30)
char-yb Jul 1, 2024
9a44f91
[WALWAL-109] GlobalResponseλ₯Ό μœ„ν•œ RestControllerAdvice μ„ΈνŒ… (#23)
dbscks97 Jul 2, 2024
de11220
[WALWAL-115] λ―Έμ…˜ μ—”ν‹°ν‹° κ΅¬ν˜„ (#32)
kwanok Jul 2, 2024
de6fb08
[WALWAL-106] fixtureMonkey λ„μž… (#28)
char-yb Jul 4, 2024
6455fd5
chore: redis ν™˜κ²½ ꡬ성 (#37)
char-yb Jul 4, 2024
4ef0dd0
[WALWAL-113] SecurityConfig 및 μœ ν‹Έλ¦¬ν‹° κ΅¬ν˜„ (#35)
char-yb Jul 4, 2024
ac14bd3
[WALWAL-116] λ―Έμ…˜ 기둝 μ—”ν‹°ν‹° κ΅¬ν˜„ (#34)
dbscks97 Jul 4, 2024
3794549
[WALWAL-110] elastic beanstalk dev μ„œλ²„ workflow μž‘μ„± (#38)
char-yb Jul 7, 2024
8a24289
hotfix: Elastic BeanStalk 배포 version Label (#41)
char-yb Jul 7, 2024
172f8d9
[WALWAL-132] application yml 뢄리 (#42)
char-yb Jul 9, 2024
15af8c2
[WALWAL-135] missionrecord crud κ΅¬ν˜„ (#46)
dbscks97 Jul 17, 2024
b0fb235
[WALWAL-138]: mission crud κ΅¬ν˜„ (#45)
kwanok Jul 17, 2024
b5b7878
[WALWAL-142] EB docker-compose ꡬ성 (#50)
char-yb Jul 22, 2024
dec1911
[WALWAL-81] μ• ν”Œ 둜그인 κ΅¬ν˜„ (#47)
char-yb Jul 24, 2024
553c7d6
[WALWAL-148] Dev, Prod ν™˜κ²½ 뢄리 (#56)
char-yb Jul 26, 2024
90c9324
[WALWAL-145] missionrecord calendarview (#52)
dbscks97 Jul 28, 2024
0103af0
[WALWAL-122] 이미지 μ—…λ‘œλ“œ κΈ°λŠ₯ (#58)
char-yb Jul 28, 2024
5bdf621
[WALWAL-152] register Request Body λΆˆν•„μš”ν•œ ν•„λ“œ μ‚­μ œ (#62)
char-yb Jul 30, 2024
7bde970
[WALWAL-147] 였늘의 λ―Έμ…˜ API μΆ”κ°€ (#53)
kwanok Jul 30, 2024
6a46372
[WALWAL-153] λ―Έμ…˜ n번째 카운트 κΈ°λŠ₯ μΆ”κ°€ (#64)
char-yb Jul 31, 2024
7a63ac7
[WALWAL-150] missionrecord imageupload κΈ°λŠ₯ κ΅¬ν˜„ (#66)
dbscks97 Aug 3, 2024
c5fcc62
[WALWAL-151] λ°μΌλ¦¬λ―Έμ…˜ 일러슀트, μ»¬λŸ¬κ°’ μΆ”κ°€ (#71)
dbscks97 Aug 3, 2024
4da14be
[WALWAL-155] 카카였 둜그인/νšŒμ›κ°€μž… κ΅¬ν˜„ (#68)
char-yb Aug 3, 2024
cda0895
fix: μž„μ‹œ 토큰 μ—¬λΆ€ νŒλ³„ (#74)
char-yb Aug 3, 2024
7520139
[WALWAL-163] 배포 ν™˜κ²½ λ©”λͺ¨λ¦¬ μ œν•œ (#77)
kwanok Aug 3, 2024
a43ca00
[WALWAL-160] λ―Έμ…˜ μ‹œμž‘ μ‹œ λ™μ‹œμ„± 문제 κ°œμ„  (#75)
kwanok Aug 3, 2024
8e58a9d
[WALWAL-157] νšŒμ›νƒˆν‡΄ API (#82)
char-yb Aug 3, 2024
fec776a
[WALWAL-154] PROD 운영 μ„œλ²„ μ›Œν¬ν”Œλ‘œ μž‘μ„± (#85)
char-yb Aug 3, 2024
5674906
hotfix: EC2 도컀 단일 μΈμŠ€ν„΄μŠ€ 배포 (#90)
char-yb Aug 5, 2024
7048812
feat: push branchs develop으둜 λ³€κ²½
char-yb Aug 5, 2024
82753b0
[WALWAL-156] νŒ”λ‘œμš° μΆ”κ°€ 및 μ·¨μ†Œ, 쑰회 κΈ°λŠ₯ (#86)
char-yb Aug 6, 2024
af5d5e9
[WALWAL-164] λ‹‰λ„€μž„ 검증 (#81)
char-yb Aug 6, 2024
eadef4b
[WALWAL-167] Mission Response 및 API PathVariable μˆ˜μ • (#91)
dbscks97 Aug 6, 2024
da90ace
[WALWAL-163] μŠ€μ›¨κ±° λ¬Έμ„œ 이름 μΌκ΄€μ μœΌλ‘œ ν¬λ§€νŒ… (#79)
kwanok Aug 7, 2024
aa6ca24
test: SecurityUtil ν…ŒμŠ€νŠΈ μ½”λ“œ μΆ”κ°€ (#99)
char-yb Aug 9, 2024
17f3f40
test: RefreshToken ν…ŒμŠ€νŠΈ (#100)
char-yb Aug 9, 2024
a3f9d90
fix: μ˜¨λ³΄λ”© Default imageUrl μš”μ²­ ν•„λ“œ μΆ”κ°€ (#101)
char-yb Aug 9, 2024
89a603a
[WALWAL-165] FCM ν‘Έμ‹œ μ•Œλ¦Ό κΈ°λŠ₯ κ΅¬ν˜„ (#92)
dbscks97 Aug 9, 2024
46409a3
[WALWAL-168] MissionRecord에 Textκ°’ μΆ”κ°€ (#103)
dbscks97 Aug 9, 2024
08c5ba2
[WALWAL-149] Auth, Member ν…ŒμŠ€νŠΈ μ½”λ“œ μž‘μ„± (#93)
char-yb Aug 10, 2024
373c891
test: MemberUtil ν…ŒμŠ€νŠΈ μ½”λ“œ μΆ”κ°€ (#98)
char-yb Aug 10, 2024
7d63db6
chore: prod workflow μž‘μ„± (#108)
char-yb Aug 11, 2024
c2a2b26
fix: conflict ν•΄κ²°
char-yb Aug 11, 2024
d2b280a
fix: test docker compose μˆ˜μ •
char-yb Aug 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 73 additions & 43 deletions .github/workflows/develop-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
java-version: [ 17 ]
distribution: [ 'zulu' ]
distribution: [ 'temurin' ]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -26,6 +26,10 @@ jobs:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.distribution }}

# test ν™œμš© λͺ©μ μ˜ container μ‹€ν–‰
- name: Start test docker container
run: docker compose -f ./docker-compose-test.yaml up -d

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

Expand All @@ -38,53 +42,79 @@ jobs:
--scan
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

# Docker 이미지 λΉŒλ“œ 및 도컀 ν—ˆλΈŒ ν‘Έμ‹œ
- name: Docker build & push
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }} .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }}
# Dockerhub 둜그인
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker 메타데이터 μΆ”μΆœ
- name: Extract Docker metadata
id: metadata
uses: docker/[email protected]
env:
DOCKERHUB_IMAGE_FULL_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }}
with:
images: ${{ env.DOCKERHUB_IMAGE_FULL_NAME }}
tags: |
type=sha,prefix=

- name: Current Time
uses: gerred/[email protected]
id: current-time
# Docker 이미지 λΉŒλ“œ 및 λ„μ»€ν—ˆλΈŒλ‘œ ν‘Έμ‹œ
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.metadata.outputs.tags }}

- name: Replace string
uses: frabert/[email protected]
id: format-time
# μ„œλ²„λ‘œ docker-compose 파일 전솑
- name: Copy docker-compose file to EC2
uses: burnett01/[email protected]
with:
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: '-'
flags: 'g'
switches: -avzr --delete
remote_host: ${{ secrets.EC2_HOST }}
remote_user: ${{ secrets.EC2_USERNAME }}
remote_key: ${{ secrets.EC2_PRIVATE_KEY }}
path: docker-compose.yaml
remote_path: /home/ec2-user/

- name: Prepare deployment package
run: |
zip -r deployment-package.zip docker-compose.yaml nginx/default.conf
- name: Copy default.conf to EC2
uses: burnett01/[email protected]
with:
switches: -avzr --delete
remote_host: ${{ secrets.EC2_HOST }}
remote_user: ${{ secrets.EC2_USERNAME }}
remote_key: ${{ secrets.EC2_PRIVATE_KEY }}
path: ./nginx
remote_path: /home/ec2-user/

- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v22
# EC2둜 배포
- name: Deploy to EC2 Server
uses: appleboy/[email protected]
env:
IMAGE_FULL_URL: ${{ steps.metadata.outputs.tags }}
DOCKERHUB_IMAGE_NAME: ${{ env.DOCKERHUB_IMAGE_NAME }}
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
existing_bucket_name: "walwal-server-dev-deployment"
application_name: "walwal-dev"
environment_name: "Walwal-dev-env"
version_label: "walwal-dev-${{ steps.format-time.outputs.replaced }}"
region: ap-northeast-2
deployment_package: deployment-package.zip
wait_for_environment_recovery: 180
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
envs: IMAGE_FULL_URL, DOCKERHUB_IMAGE_NAME # docker-compose.yml μ—μ„œ μ‚¬μš©ν•  ν™˜κ²½ λ³€μˆ˜
debug: true
script: |
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
docker compose up -d
docker exec -d nginx nginx -s reload
docker image prune -a -f

# Slack μ•Œλ¦Ό
- name: Send Deploy Result to Slack
uses: rtCamp/action-slack-notify@v2
## Slack
- name: Slack Alarm
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: GitHub-Actions CI/CD
fields: repo,message,commit,author,ref,job,took
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_USERNAME: μ™ˆμ™ˆλ΄‡
SLACK_COLOR: ${{ job.status == 'success' && 'good' || 'danger' }}
SLACK_TITLE: "Deploy Summary - Develop"
SLACK_MESSAGE: |
- image tag: `${{ steps.metadata.outputs.tags }}`
- build scan report: ${{ steps.gradle.outputs.build-scan-url }}
- deploy status: ${{ job.status }}
- deploy time: ${{ steps.current-time.outputs.time }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.

6 changes: 5 additions & 1 deletion .github/workflows/develop-pull-request-on-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'
distribution: 'adopt'

# test ν™œμš© λͺ©μ μ˜ container μ‹€ν–‰
- name: Start test docker container
run: docker compose -f ./docker-compose-test.yaml up -d

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
Expand Down
126 changes: 73 additions & 53 deletions .github/workflows/production-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:
tags:
- v*.*.*

permissions:
id-token: write
contents: read

env:
DOCKERHUB_IMAGE_NAME: walwal-server
DOCKERHUB_IMAGE_FULL_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/walwal-server

jobs:
build-deploy:
Expand All @@ -17,15 +20,19 @@ jobs:
matrix:
java-version: [ 17 ]
distribution: [ 'temurin' ]

steps:
# κΈ°λ³Έ 체크아웃
# 체크아웃
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# JDKλ₯Ό 17 λ²„μ „μœΌλ‘œ μ„ΈνŒ…
# Docker 이미지 νƒœκ·Έ μ„ΈνŒ…
- name: Set up image-tag by GITHUB_SHA
id: image-tag
run: echo "value=$(cut -d'v' -f2 <<< ${GITHUB_REF#refs/*/})" >> $GITHUB_OUTPUT

# JDK 17 λ²„μ „μœΌλ‘œ μ„ΈνŒ…
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.distribution }}
Expand All @@ -34,15 +41,24 @@ jobs:
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew

# Redis μ»¨ν…Œμ΄λ„ˆ μ‹€ν–‰
- name: Start containers
run: docker compose -f ./docker-compose-test.yaml up -d

# Gradle λΉŒλ“œ
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} # feature λΈŒλžœμΉ˜λŠ” μΊμ‹œλ₯Ό 읽기 μ „μš©μœΌλ‘œ μ„€μ •
cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
add-job-summary-as-pr-comment: always
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"

- name: Build with Gradle
id: gradle
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
--scan
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}
run: ./gradlew build --configuration-cache

# Dockerhub 둜그인
- name: Login to Dockerhub
Expand All @@ -55,6 +71,8 @@ jobs:
- name: Extract Docker metadata
id: metadata
uses: docker/[email protected]
env:
DOCKERHUB_IMAGE_FULL_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }}
with:
images: ${{ env.DOCKERHUB_IMAGE_FULL_NAME }}
tags: |
Expand All @@ -70,55 +88,57 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Docker 이미지 λΉŒλ“œ 및 λ„μ»€ν—ˆλΈŒλ‘œ ν‘Έμ‹œ
# 이미지 λΉŒλ“œ 및 Dockerhub에 ν‘Έμ‹œ
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64/v8
platforms: linux/arm64
push: true
tags: ${{ steps.metadata.outputs.tags }}

- name: Current Time
uses: gerred/[email protected]
id: current-time
tags: ${{ secrets.DOCKERHUB_USERNAME }}/walwal-server:${{ steps.image-tag.outputs.value }}

- name: Replace string
uses: frabert/[email protected]
id: format-time
# AWS 둜그인
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: '-'
flags: 'g'
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ap-northeast-2
output-config: true

# 볡사 경둜 ν™˜κ²½λ³€μˆ˜ μ„€μ •
- name: Set up S3 copy path
env:
S3_DEPLOY_BUCKET_NAME: ${{ secrets.S3_DEPLOY_BUCKET_NAME }}
run: echo "S3_COPY_PATH=$(echo s3://${S3_DEPLOY_BUCKET_NAME}/walwal-prod/docker-compose.yaml)" >> $GITHUB_ENV

- name: Prepare deployment package
run: |
zip -r deployment-package.zip docker-compose.yaml nginx/default.conf
# S3둜 docker-compose 파일 전솑
- name: Copy docker-compose file to S3
run: aws s3 cp docker-compose.yaml ${{ env.S3_COPY_PATH }}

- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v22
- name: Deploy to EC2 Server
uses: appleboy/ssh-action@master
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
IMAGE_FULL_URL: ${{ steps.metadata.outputs.tags }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
envs: IMAGE_FULL_URL # docker-compose.yaml μ—μ„œ μ‚¬μš©ν•  ν™˜κ²½ λ³€μˆ˜
script: |
aws s3 cp ${{ env.S3_COPY_PATH }} docker-compose.yaml
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
docker pull ${{ env.IMAGE_FULL_URL }}
docker compose up -d
docker image prune -a -f

## Slack
- name: Slack Alarm
uses: 8398a7/action-slack@v3
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
existing_bucket_name: "walwal-server-prod-deployment"
application_name: "walwal-prod"
environment_name: "Walwal-prod-env"
version_label: "walwal-prod-${{ steps.format-time.outputs.replaced }}"
region: ap-northeast-2
deployment_package: deployment-package.zip
wait_for_environment_recovery: 180

# Slack μ•Œλ¦Ό
- name: Send Deploy Result to Slack
uses: rtCamp/action-slack-notify@v2
status: ${{ job.status }}
author_name: GitHub-Actions CI/CD
fields: repo,message,commit,author,ref,job,took
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_USERNAME: μ™ˆμ™ˆλ΄‡
SLACK_COLOR: ${{ job.status == 'success' && 'good' || 'danger' }}
SLACK_TITLE: "Deploy Summary - Production"
SLACK_MESSAGE: |
- image tag: `${{ steps.metadata.outputs.tags }}`
- build scan report: ${{ steps.gradle.outputs.build-scan-url }}
- deploy status: ${{ job.status }}
- deploy time: ${{ steps.current-time.outputs.time }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
if: always() # Pick up events even if the job fails or is canceled.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM azul/zulu-openjdk:17-latest
FROM eclipse-temurin:17
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'

// Actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'
Expand Down Expand Up @@ -77,6 +78,10 @@ dependencies {
testAnnotationProcessor 'org.projectlombok:lombok'
// FixtureMonkey
testImplementation("com.navercorp.fixturemonkey:fixture-monkey-starter:1.0.20")

// FCM
implementation 'com.google.firebase:firebase-admin:9.3.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.16.1'
}

tasks.named('test') {
Expand Down
9 changes: 9 additions & 0 deletions docker-compose-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.8"

services:
redis:
image: "redis:alpine"
ports:
- "6379:6379"
environment:
- TZ=Asia/Seoul
Loading
Loading