Skip to content

Commit

Permalink
w6 Weekly2develop
Browse files Browse the repository at this point in the history
w6 Weekly2develop
  • Loading branch information
Kdonghs authored Oct 11, 2024
2 parents 3a7088c + ece7790 commit eca9f81
Show file tree
Hide file tree
Showing 38 changed files with 862 additions and 187 deletions.
148 changes: 148 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: CI/CD Pipeline

on:
push:
branches: [ week6 ]
pull_request:
branches: [ week6 ]

env:
LIGHTSAIL_USERNAME: ubuntu
AWS_REGION: ap-northeast-2

jobs:
build:
runs-on: ubuntu-22.04

steps:
# 브런치로 체크아웃
- name: Checkout code
uses: actions/checkout@v3

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

# application-oauth.yml 생성
- name: Create application.yml
run: |
mkdir -p src/main/resources
cat <<EOF > src/main/resources/application-oauth.yml
spring:
datasource:
url: ${{
secrets.SPRING_DATASOURCE_URL
}}
username: ${{
secrets.SPRING_DATASOURCE_USERNAME
}}
password: ${{
secrets.SPRING_DATASOURCE_PASSWORD
}}
security:
oauth2:
client:
registration:
google:
client-id: ${{
secrets.GOOGLE_CLIENT_ID
}}
client-secret: ${{
secrets.GOOGLE_CLIENT_SECRET
}}
redirect-uri: "https://${{
secrets.LIGHT_SAIL_IP
}}/login/oauth2/code/google"
scope:
- email
- profile
provider:
google:
authorization-uri: https://accounts.google.com/o/oauth2/auth
token-uri: https://oauth2.googleapis.com/token
user-info-uri: https://www.googleapis.com/oauth2/v3/userinfo
server:
port: 443
ssl:
enabled: true
key-store: /etc/letsencrypt/live/seamlessup.com/keystore.p12
key-store-password: ${{
secrets.KEYSTORE_PASSWORD
}}
key-store-type: PKCS12
key-alias: tomcat
EOF
# Gradle 캐시 설정
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# gradlew 실행 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# gradle로 빌드
- name: Build with Gradle
run: ./gradlew bootJar

# AWS 인증
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: ${{ env.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

# AWS 인증 테스트
- name: Verify AWS Credentials
run: aws configure list

# 배포 자동화
- name: Upload files to Lightsail
uses: appleboy/scp-action@master
with:
host: ${{ secrets.LIGHTSAIL_HOST }}
username: ${{ env.LIGHTSAIL_USERNAME }}
port: 22
key: ${{ secrets.LIGHTSAIL_SSH_KEY }}
source: 'build/libs/*.jar'
target: '/home/ubuntu/seamless/dist'
use_insecure_cipher: true

- name: Restart Spring Boot process
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.LIGHTSAIL_HOST }}
username: ${{env.LIGHTSAIL_USERNAME}}
key: ${{ secrets.LIGHTSAIL_SSH_KEY }}
script: |
BUILD_PATH=$(ls /home/ubuntu/seamless/dist/build/libs/*.jar)
JAR_NAME=$(basename $BUILD_PATH)
CURRENT_PID=$(pgrep -f $JAR_NAME)
if [ -z $CURRENT_PID ]
then
sleep 1
else
kill -15 $CURRENT_PID
sleep 5
fi
DEPLOY_PATH=/home/ubuntu/seamless/deploy/
mkdir $DEPLOY_PATH
cp $BUILD_PATH $DEPLOY_PATH
cd $DEPLOY_PATH
DEPLOY_JAR=$DEPLOY_PATH$JAR_NAME
nohup java -jar $DEPLOY_JAR > /dev/null 2> /dev/null < /dev/null &
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,34 @@
- 다른 방법 찾는중(w5)
- 프로젝트(김도헌)
- 프로젝트 리스트 조회
- 토큰 내 유저의 email 정보를 통해 본인이 관리하는 프로젝트들을 페이지네이션을 통해 보여줌
- 프로젝트 기간 리스트 조회
- 토큰 내 유저의 email 정보를 통해 본인이 관리하는 프로젝트들의 일정 정보를 페이지네이션을 통해 보여줌
- 프로젝트 조회
- 프로젝트 Id를 통한 단일 조회
- 프로젝트 멤버 조회
- 프로젝트 Id를 통해 해당 프로젝트의 멤버들의 정보를 조회
- 현재 객체를 통해 정보를 받아 오는 것으로 되어있지만, 추후 fetch join을 활용한 방법으로 수정 예정
- 프로젝트 생성
- 프로젝트를 생성함
- 플로우 :
- email을 통해 유저가 존재하는 지 검증 ->
- DTO에 담긴 optionEntity들의 id 정보들을 통해 OptionEntity조회 ->
- OptionEntity을 ProjectOption으로 매핑 ->
- 해당 정보를 가진 ProjectEntity를 생성 후 Repo에 save ->
- 각 ProjectOption의 ProjectEntity field를 생성한 ProjectEntity로 설정
- 프로젝트 설정 수정
- 해당하는 Id의 프로젝트를 수정
- 플로우 :
- 프로젝트가 존재하는지 검증 ->
- 기존의 ProjectOption 리스트 초기화->
- DTO에 담긴 Option id들을 통해 OptionEntity 조회 ->
- OptionEntity를 ProjectOption으로 매핑 ->
- ProjectOption 리스트에 추가 ->
- 나머지 정보 업데이트 후 저장
- 프로젝트 삭제
- 해당하는 Id의 프로젝트 삭제
- 현재는 그냥 삭제를 하지만, 추후 Soft Delete 방식으로 재구현 예정
- 게스트(권순호)
- 게스트 생성
- 게스트 수정
Expand Down Expand Up @@ -99,9 +121,18 @@
- [3주차 피드백](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/pull/11)
- [4주차 리뷰](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/17)
- [4주차 멘토링](https://quickest-asterisk-75d.notion.site/Back-end_-323b0e20ae2b405189ffe5b7c4242e00)
- [5주차 리뷰](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/31)
---
# Issue
- [week4 프로젝트 빌드 실패](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/27)
- [week6 프로젝트 빌드 실패](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/39)
- [week6 구글 로그인 실패](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/41)
- [week6 멤버 생성 실패](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/42)
- [week6 pathvaliable로 값 파싱 실패](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/43)
- [week6 task 날짜 validation 오류](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/44)
- [week6 aws server 구글 로그인 실패](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/45)
- [week6 멤버 생성 권한 수정](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/46)
- [week6 task 조회 쿼리 문법 오류](https://github.com/kakao-tech-campus-2nd-step3/Team1_BE/issues/47)
---
# 질문사항
- week3
Expand All @@ -116,4 +147,7 @@
- 메일 발송 방법
- 코드 스타일
- 동시성 처리
- week5
- week5
- softDelete의 구현 방법
- 연결괸 객체의 정보를 가져오는 방법
- week6
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
runtimeOnly 'com.h2database:h2:1.4.200'
}

tasks.named('test') {
Expand Down
35 changes: 34 additions & 1 deletion src/main/java/team1/BE/seamless/DTO/MemberResponseDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,41 @@ public class MemberResponseDTO {

private String message;

public MemberResponseDTO(String message) {
private String name;

private String role;

private String email;

public MemberResponseDTO(String message, String name, String role, String email) {
this.message = message;
this.name = name;
this.role = role;
this.email = email;
}

public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getMessage() {
Expand Down
19 changes: 14 additions & 5 deletions src/main/java/team1/BE/seamless/DTO/OptionDTO.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
package team1.BE.seamless.DTO;

import team1.BE.seamless.entity.enums.OptionType;

public class OptionDTO {

public static class OptionCreate {

private String name;

private String eventType;
private String description;

private String optionType;

public OptionCreate() {

}

public OptionCreate(String name, String eventType) {
public OptionCreate(String name, String description, String optionType) {
this.name = name;
this.eventType = eventType;
this.description = description;
this.optionType = optionType;
}

public String getName() {
return name;
}

public String getEventType() {
return eventType;
public String getDescription() {
return description;
}

public String getOptionType() {
return optionType;
}

}
Expand Down
Loading

0 comments on commit eca9f81

Please sign in to comment.