Skip to content
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
3207d9e
Merge pull request #7 from Bravest-opensource-project/feature/chatlis…
JangYeongHu Nov 19, 2025
0531771
[feature] Chatting API implementation
JangYeongHu Nov 19, 2025
6e2c041
Merge pull request #8 from Bravest-opensource-project/feature/chattin…
JangYeongHu Nov 19, 2025
3a11847
[bugfix] mapping name rule fix
2heunxun Nov 19, 2025
b9a5d16
[hotix] Change ResponseEntity to ApiResponse
JangYeongHu Nov 19, 2025
1f5d4d3
Merge pull request #9 from Bravest-opensource-project/hotfix/api-resp…
JangYeongHu Nov 19, 2025
b4ccd90
Merge branch 'develop' of https://github.com/Bravest-opensource-proje…
2heunxun Nov 19, 2025
ccb7932
[bugfix] AnonymousProfileResponse dev
2heunxun Nov 19, 2025
109f45d
[bugfix] AnonymousProfileService dev
2heunxun Nov 19, 2025
0aea50f
[feature] AnonymousProfileRequest dev
2heunxun Nov 19, 2025
1cb7abd
[feature] AnonymousProfileController dev
2heunxun Nov 19, 2025
5dbb11e
[feature] Room dev
2heunxun Nov 19, 2025
2ddd47e
[feature] Room dev
2heunxun Nov 19, 2025
adcd2b9
[feature] add SecurityConfig dev
2heunxun Nov 19, 2025
e075b1f
[feature] Room dev
2heunxun Nov 19, 2025
ec7370c
[feature] Setting different dev
2heunxun Nov 19, 2025
fbf86f2
Merge pull request #10 from Bravest-opensource-project/feature/Anonym…
2heunxun Nov 19, 2025
829483c
[feature] vote system
2heunxun Nov 19, 2025
007a18e
Merge pull request #11 from Bravest-opensource-project/feature/Vote-s…
2heunxun Nov 19, 2025
afc4dfd
[hotix] Add Websocket, Chatlist endpoint in SecurityConfig
JangYeongHu Nov 24, 2025
54cf0f3
Merge pull request #12 from Bravest-opensource-project/hotfix/public-…
JangYeongHu Nov 24, 2025
4c6074f
[hotix] Add Websocket, Chatlist endpoint in SecurityConfig
JangYeongHu Nov 24, 2025
6508522
Merge pull request #13 from Bravest-opensource-project/hotfix/public-…
JangYeongHu Nov 24, 2025
5065b26
[hotix] delete all contraints
JangYeongHu Nov 24, 2025
a5752d7
Merge pull request #14 from Bravest-opensource-project/hotfix/delete-…
JangYeongHu Nov 24, 2025
e0ea520
chore: Add backend dockerfile and deployment doc
semi-yu Nov 26, 2025
586e8a9
Merge pull request #15 from Bravest-opensource-project/feature/docker…
semi-yu Nov 26, 2025
967f19c
chore: Add backend-manual-build.yml
semi-yu Nov 27, 2025
96e4853
merge: Add branch ci/backend-manual-build from develop
semi-yu Nov 27, 2025
5f4de3e
ci: wire backend manual build to github secrets
semi-yu Nov 27, 2025
a7eafbe
merge: Add ci/backend-manual-build-secrets from develop
semi-yu Nov 27, 2025
b04fdf0
fix: Change websocket configure
semi-yu Nov 29, 2025
f8a99b7
merge: Add fix/change-websocket-configure from develop
semi-yu Nov 29, 2025
4301c63
fix: Add STOMP annotation
semi-yu Nov 29, 2025
2a3c717
merge: Add fix/stomp-messaging from develop
semi-yu Nov 29, 2025
83a1a0e
fix: Use anonymousId as STOMP principal
semi-yu Nov 29, 2025
cd9e05d
merge: Add fix/websocket-anonymous-principal from develop
semi-yu Nov 29, 2025
2ecdd9e
fix: Prevent duplicate STOMP subscriptions
semi-yu Nov 29, 2025
879bd39
merge: Add fix/stomp-subscription-dedup from develop
semi-yu Nov 29, 2025
56ef322
ci: Add MySQL service to docker-compose
semi-yu Nov 29, 2025
083ee01
merge: Add ci/add-db-service from develop
semi-yu Nov 29, 2025
625dee1
ci: Add keystore service
semi-yu Nov 30, 2025
198dd6a
merge: Add ci/add-keystore-service from develop
semi-yu Nov 30, 2025
067bfb9
feat: Change Dedup logic to use keystore
semi-yu Nov 30, 2025
0b54c5a
merge: Add feature/keystore-dedup from develop
semi-yu Nov 30, 2025
f743447
docs: explain CodeQL languages in Korean
2heunxun Nov 30, 2025
d0d50af
Merge pull request #25 from Bravest-opensource-project/codex/suggest-…
2heunxun Nov 30, 2025
8abaea9
Merge pull request #26 from Bravest-opensource-project/ci/add-workflow
2heunxun Nov 30, 2025
e9ab579
Add 'develop' branch to CodeQL workflow
2heunxun Nov 30, 2025
f715049
ci/cd - dependency security check
2heunxun Nov 30, 2025
7108fe7
Merge pull request #27 from Bravest-opensource-project/ci/add-workflo…
2heunxun Nov 30, 2025
a818588
[ci/cd] Adding workflow file assign PR assignees
JangYeongHu Nov 30, 2025
1331dba
Merge pull request #28 from Bravest-opensource-project/ci/add-workflo…
JangYeongHu Nov 30, 2025
b4f4760
[ci/cd] Adding workflow file test docker-compose.yaml
JangYeongHu Nov 30, 2025
42fd670
[ci/cd] Add dispatch
JangYeongHu Nov 30, 2025
30e46f0
Merge pull request #29 from Bravest-opensource-project/ci/add-workflo…
JangYeongHu Nov 30, 2025
991cbe4
[ci/cd] fix dockercompose-test.yml syntax error
JangYeongHu Nov 30, 2025
784231c
Merge pull request #30 from Bravest-opensource-project/ci/workflow-th…
JangYeongHu Nov 30, 2025
2006251
[ci/cd] fix dockercompose-test.yml syntax error
JangYeongHu Nov 30, 2025
e7f000c
Merge pull request #31 from Bravest-opensource-project/ci/workflow-th…
JangYeongHu Nov 30, 2025
388b165
[ci/cd] fix dockercompose-test.yml syntax error
JangYeongHu Nov 30, 2025
e49d4ed
[ci/cd] add spring actuator
JangYeongHu Nov 30, 2025
835b0a4
[ci/cd] delete checking ci/** branches
JangYeongHu Nov 30, 2025
99a51c4
Merge pull request #32 from Bravest-opensource-project/ci/workflow-th…
JangYeongHu Nov 30, 2025
5603508
[ci/cd] add code style checker workflow
JangYeongHu Nov 30, 2025
54adda4
[ci/cd] add plugin
JangYeongHu Nov 30, 2025
fabc98e
[ci/cd] refactor all of file
JangYeongHu Nov 30, 2025
1740065
[ci/cd] rename ci/cd file
JangYeongHu Nov 30, 2025
ff0d77f
Merge pull request #33 from Bravest-opensource-project/ci/workflow-fo…
JangYeongHu Nov 30, 2025
9e6c4ec
[ci/cd] refactor all of file
JangYeongHu Nov 30, 2025
c1daf6f
[ci/cd] fix check_style file and refactor all of file
JangYeongHu Dec 1, 2025
4ce3f7d
Merge pull request #34 from Bravest-opensource-project/ci/workflow-fo…
JangYeongHu Dec 1, 2025
9a602bb
Update 0.0.1
JangYeongHu Dec 9, 2025
b98c75c
[ci/cd] fix style
JangYeongHu Dec 9, 2025
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gradle
build
.idea
*.iml
.env
42 changes: 42 additions & 0 deletions .github/workflows/backend-manual-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Backend Manual Build

on:
workflow_dispatch:

jobs:
backend-manual-build:
runs-on: ubuntu-latest

env:
DB_URL: ${{ secrets.DB_URL }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
JWT_ACCESS_TOKEN_VALIDITY_SECONDS: ${{ secrets.JWT_ACCESS_TOKEN_VALIDITY_SECONDS }}
JWT_REFRESH_TOKEN_VALIDITY_SECONDS: ${{ secrets.JWT_REFRESH_TOKEN_VALIDITY_SECONDS }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"

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

- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build with Gradle
run: ./gradlew clean build
43 changes: 43 additions & 0 deletions .github/workflows/code-style-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Java Code Style Check

on:
pull_request:
branches: ['**']
push:
branches: ['**']
workflow_dispatch:

jobs:
style-check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'

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

- name: Run Spotless and Checkstyle
run: |
set -e
./gradlew spotlessCheck --no-daemon
./gradlew checkstyleMain checkstyleTest --no-daemon
shell: bash

- name: Show summary
run: |
if [ $? -eq 0 ]; then
echo "🎉 Code style checks passed!"
else
echo "❌ Code style violations detected!"
echo "Please run './gradlew spotlessApply' locally and fix Checkstyle issues."
exit 1
fi
shell: bash
44 changes: 44 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "CodeQL"

on:
push:
branches: ["main", "develop"]
pull_request:
branches: ["main", "develop"]
schedule:
- cron: '0 8 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ['java']

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
23 changes: 23 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Dependency Review

on:
pull_request:
branches: ["main", "develop"]

permissions:
contents: read

jobs:
dependency-review:
name: Audit dependencies
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Review dependencies
uses: actions/dependency-review-action@v4
with:
fail-on-severity: critical
127 changes: 127 additions & 0 deletions .github/workflows/dockercompose-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Docker Compose Test

on:
pull_request:
push:
branches:
- main
- develop
paths:
- 'docker-compose.yml'
- 'Dockerfile.backend'
- 'src/**'
push:
branches:
- main
- develop
workflow_dispatch:

jobs:
docker-compose-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

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

- name: Build with Gradle
run: ./gradlew bootJar

- name: Create .env file from secrets
run: |
cat > .env << EOF
# Database Configuration
DB_PASSWORD=${{ secrets.DB_PASSWORD }}
DB_USERNAME=${{ secrets.DB_USERNAME }}
DB_URL=${{ secrets.DB_URL }}

# JWT Configuration
JWT_SECRET=${{ secrets.JWT_SECRET }}
JWT_ACCESS_TOKEN_VALIDITY_SECONDS=${{ secrets.JWT_ACCESS_TOKEN_VALIDITY_SECONDS }}
JWT_REFRESH_TOKEN_VALIDITY_SECONDS=${{ secrets.JWT_REFRESH_TOKEN_VALIDITY_SECONDS }}
EOF

- name: Start Docker Compose
run: docker compose up -d

- name: Check running containers
run: docker compose ps

- name: Wait for services to be ready
run: |
echo "⏳ Waiting for MySQL to be ready..."
timeout 30 bash -c 'until docker compose exec -T db mysqladmin ping \
-h localhost -uroot -p"${{ secrets.DB_PASSWORD }}" --silent 2>/dev/null; do sleep 2; done'
echo "✅ MySQL is ready!"

echo "⏳ Waiting for Valkey to be ready..."
timeout 30 bash -c 'until docker compose exec -T keystore valkey-cli ping 2>/dev/null | grep -q PONG; do sleep 2; done'
echo "✅ Valkey is ready!"

echo "⏳ Waiting for application to be ready..."
timeout 90 bash -c 'until curl -f http://localhost:8080/actuator/health 2>/dev/null; do sleep 3; done'
echo "✅ Application is ready!"

- name: Health check
run: |
response=$(curl -s http://localhost:8080/actuator/health)
echo "Health check response: $response"
if echo "$response" | grep -q '"status":"UP"'; then
echo "✅ Health check passed!"
else
echo "❌ Health check failed!"
exit 1
fi

- name: Test MySQL connection
env:
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
run: |
echo "Testing MySQL connection..."
docker compose exec -T db mysql -u"$DB_USERNAME" -p"$DB_PASSWORD" -e "SELECT 1;" && \
echo "✅ MySQL connection successful!" || \
(echo "❌ MySQL connection failed!" && exit 1)

- name: Test Valkey connection
run: |
echo "Testing Valkey connection..."
result=$(docker compose exec -T keystore valkey-cli ping)
if [ "$result" = "PONG" ]; then
echo "✅ Valkey connection successful!"
else
echo "❌ Valkey connection failed!"
exit 1
fi

- name: Show container logs on failure
if: failure()
run: |
echo "=== Application Logs ==="
docker compose logs app
echo "=== Database Logs ==="
docker compose logs db
echo "=== Valkey Logs ==="
docker compose logs keystore

- name: Stop Docker Compose
if: always()
run: docker compose down -v

- name: Test Summary
if: success()
run: |
echo "🎉 All Docker Compose tests passed!"
echo "✅ MySQL connection verified"
echo "✅ Valkey connection verified"
echo "✅ Application health check passed"
echo "✅ All services running correctly"
61 changes: 61 additions & 0 deletions BACKEND_DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## 개요
당 문서는 Bravest 백엔드를 컨테이너 이미지로 패키징하는 `Dockerfile.backend`에 대해 설명합니다.

작성자 @semi-yu

## 상세

### 사전 지식

자바 애플리케이션은 배포 전에 먼저 바이트코드(JAR)로 컴파일되어야 합니다. 이 과정에서 의존성 해소 등을 위해 Gradle이 관여하지만, 이 프로젝트에서는 `Dockerfile.backend`가 `./gradlew bootJar`를 실행하도록 설정되어 있으므로 별도로 신경 쓸 필요는 없습니다.

다만, 이 컴파일(빌드) 과정을 전용 Dockerfile로 따로 분리하면 설정이 중복되거나 빌드 파이프라인이 복잡해질 수 있습니다. 따라서 하나의 Dockerfile에서 **빌드 스테이지와 실행 스테이지를 모두 정의하는 멀티 스테이지 빌드**를 사용합니다. 이를 통해 어플리케이션 JAR 파일을 생성한 뒤, 실행에 필요한 JDK(내부에 JRE 포함)만 포함하는 컨테이너 이미지를 바로 만들 수 있으며, 결과 이미지 크기 또한 줄일 수 있습니다.

### 기타 통제 사항
`Dockerfile.backend`는 여러분이 요청하신 대로 21 버전의 JDK를 사용하도록 정의하였습니다. 배포판은 Temurin을 사용합니다.
### 실행

한편, 멀티 스테이지 빌드는 **이미지 빌드 시점의 구조**에만 영향을 줄 뿐, 이후 컨테이너를 실행하는 과정 자체에는 특별한 차이를 만들지 않습니다. 아래 절차를 따르면 됩니다.

#### 이미지를 빌드하기 위해서…

- 작업 디렉토리를 `Dockerfile.backend`가 존재하는 프로젝트 루트로 이동한 뒤, 다음 명령어를 실행합니다:

```bash
docker build \
-f Dockerfile.backend \
-t bravest-backend \
.
```
위 명령어는 `Dockerfile.backend`를 참조하여 백엔드 애플리케이션 이미지를 빌드합니다.

#### 컨테이너 인스턴스를 실행하기 위해서...

- `.env` 파일을 `Dockerfile.backend`가 존재하는 경로에 두고, 다음 명령어를 실행합니다:
```bash
docker run -d \
--name bravest-backend \
-p 8080:8080 \
--env-file .env \
bravest-backend
```
- 위 명령어는 빌드된 bravest-backend 이미지를 기반으로 컨테이너 인스턴스를 실행합니다.
- 컨테이너 인스턴스가 외부 DB에 접속하기 위해 필요한 접속 정보는 `.env` 파일에 정의되어 있어야 하며, `--env-file .env` 옵션을 통해 컨테이너에 주입됩니다.
- 이를 통해 중요한 정보를 배포 환경의 파일 시스템에 저장하지 않고 환경 변수로 주입할 수 있습니다.
- 해당 파일을 얻으려면 팀원에게 연락해주세요.
#### 현재는...
- 스프링 부트로 작성된 백엔드의 Dockerfile만 정의되어 있습니다.
- 가까운 시일 내에, 전체 서비스를 정의하는 `docker-compose.yml`를 정의하겠습니다.
### 요약

#### 빌드 및 실행
```bash
# 빌드
docker build -f Dockerfile.backend -t bravest-backend .

# 실행
docker run -d --name bravest-backend -p 8080:8080 --env-file .env bravest-backend

```
- 사전 조건
- 프로젝트 루트에 `.env` 파일이 있어야 합니다. 파일이 없다면 팀원에게 요청하세요.
31 changes: 31 additions & 0 deletions Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 빌드와 실행을 동시에 수행합니다.

# 빌드 단계
FROM eclipse-temurin:21-jdk-jammy AS build
WORKDIR /workspace

COPY gradlew .
COPY gradle ./gradle

COPY build.gradle settings.gradle ./

RUN chmod +x gradlew

RUN ./gradlew --no-daemon dependencies || true

COPY . .

RUN ./gradlew --no-daemon bootJar

# 실행 단계
FROM eclipse-temurin:21-jdk-jammy

WORKDIR /app

COPY --from=build /workspace/build/libs/*.jar app.jar

ENV JAVA_OPTS="-Dspring.profiles.active=prod"

EXPOSE 8080

ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
Loading
Loading