Skip to content

Commit bb057fa

Browse files
authored
Merge pull request #48 from team8-nbc/dev
[release] v1.0.0: eightyage
2 parents d25a931 + cd84ec5 commit bb057fa

145 files changed

Lines changed: 4804 additions & 79 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Feature Request Issue Template
3+
about: Suggest an idea for this project
4+
title: "[FEATURE] OOO๊ธฐ๋Šฅ ๊ตฌํ˜„"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## ๐Ÿ“ Issue
11+
> ์ถ”๊ฐ€ํ•˜๋ ค๋Š” ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด ์„ค๋ช…ํ•ด ์ฃผ์„ธ์š”.
12+
13+
---
14+
15+
## ๐Ÿ“„ ์„ค๋ช…
16+
17+
- ๊ธฐ๋Šฅ
18+
- ๊ธฐ๋Šฅ
19+
- ๊ธฐ๋Šฅ
20+
21+
---
22+
23+
## โœ… ์ž‘์—…ํ•  ๋‚ด์šฉ
24+
- [ ] ํ• ์ผ
25+
- [ ] ํ• ์ผ
26+
- [ ] ํ• ์ผ
27+
- [ ] ํ• ์ผ
28+
29+
---
30+
31+
## ๐Ÿ™‹๐Ÿป ์ฐธ๊ณ  ์ž๋ฃŒ
32+
> ๊ด€๋ จ ๋ฌธ์„œ๋‚˜ ์ฐธ๊ณ  ๋งํฌ๊ฐ€ ์žˆ๋‹ค๋ฉด ์ ์–ด์ฃผ์„ธ์š”.

โ€Ž.github/ISSUE_TEMPLATE/feature_request.ymlโ€Ž

Lines changed: 0 additions & 24 deletions
This file was deleted.

โ€Ž.github/workflows/cd.ymlโ€Ž

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Deploy to EC2
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Docker Build
15+
run: docker build -t eightyage .
16+
17+
- name: Configure AWS credentials
18+
uses: aws-actions/configure-aws-credentials@v2
19+
with:
20+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
21+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
22+
aws-region: ap-northeast-2
23+
24+
- name: ECR Login
25+
run: |
26+
aws ecr get-login-password | \
27+
docker login --username AWS --password-stdin ${{ secrets.ECR_URI }}
28+
29+
- name: Docker Images Check
30+
run: docker images
31+
32+
- name: ECR Push
33+
run: |
34+
docker tag eightyage:latest ${{ secrets.ECR_URI }}
35+
docker push ${{ secrets.ECR_URI }}
36+
37+
- name: Deploy on EC2
38+
uses: appleboy/ssh-action@v1
39+
with:
40+
host: ${{ secrets.EC2_HOST }}
41+
username: ubuntu
42+
key: ${{ secrets.EC2_SSH_KEY }}
43+
envs: ECR_URI,DB_URL,DB_USER,DB_PASSWORD,JWT_SECRET_KEY,AWS_ACCESS_KEY,AWS_SECRET_KEY,REDIS_HOST
44+
45+
script: |
46+
export ECR_URI=${{ secrets.ECR_URI }}
47+
export DB_URL=${{ secrets.DB_URL }}
48+
export DB_USER=${{ secrets.DB_USER }}
49+
export DB_PASSWORD=${{ secrets.DB_PASSWORD }}
50+
export JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}
51+
export AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }}
52+
export AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }}
53+
export REDIS_HOST=${{ secrets.REDIS_HOST }}
54+
55+
docker ps -q --filter ancestor=$ECR_URI | xargs -r docker stop
56+
docker ps -aq --filter ancestor=$ECR_URI | xargs -r docker rm
57+
58+
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin $ECR_URI
59+
docker pull $ECR_URI
60+
docker run -d -p 8080:8080 \
61+
-e DB_URL=$DB_URL \
62+
-e DB_USER=$DB_USER \
63+
-e DB_PASSWORD=$DB_PASSWORD \
64+
-e JWT_SECRET_KEY=$JWT_SECRET_KEY \
65+
-e AWS_ACCESS_KEY=$AWS_ACCESS_KEY \
66+
-e AWS_SECRET_KEY=$AWS_SECRET_KEY \
67+
-e REDIS_HOST=$REDIS_HOST \
68+
$ECR_URI
69+
70+
- name: Health Check
71+
uses: appleboy/ssh-action@v1
72+
with:
73+
host: ${{ secrets.EC2_HOST }}
74+
username: ubuntu
75+
key: ${{ secrets.EC2_SSH_KEY }}
76+
script: |
77+
for i in {1..10}; do
78+
echo "โณ Health check attempt $i..."
79+
if curl -f http://localhost:8080/actuator/health; then
80+
echo "โœ… Health check succeeded!"
81+
exit 0
82+
fi
83+
sleep 5
84+
done
85+
echo "โŒ Health check failed after multiple attempts"
86+
exit 1
87+
88+
- name: Notify Slack - ๋ฐฐํฌ ์„ฑ๊ณต
89+
if: success()
90+
run: |
91+
curl -X POST -H 'Content-type: application/json' \
92+
--data '{
93+
"text": "โœ… *๋ฐฐํฌ ์„ฑ๊ณต!* ๐ŸŽ‰",
94+
"blocks": [
95+
{
96+
"type": "section",
97+
"text": {
98+
"type": "mrkdwn",
99+
"text": "*โœ… ๋ฐฐํฌ ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค!*\n\n*๋ธŒ๋žœ์น˜:* `${{ github.ref_name }}`\n<http://3.39.158.229:8080/actuator/health|๐Ÿ”— ๋ฐฐํฌ๋œ ์„œ๋น„์Šค ์ƒํƒœ ๋ณด๊ธฐ>"
100+
}
101+
}
102+
]
103+
}' \
104+
${{ secrets.SLACK_WEBHOOK_URL }}
105+
106+
- name: Notify Slack - ๋ฐฐํฌ ์‹คํŒจ
107+
if: failure()
108+
run: |
109+
curl -X POST -H 'Content-type: application/json' \
110+
--data '{
111+
"text": "โŒ *๋ฐฐํฌ ์‹คํŒจ!* ๐Ÿ”ฅ",
112+
"blocks": [
113+
{
114+
"type": "section",
115+
"text": {
116+
"type": "mrkdwn",
117+
"text": "*โŒ ๋ฐฐํฌ ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค!*\n\n*๋ธŒ๋žœ์น˜:* `${{ github.ref_name }}`\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|๐Ÿ”— ์‹คํŒจ ๋กœ๊ทธ ํ™•์ธํ•˜๊ธฐ>"
118+
}
119+
}
120+
]
121+
}' \
122+
${{ secrets.SLACK_WEBHOOK_URL }}

โ€Ž.github/workflows/ci.ymlโ€Ž

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Java CI with Gradle
2+
3+
on:
4+
pull_request:
5+
branches: [ "dev", "main" ] # dev, main ๋ชจ๋‘ PR ๋Œ€์ƒ
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
services:
15+
mysql:
16+
image: mysql:8.0 # MySQL ์ปจํ…Œ์ด๋„ˆ ๋„์šฐ๊ธฐ
17+
env:
18+
MYSQL_ROOT_PASSWORD: root # Docker ๋‚ด๋ถ€ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ง€์ •
19+
MYSQL_DATABASE: team8_test # Docker ๋‚ด๋ถ€ DB ์ด๋ฆ„
20+
ports:
21+
- 3306:3306
22+
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=5s --health-retries=3
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Set up JDK 17
28+
uses: actions/setup-java@v4
29+
with:
30+
java-version: '17'
31+
distribution: 'temurin'
32+
33+
- name: Wait for MySQL to be ready
34+
run: |
35+
for i in {1..10}; do
36+
if mysql -hmysql -P3306 -uroot -proot -e "SELECT 1"; then
37+
echo "MySQL is up!"
38+
break
39+
fi
40+
echo "Waiting for MySQL..."
41+
sleep 5
42+
done
43+
44+
- name: Grant execute permission for gradlew
45+
run: chmod +x ./gradlew
46+
47+
- name: Clean Gradle Cache
48+
run: ./gradlew clean --refresh-dependencies
49+
50+
- name: Test And Build with Gradle
51+
env:
52+
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }}
53+
run: ./gradlew build -Dspring.profiles.active=ci
54+

โ€Ž.gitignoreโ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ Thumbs.db
3333
.env
3434

3535
# Spring Boot application properties/yaml
36-
application-*.yml
37-
application-*.properties
36+
#application-*.yml
37+
#application-*.properties
3838

3939
# AWS config
4040
.aws/
41+

โ€ŽDockerfileโ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM gradle:8.6-jdk17 AS build
2+
WORKDIR /app
3+
COPY . .
4+
RUN gradle clean build -x test
5+
6+
FROM eclipse-temurin:17-jdk-alpine
7+
WORKDIR /app
8+
9+
COPY --from=build /app/build/libs/*.jar app.jar
10+
EXPOSE 8080
11+
12+
ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-jar", "app.jar"]

โ€Žbuild.gradleโ€Ž

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,34 @@ dependencies {
3333
runtimeOnly 'com.mysql:mysql-connector-j'
3434
annotationProcessor 'org.projectlombok:lombok'
3535
testImplementation 'org.springframework.boot:spring-boot-starter-test'
36-
testImplementation 'org.springframework.security:spring-security-test'
3736
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
3837

38+
// spring security
39+
implementation 'org.springframework.boot:spring-boot-starter-security'
40+
testImplementation 'org.springframework.security:spring-security-test'
41+
42+
// jwt
43+
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
44+
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
45+
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'
46+
47+
// cache
48+
implementation 'org.springframework.boot:spring-boot-starter-cache'
49+
implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8'
50+
3951
// spring cloud AWS S3
4052
implementation 'io.awspring.cloud:spring-cloud-aws-starter-s3:3.3.0'
53+
54+
// env
55+
implementation 'io.github.cdimascio:java-dotenv:5.2.2'
56+
57+
// redis & redisson
58+
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
59+
implementation 'org.redisson:redisson:3.23.5'
60+
61+
testImplementation 'org.mockito:mockito-inline:5.2.0'
62+
63+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
4164
}
4265

4366
tasks.named('test') {

โ€Žgradlewโ€Ž

100644100755
File mode changed.

โ€Žsrc/main/java/com/example/eightyage/EightyageApplication.javaโ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.data.web.config.EnableSpringDataWebSupport;
6+
import org.springframework.scheduling.annotation.EnableScheduling;
57

8+
import static org.springframework.data.web.config.EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO;
9+
10+
@EnableSpringDataWebSupport(pageSerializationMode = VIA_DTO)
611
@SpringBootApplication
12+
@EnableScheduling
713
public class EightyageApplication {
814

915
public static void main(String[] args) {

โ€Žsrc/main/java/com/example/eightyage/domain/auth/controller/.gitkeepโ€Ž

Whitespace-only changes.

0 commit comments

Comments
ย (0)