-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
1,735 additions
and
1,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Server CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'server/**' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}/server | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
defaults: | ||
run: | ||
working-directory: server | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew clean bootJar | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./server | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
platforms: linux/amd64 | ||
|
||
deploy: | ||
name: Deploy | ||
runs-on: [self-hosted] | ||
needs: build | ||
|
||
defaults: | ||
run: | ||
working-directory: ./server | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create .env file | ||
env: | ||
SECRET_CONTEXT: ${{ toJson(secrets) }} | ||
run: | | ||
echo "$SECRET_CONTEXT" | tr -d '{}' | tr ',' '\n' | sed -n 's/"\(.*\)":\(.*\)/\1=\2/p' > .env | ||
- name: View | ||
run: cat .env | ||
|
||
- name: Compose Docker image | ||
env: | ||
DOCKER_APP_IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
|
||
run: docker compose -f compose.yml up -d | ||
|
||
- name: Docker remove unused images | ||
run: docker image prune -af | ||
|
||
- name: Check running containers | ||
run: docker ps -a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Server CI | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
branches: | ||
- main | ||
paths: | ||
- 'server/**' | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: server | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# Fluffy | ||
|
||
Fluffy는 시험 문제를 제작하고, 공유하고, 풀 수 있는 웹 서비스입니다. | ||
|
||
### Stack | ||
|
||
- server: spring, aws, supabase(postgreSQL) | ||
- web: react, vite, tailwindcss, vercel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
OAUTH_GITHUB_CLIENT_ID= | ||
OAUTH_GITHUB_CLIENT_SECRET= | ||
|
||
DB_URL= | ||
DB_USERNAME= | ||
DB_PASSWORD= | ||
|
||
JWT_SECRET_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
.DS_Store | ||
src/main/resources/.env | ||
|
||
.env.* | ||
!.env.example | ||
|
||
HELP.md | ||
.gradle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM openjdk:21-jdk-slim | ||
|
||
WORKDIR /app | ||
|
||
ARG JAR_FILE=/build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=${SPRING_PROFILES_ACTIVE}", "app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
app: | ||
container_name: fluffy-app | ||
image: ${DOCKER_APP_IMAGE} | ||
ports: | ||
- '8080:8080' | ||
env_file: | ||
- .env | ||
environment: | ||
TZ: Asia/Seoul | ||
SPRING_PROFILES_ACTIVE: prod | ||
restart: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
server/src/main/java/com/fluffy/global/exception/GlobalExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
spring: | ||
datasource: | ||
url: ${DB_URL} | ||
username: ${DB_USERNAME} | ||
password: ${DB_PASSWORD} | ||
jpa: | ||
open-in-view: false | ||
show-sql: true | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
highlight_sql: true | ||
hibernate: | ||
ddl-auto: validate | ||
|
||
api-host: https://api.fluffy.run | ||
client-host: https://www.fluffy.run | ||
|
||
auth: | ||
jwt: | ||
secret-key: ${JWT_SECRET_KEY} | ||
expiration-time: 86400000 # 1 day | ||
cookie: | ||
access-token-key: access_token | ||
httpOnly: true | ||
secure: true | ||
domain: .fluffy.run | ||
path: / | ||
maxAge: 86400 # 1 day | ||
oauth2: | ||
github: | ||
client-id: ${OAUTH_GITHUB_CLIENT_ID} | ||
client-secret: ${OAUTH_GITHUB_CLIENT_SECRET} | ||
redirect-uri: ${api-host}/api/v1/auth/oauth2/callback/github | ||
client-uri: ${client-host} | ||
|
||
logging: | ||
level: | ||
org.springframework.orm.jpa: DEBUG | ||
org.springframework.orm.transaction: DEBUG | ||
org.hibernate.orm.jdbc.bind: trace |
Oops, something went wrong.