Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .github/workflows/prod-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "[PROD] Build Gradle and Deploy"

on:
push:
branches: [ "release" ] # todo: 스테이지 서버 cd 테스트 후 master 로 변경 필요
branches: [ "master" ]
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew bootJar -Dspring.profiles.active=prod
run: ./gradlew bootJar

- name: Copy jar file to remote
uses: appleboy/scp-action@master
Expand All @@ -59,7 +59,7 @@ jobs:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: "./docker-compose.yml"
source: "./docker-compose.prod.yml"
target: "/home/${{ secrets.USERNAME }}/solid-connect-server/"

- name: Run docker compose
Expand All @@ -72,4 +72,4 @@ jobs:
script: |
cd /home/${{ secrets.USERNAME }}/solid-connect-server
docker compose down
docker compose up -d --build
docker compose -f docker-compose.prod.yml up -d --build
8 changes: 4 additions & 4 deletions .github/workflows/stage-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "[STAGE] Build Gradle and Deploy"

on:
push:
branches: [ "stage-test" ] # todo: 스테이지 서버 cd 테스트 후 release 로 변경 필요
branches: [ "release" ]
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
run: chmod +x ./gradlew

- name: Build with Gradle
run: ./gradlew bootJar -Dspring.profiles.active=prod
run: ./gradlew bootJar

- name: Copy jar file to remote
uses: appleboy/scp-action@master
Expand All @@ -59,7 +59,7 @@ jobs:
host: ${{ secrets.STAGE_HOST }}
username: ${{ secrets.STAGE_USERNAME }}
key: ${{ secrets.STAGE_PRIVATE_KEY }}
source: "./docker-compose.yml"
source: "./docker-compose.stage.yml"
target: "/home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage/"

- name: Run docker compose
Expand All @@ -72,4 +72,4 @@ jobs:
script: |
cd /home/${{ secrets.STAGE_USERNAME }}/solid-connect-stage
docker compose down
docker compose up -d --build
docker compose -f docker-compose.stage.yml up -d --build
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG JAR_FILE=./build/libs/solid-connection-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar

# 시스템 진입점 정의
ENTRYPOINT ["java", "-jar", "/app.jar", "--spring.profiles.active=prod"]
ENTRYPOINT ["java", "-jar", "/app.jar"]

# 볼륨 설정
VOLUME /tmp
3 changes: 2 additions & 1 deletion docker-compose.yml → docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ services:
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
depends_on:
- redis
- redis
33 changes: 33 additions & 0 deletions docker-compose.stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'

services:
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
network_mode: host

redis-exporter:
image: oliver006/redis_exporter
container_name: redis-exporter
ports:
- "9121:9121"
environment:
REDIS_ADDR: "localhost:6379"
depends_on:
- redis
network_mode: host

solid-connection-stage:
build:
context: .
dockerfile: Dockerfile
container_name: solid-connection-stage
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=stage
depends_on:
- redis
network_mode: host
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public class ApplicationQueryService {
* - 1지망, 2지망 지원자들을 조회한다.
* */
@Transactional(readOnly = true)
@ThunderingHerdCaching(key = "application:query:{1}:{2}", cacheManager = "customCacheManager", ttlSec = 86400)
// todo: 임시로 단일 키로 캐시 적용. 추후 캐싱 전략 재검토 필요.
@ThunderingHerdCaching(key = "applications:all", cacheManager = "customCacheManager", ttlSec = 86400)
public ApplicationsResponse getApplicants(SiteUser siteUser, String regionCode, String keyword) {
// 국가와 키워드와 지역을 통해 대학을 필터링한다.
List<University> universities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.example.solidconnection.application.dto.ApplyRequest;
import com.example.solidconnection.application.dto.UniversityChoiceRequest;
import com.example.solidconnection.application.repository.ApplicationRepository;
import com.example.solidconnection.cache.annotation.DefaultCacheOut;
import com.example.solidconnection.custom.exception.CustomException;
import com.example.solidconnection.score.domain.GpaScore;
import com.example.solidconnection.score.domain.LanguageTestScore;
Expand All @@ -18,14 +19,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import static com.example.solidconnection.custom.exception.ErrorCode.APPLY_UPDATE_LIMIT_EXCEED;
import static com.example.solidconnection.custom.exception.ErrorCode.CANT_APPLY_FOR_SAME_UNIVERSITY;
import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_GPA_SCORE;
import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_GPA_SCORE_STATUS;
import static com.example.solidconnection.custom.exception.ErrorCode.INVALID_LANGUAGE_TEST_SCORE;
Expand All @@ -48,6 +44,11 @@ public class ApplicationSubmissionService {
// 학점 및 어학성적이 모두 유효한 경우에만 지원서 등록이 가능하다.
// 기존에 있던 status field 우선 APRROVED로 입력시킨다.
@Transactional
// todo: 임시로 새로운 신청 생성 시 기존 캐싱 데이터를 삭제한다. 추후 수정 필요
@DefaultCacheOut(
key = {"applications:all"},
cacheManager = "customCacheManager"
)
public boolean apply(SiteUser siteUser, ApplyRequest applyRequest) {
UniversityChoiceRequest universityChoiceRequest = applyRequest.universityChoiceRequest();

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/secret