Skip to content

Commit 9bdf81e

Browse files
authored
Merge pull request #120 from team-gogo/develop
v2025.4.1
2 parents b97f60d + fdf069c commit 9bdf81e

File tree

64 files changed

+829
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+829
-155
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: GOGO Stage prod CD Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
workflow_dispatch:
8+
9+
jobs:
10+
CI:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
cache: gradle
23+
24+
- name: Setup Gradle
25+
uses: gradle/gradle-build-action@v2
26+
27+
- name: Setup Gradle's permission
28+
run: chmod +x gradlew
29+
30+
- name: Build with Gradle
31+
run: ./gradlew clean build
32+
33+
deploy:
34+
needs: CI
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v3
39+
40+
- name: Install sshpass and OpenSSH
41+
run: |
42+
sudo apt-get update && sudo apt-get install -y sshpass openssh-client
43+
44+
- name: Create SSH key for Bastion and Target
45+
run: |
46+
echo "${{ secrets.PROD_BASTION_SSH_KEY }}" > $HOME/bastion_key.pem
47+
chmod 600 $HOME/bastion_key.pem
48+
49+
- name: SSH Command to Deploy using Bastion and Target Instance
50+
run: |
51+
ssh -i "$HOME/bastion_key.pem" -o StrictHostKeyChecking=no ubuntu@${{ secrets.PROD_BASTION_HOST }} << 'EOF'
52+
ssh -i gogo-prod-ms.pem -o StrictHostKeyChecking=no ubuntu@${{ secrets.PROD_TARGET_HOST }} << 'EOF2'
53+
mkdir -p /home/ubuntu/gogo-stage
54+
cd /home/ubuntu/gogo-stage
55+
56+
if [ ! -d ".git" ]; then
57+
git clone -b master https://github.com/team-gogo/gogo-stage.git .
58+
else
59+
git pull origin master
60+
fi
61+
62+
./gradlew clean build
63+
64+
docker build -f DockerFileStage -t gogo-stage-prod .
65+
66+
docker stop gogo-stage-prod || true
67+
docker rm gogo-stage-prod || true
68+
69+
docker run -d -p 8082:8082 --add-host host.docker.internal:host-gateway --name gogo-stage-prod gogo-stage-prod
70+
71+
- name: SSH Success Notification
72+
if: success()
73+
uses: sarisia/actions-status-discord@v1
74+
with:
75+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
76+
color: 0x4CAF50
77+
title: "배포 성공"
78+
message: "GOGO Stage prod deployment completed successfully."
79+
80+
- name: SSH Failure Notification
81+
if: failure()
82+
uses: sarisia/actions-status-discord@v1
83+
with:
84+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
85+
color: 0xFF4C4C
86+
title: "배포 실패"
87+
message: "GOGO Stage prod deployment failed. Check the logs for details."
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: GOGO Stage prod CI Workflow
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'master'
7+
push:
8+
branches:
9+
- 'master'
10+
workflow_dispatch:
11+
12+
jobs:
13+
CI:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
cache: gradle
26+
27+
- name: Setup Gradle
28+
uses: gradle/gradle-build-action@v2
29+
30+
- name: Setup Gradle's permission
31+
run: chmod +x gradlew
32+
33+
- name: Build with Gradle
34+
run: ./gradlew clean build
35+
36+
- name: CI Success Notification
37+
uses: sarisia/actions-status-discord@v1
38+
if: success()
39+
with:
40+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
41+
color: 0x4CAF50
42+
43+
- name: CI Failure Notification
44+
uses: sarisia/actions-status-discord@v1
45+
if: failure()
46+
with:
47+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
48+
color: 0xFF4C4C
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: GOGO Stage stage CD Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- 'develop'
7+
workflow_dispatch:
8+
9+
jobs:
10+
CI:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
cache: gradle
23+
24+
- name: Setup Gradle
25+
uses: gradle/gradle-build-action@v2
26+
27+
- name: Setup Gradle's permission
28+
run: chmod +x gradlew
29+
30+
- name: Build with Gradle
31+
run: ./gradlew clean build
32+
33+
deploy:
34+
needs: CI
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v3
39+
40+
- name: Install sshpass and OpenSSH
41+
run: |
42+
sudo apt-get update && sudo apt-get install -y sshpass openssh-client
43+
44+
- name: Create SSH key for Bastion and Target
45+
run: |
46+
echo "${{ secrets.STAGE_BASTION_SSH_KEY }}" > $HOME/bastion_key.pem
47+
chmod 600 $HOME/bastion_key.pem
48+
49+
- name: SSH Command to Deploy using Bastion and Target Instance
50+
run: |
51+
ssh -i "$HOME/bastion_key.pem" -o StrictHostKeyChecking=no ubuntu@${{ secrets.STAGE_BASTION_HOST }} << 'EOF'
52+
ssh -i gogo-stage.pem -o StrictHostKeyChecking=no ubuntu@${{ secrets.STAGE_TARGET_HOST }} << 'EOF2'
53+
mkdir -p /home/ubuntu/gogo-stage
54+
cd /home/ubuntu/gogo-stage
55+
56+
if [ ! -d ".git" ]; then
57+
git clone -b develop https://github.com/team-gogo/gogo-stage.git .
58+
else
59+
git pull origin develop
60+
fi
61+
62+
./gradlew clean build
63+
64+
docker build -f DockerFileStage -t gogo-stage-stage .
65+
66+
docker stop gogo-stage-stage || true
67+
docker rm gogo-stage-stage || true
68+
69+
docker run -d -p 8082:8082 --add-host host.docker.internal:host-gateway --name gogo-stage-stage gogo-stage-stage
70+
71+
- name: SSH Success Notification
72+
if: success()
73+
uses: sarisia/actions-status-discord@v1
74+
with:
75+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
76+
color: 0x4CAF50
77+
title: "배포 성공"
78+
message: "GOGO Stage stage deployment completed successfully."
79+
80+
- name: SSH Failure Notification
81+
if: failure()
82+
uses: sarisia/actions-status-discord@v1
83+
with:
84+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
85+
color: 0xFF4C4C
86+
title: "배포 실패"
87+
message: "GOGO Stage stage deployment failed. Check the logs for details."
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: GOGO Stage stage CI Workflow
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'develop'
7+
push:
8+
branches:
9+
- 'develop'
10+
workflow_dispatch:
11+
12+
jobs:
13+
CI:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
cache: gradle
26+
27+
- name: Setup Gradle
28+
uses: gradle/gradle-build-action@v2
29+
30+
- name: Setup Gradle's permission
31+
run: chmod +x gradlew
32+
33+
- name: Build with Gradle
34+
run: ./gradlew clean build
35+
36+
- name: CI Success Notification
37+
uses: sarisia/actions-status-discord@v1
38+
if: success()
39+
with:
40+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
41+
color: 0x4CAF50
42+
43+
- name: CI Failure Notification
44+
uses: sarisia/actions-status-discord@v1
45+
if: failure()
46+
with:
47+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
48+
color: 0xFF4C4C

DockerFileProd

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM openjdk:17-jdk
2+
3+
EXPOSE 8082
4+
5+
WORKDIR /home/ubuntu/gogo-stage
6+
7+
COPY build/libs/gogo-stage-0.0.1-SNAPSHOT.jar stage-stage.jar
8+
9+
RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
10+
11+
ENTRYPOINT ["java", "-jar", "stage-stage.jar", "--spring.profiles.active=prod"]

DockerFileStage

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM openjdk:17-jdk
2+
3+
EXPOSE 8082
4+
5+
WORKDIR /home/ubuntu/gogo-stage
6+
7+
COPY build/libs/gogo-stage-0.0.1-SNAPSHOT.jar stage-stage.jar
8+
9+
RUN ln -snf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
10+
11+
ENTRYPOINT ["java", "-jar", "stage-stage.jar", "--spring.profiles.active=stage"]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GOGO Stage Service
2+
GOGO Stage 서비스입니다.

build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
2+
java
23
kotlin("jvm") version "2.1.0"
3-
kotlin("plugin.spring") version "2.1.0"
4+
kotlin("plugin.spring") version "1.9.25"
45
id("org.springframework.boot") version "3.4.1"
56
id("io.spring.dependency-management") version "1.1.7"
67
kotlin("plugin.jpa") version "1.9.25"
@@ -24,7 +25,9 @@ repositories {
2425
extra["springCloudVersion"] = "2024.0.0-RC1"
2526

2627
dependencies {
27-
implementation("org.springframework.cloud:spring-cloud-starter-bus-kafka")
28+
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
29+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
30+
implementation("org.springframework.boot:spring-boot-starter-data-redis")
2831
implementation("org.springframework.cloud:spring-cloud-starter-config")
2932
runtimeOnly("io.micrometer:micrometer-registry-prometheus")
3033
implementation("org.springframework.boot:spring-boot-starter-actuator")

src/main/kotlin/gogo/gogostage/domain/community/board/application/BoardReader.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ class BoardReader(
1515
boardRepository.findByIdOrNull(boardId)
1616
?: throw StageException("Board Not Found, boardId=$boardId", HttpStatus.NOT_FOUND.value())
1717

18+
fun readForWrite(boardId: Long) =
19+
boardRepository.findByIdForWrite(boardId)
20+
?: throw StageException("Board Not Found, boardId=$boardId", HttpStatus.NOT_FOUND.value())
21+
1822
}

src/main/kotlin/gogo/gogostage/domain/community/board/persistence/Board.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ class Board(
1919
@Column(name = "student_id", nullable = false)
2020
val studentId: Long,
2121

22-
@Column(name = "title", nullable = false)
22+
@Column(name = "title", length = 30, nullable = false)
2323
val title: String,
2424

25-
@Column(name = "content", nullable = false)
25+
@Column(name = "content", length = 1000, nullable = false)
2626
val content: String,
2727

2828
@Column(name = "comment_count", nullable = false)
29-
val commentCount: Int,
29+
var commentCount: Int,
3030

3131
@Column(name = "like_count", nullable = false)
3232
var likeCount: Int,
@@ -46,4 +46,8 @@ class Board(
4646
likeCount += 1
4747
}
4848

49+
fun plusCommentCount() {
50+
commentCount += 1
51+
}
52+
4953
}

0 commit comments

Comments
 (0)