Skip to content

Commit

Permalink
Merge branch 'develop' into develop-frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeml06 authored Nov 22, 2024
2 parents 2582380 + 4abfc42 commit cb9ce0f
Show file tree
Hide file tree
Showing 520 changed files with 16,889 additions and 3,849 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/be-rolling-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Rolling Deployment

on:
push:
branches:
- main

jobs:
deploy-prod1:
name: Deploy to Prod1 Instance
runs-on: runner-prod1

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

- name: Run Prod1 instance deploy script
run: |
cd ~/deploy && ./deploy.sh
check-prod1:
name: Check Prod1 Instance
runs-on: runner-prod1
needs: deploy-prod1

steps:
- name: Wait for Prod1 instance to be ready
run: sleep 30

- name: Health check for Prod1 instance
run: |
RESPONSE=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/health)
if [ $RESPONSE -ne 200 ]; then
echo "Prod1 instance deployment failed."
exit 1
fi
echo "Prod1 instance is healthy."
deploy-prod2:
name: Deploy to Prod2 Instance
runs-on: runner-prod2
needs: check-prod1

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

- name: Run Prod2 instance deploy script
run: |
cd ~/deploy && ./deploy.sh
check-prod2:
name: Check Prod2 Instance
runs-on: runner-prod2
needs: deploy-prod2

steps:
- name: Wait for Prod2 instance to be ready
run: sleep 30

- name: Health check for Prod2 instance
run: |
RESPONSE=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/health)
if [ $RESPONSE -ne 200 ]; then
echo "Prod2 instance deployment failed."
exit 1
fi
echo "Prod2 instance is healthy."
15 changes: 0 additions & 15 deletions .github/workflows/cd-prod.yml
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
name: cd-prod

on:
push:
branches:
- develop

jobs:
deploy:
runs-on: prod

steps:
- name: deploy
run: |
cd ~/deploy && ./deploy.sh
16 changes: 9 additions & 7 deletions .github/workflows/cicd-backend-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
mkdir -p src/main/resources/firebase
echo ${{ secrets.BACKEND_FIREBASE_JSON }} > src/main/resources/firebase/serviceAccountKey.json
- name: Apple Auth Key 파일 이동
run: |
mkdir -p src/main/resources/auth
printf "%s" "${{ secrets.APPLE_AUTH_KEY }}" > src/main/resources/auth/AuthKey.p8
- name: gradlew 권한 부여
run: chmod +x ./gradlew

Expand All @@ -51,10 +56,6 @@ jobs:
runs-on: [self-hosted, develop]

steps:
- name: change permission
run: |
sudo chown -R ubuntu:ubuntu /home/ubuntu/actions-runner/_work/2024-mouda
- name: DockerHub login
uses: docker/login-action@v1
with:
Expand All @@ -63,6 +64,7 @@ jobs:

- name: Docker Compose up
run: |
docker compose -f ./backend/docker-compose.yml down mouda-be
docker compose -f ./backend/docker-compose.yml pull mouda-be
docker compose -f ./backend/docker-compose.yml up -d mouda-be
cd ~/deploy
docker compose -f docker-compose-be.yml down
docker compose -f docker-compose-be.yml pull
docker compose -f docker-compose-be.yml up -d
5 changes: 5 additions & 0 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ jobs:
mkdir -p src/main/resources/firebase
echo ${{ secrets.BACKEND_FIREBASE_JSON }} > src/main/resources/firebase/serviceAccountKey.json
- name: Apple Auth Key 파일 이동
run: |
mkdir -p src/main/resources/auth
printf "%s" "${{ secrets.APPLE_AUTH_KEY }}" > src/main/resources/auth/AuthKey.p8
- name: gradlew 권한 부여
run: chmod +x ./gradlew

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
/backend/out
/frontend/.idea
/backend/htmlReport
.DS_Store
*.pem
backend/src/main/resources/auth/AuthKey.p8

.DS_Store
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# 모여봐요 우리의 다락방
단체를 운영하면서 팀원들 간의 친밀도가 낮아서 운영에 어려움을 느끼는 경우가 있지 않으신가요? 팀원들과 함께 친해지기 어려워서 고민해 보신 적이 있나요? 모임을 만들고 싶어도 친하지 않은 사람들에게 사적으로 제안하기 어렵고, 단체의 목적에 벗어나는 주제를 꺼내기가 어려워요. 애써 모임을 만들어도 사람을 모으기도 쉽지 않아요.
# 🤝 모여봐요, 우리의 다락방 (모우다)

새 학기, 처음 만난 학술 동아리 부원들과 농구 모임을 만드는 걸 상상해 보세요. 친하지 않은 사람들에게 제안하고, 연락처를 물어 필요한 만큼의 인원수를 채우는 것이 힘들어요. 또 카카오톡, 디스코드, 슬랙으로는 약속을 확정하고 모임원들과 공유하기도 쉽지 않아요.
![1](https://github.com/user-attachments/assets/de440b71-0bdf-48cc-a222-f528be4dadb7)
![2](https://github.com/user-attachments/assets/c84f1d0b-f859-41e3-8da1-144bde6c8b55)
![3](https://github.com/user-attachments/assets/966ba62d-1fb8-4b14-99d5-9777445427ab)
![4](https://github.com/user-attachments/assets/57d69983-0046-450f-9f00-759402ab1597)
![5](https://github.com/user-attachments/assets/e04dace0-6c19-43bd-b6c9-d5d7f6e14018)
![6](https://github.com/user-attachments/assets/0da68d63-9f91-44f8-ab2e-fb255c076f00)
![7](https://github.com/user-attachments/assets/e2789931-da9a-4242-93a7-35b569833519)

만들고 싶은 모임을 언제든지 만들고 사람들이 참여할 수 있도록 홍보해 주는 서비스가 있다면 어떨까요? 자동으로 채팅방도 만들어주고 장소와 시간을 쉽게 정할 수 있게 해준다면요?
# 🛠 모우다 인프라 아키텍처

모임을 만들고 참여하는 진입 장벽을 낮추고 각자의 입장에서의 어려움을 해소하기 위해 서비스를 만들었습니다. 누구나 가볍게 모임에 참여할 수 있도록요.
![image](https://github.com/user-attachments/assets/e3dfbd96-1009-42d0-8647-347b410a7806)

모여봐요 우리의 다락방, 모우다에서 모임을 쉽고 가볍게 만들어봐요.

<br>
# 🙋‍♀️ 모우다 팀원 소개

## 💻 모우다팀
| ![상돌](https://github.com/user-attachments/assets/9817062f-6213-47fb-94b2-77dbd08b9848) | ![안나](https://github.com/user-attachments/assets/83d147df-9b80-4703-aa66-3632da8e9ba4) | ![테니](https://github.com/user-attachments/assets/cf57b0b3-3a93-4f6e-8bac-8ab65261594c) | ![테바](https://github.com/user-attachments/assets/09151d0f-7f5d-4a3f-9c89-7c8e15abbd14) | ![호기](https://github.com/user-attachments/assets/276888b2-aae7-48bf-8e0e-31b7585f2e51) | ![소파](https://github.com/user-attachments/assets/96a04e69-ffce-411d-ad94-a5c1bbe27b5f) | ![수야](https://github.com/user-attachments/assets/b4427e5c-0d8a-467c-a2dd-137a4b5aecce) | ![치코](https://github.com/user-attachments/assets/76b25466-ab62-4e91-8b84-3139f8be8b71) |
|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|
| **BE** | **BE** | **BE** | **BE** | **BE** | **FE** | **FE** | **FE** |
Expand Down
14 changes: 14 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,23 @@ dependencies {
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.awaitility:awaitility:4.2.0'

// jackson
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'

// notification
implementation 'com.google.firebase:firebase-admin:9.3.0'

//Google Oauth
implementation 'com.google.api-client:google-api-client:1.32.1'

// S3
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.773'

// monitoring
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package mouda.backend.aop.logging;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ExceptRequestLogging {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package mouda.backend.aop.logging;

import static java.util.stream.Collectors.*;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import mouda.backend.darakbangmember.domain.DarakbangMember;
import mouda.backend.member.domain.Member;

@Aspect
@Component
@Slf4j
public class RequestLoggingAspect {

@Pointcut("execution(* mouda.backend..controller.*Controller.*(..))")
public void allController() {
}

@Before("allController()")
public void logController(JoinPoint joinPoint) {
HttpServletRequest request = getHttpServletRequest();

MethodSignature signature = (MethodSignature)joinPoint.getSignature();
Method method = signature.getMethod();
if (method.isAnnotationPresent(ExceptRequestLogging.class)) {
return;
}

String uri = request.getRequestURI();
String httpMethod = request.getMethod();
String queryParameters = getQueryParameters(request);
String body = getBody(joinPoint);

String memberInfo = getMemberInfo(joinPoint);

StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(String.format("Request : %s %s", httpMethod, uri));
if (memberInfo != null) {
stringBuilder.append(String.format(", member : %s", memberInfo));
}
if (body != null) {
stringBuilder.append(String.format(", body : %s", body));
}
if (queryParameters != null) {
stringBuilder.append(String.format(", parameters : %s", queryParameters));
}
log.info(stringBuilder.toString());
}

private String getMemberInfo(JoinPoint joinPoint) {
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof Member) {
return "Member ID = " + ((Member)arg).getId();
}
if (arg instanceof DarakbangMember) {
return "DarakbangMember ID = " + ((DarakbangMember)arg).getId();
}
}
return null;
}

private HttpServletRequest getHttpServletRequest() {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes)RequestContextHolder.currentRequestAttributes();
return requestAttributes.getRequest();
}

private String getQueryParameters(HttpServletRequest request) {
String queryParameters = request.getParameterMap()
.entrySet()
.stream()
.map(entry -> "%s = %s".formatted(entry.getKey(), entry.getValue()[0]))
.collect(joining(", "));

if (queryParameters.isEmpty()) {
return null;
}
return queryParameters;
}

private String getBody(JoinPoint joinPoint) {
MethodSignature methodSignature = (MethodSignature)joinPoint.getSignature();
Parameter[] parameters = methodSignature.getMethod().getParameters();
Object[] args = joinPoint.getArgs();
for (int i = 0; i < parameters.length; i++) {
Parameter param = parameters[i];
Object arg = args[i];
if (param.isAnnotationPresent(RequestBody.class)) {
return arg.toString();
}
}
return null;
}
}
Loading

0 comments on commit cb9ce0f

Please sign in to comment.