Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#83 플레이리스트 서버에 음원 서버를 연동합니다. #85

Merged
merged 48 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
69ec2bf
hotfix: chatting-server 충돌 해결
suakang17 Feb 16, 2024
f45aa5e
infra: restore
kor-Chipmunk Feb 16, 2024
ee739d8
Merge pull request #78 from sgdevcamp2023/resolveconflict#chatting
kor-Chipmunk Feb 16, 2024
35f2d44
refactor: get userinfo 메시지 변경
happysoy Feb 16, 2024
752a077
Merge pull request #79 from sgdevcamp2023/feat/#71
happysoy Feb 16, 2024
eb20a29
feat: chatting API 라우팅 수정
kor-Chipmunk Feb 16, 2024
14cf2bc
fix: streaming white list 수정
kor-Chipmunk Feb 16, 2024
b5728da
refactor: `authorization` 변수명 수정
kor-Chipmunk Feb 16, 2024
048911b
fix: `chatting` 라우팅 Path 수정
kor-Chipmunk Feb 16, 2024
4d5b08f
feat: `DiscoveryClientConfig` 클래스 추가
kor-Chipmunk Feb 16, 2024
25a6fc6
refactor: jwtToken 변수로 빼기
kor-Chipmunk Feb 16, 2024
afb8398
feat: 공통 모듈을 common & mvc & reactive 모듈로 분리
kor-Chipmunk Feb 17, 2024
abad391
chore: alarm 서버 MVC 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
7d0fabe
chore: auth 서버 MVC 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
d098696
chore: chart 서버 Reactive 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
46896fa
chore: feed 서버 mvc 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
aae9bbb
chore: gateway 서버 reactive 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
7353a1a
chore: music 서버 mvc 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
46ed672
chore: playlist 서버 mvc 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
0d64edc
chore: user 서버 mvc 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
7e7e10f
feat: gateway Streaming 라우팅 제거
kor-Chipmunk Feb 17, 2024
4366e3d
chore: gateway netty & websocket enabled 설정
kor-Chipmunk Feb 17, 2024
bf508ee
chore: gateway discovery 사용
kor-Chipmunk Feb 17, 2024
0071a57
chore: apple chip 에서 발생하는 dns 오류 해결 의존성 추가
kor-Chipmunk Feb 17, 2024
fb4e2ac
feat: gateway `WebSocketHandler` 등록
kor-Chipmunk Feb 17, 2024
534912f
chore: 누락된 음원 추가
kor-Chipmunk Feb 17, 2024
4fb8ba2
chore: music MySQLDialect 수정
kor-Chipmunk Feb 17, 2024
f496ed7
feat: streaming reactive 공통 모듈 적용
kor-Chipmunk Feb 17, 2024
318dc78
feat: 스트리밍 서버 `TRACK_CHANGED` 이벤트 추가 & 공통 에외 적용 & MVC 모듈 적용
kor-Chipmunk Feb 17, 2024
8a8555a
feat: Reactive Feign 적용
kor-Chipmunk Feb 18, 2024
2ac0571
feat: chatting 라우팅 sockjs, websocket `ws-chat` 라우팅 추가
kor-Chipmunk Feb 18, 2024
ed50ff7
infra: Docker-compose 환경 분리 및 스크립트 추가
kor-Chipmunk Feb 18, 2024
659d406
feat: gateway reactive open feign 설정으로 변경
kor-Chipmunk Feb 18, 2024
db68ddc
chore: music sql 순서 숫자로 구분하도록 이름 변경
kor-Chipmunk Feb 19, 2024
2a615e7
feat: auth JWT_TOKEN_EXPIRED 예외 추가
kor-Chipmunk Feb 19, 2024
381451d
fix: ResponseAdvice Swagger 와 충돌나서 삭제
kor-Chipmunk Feb 19, 2024
f830b05
feat: ErrorCode 에 `JWT_TOKEN_EXPIRED` 오류코드 추가
kor-Chipmunk Feb 19, 2024
c56cfd9
feat: music `getMusicFromIds` API 추가
kor-Chipmunk Feb 19, 2024
19b9487
infra: docker-compose 설정 수정
kor-Chipmunk Feb 19, 2024
8b2938a
feat: playlist `DiscoveryClientConfig` 추가
kor-Chipmunk Feb 19, 2024
5c109db
feat: `OpenFeignConfig` 설정 추가
kor-Chipmunk Feb 19, 2024
74b2b10
feat: playlist `FeignResponseDecoderConfig` 추가
kor-Chipmunk Feb 19, 2024
30b7f71
feat: 음원 DTO 추가
kor-Chipmunk Feb 19, 2024
6325d26
feat: 음원 서버와 연동하는 feign client 추가
kor-Chipmunk Feb 19, 2024
2790603
feat: playlist 음원 openfeign 연동 서비스 로직 추가
kor-Chipmunk Feb 19, 2024
e7a282c
refactor: `PLAYLIST_NOT_FOUND` 예외 추가 & `orElseThrow` 구조로 리팩터링
kor-Chipmunk Feb 19, 2024
35f3241
chore: playlist 서버 포트 16000 으로 수정 / db 정보 yml 수정
kor-Chipmunk Feb 19, 2024
c855730
refactor: `GlobalExceptionHandler` 사용하도록 오류 응답 코드 제거
kor-Chipmunk Feb 19, 2024
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
30 changes: 30 additions & 0 deletions src/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,33 @@
- [음원 업로더 서버](./music-uploader-server/README.md) : [kor-Chipmunk](https://www.github.com/kor-Chipmunk)
- [알림 서버](./alarm-server/README.md) : [kor-Chipmunk](https://www.github.com/kor-Chipmunk)
- [파일(스토리지) 서버](./storage-server/README.md) : [kor-Chipmunk](https://www.github.com/kor-Chipmunk)

### 도커 파일 종류

1. `docker-compose.yml`
- 로컬 개발용 with IntelliJ
- 서버 앱을 제외한 리소스
- DNS : 서버 앱에서 Host DNS 으로 따름
- 새로 빌드 및 기존 빌드로 실행
- `./scripts/start_docker.sh`
2. `docker-compose-local.yml`
- 로컬 도커 테스트용
- 서버 앱 포함
- 도커 허브 올리기 전 정상 동작 확인용
- DNS : Docker ServiceName DNS 에 따름. 관련한 엔드포인트 설정 파일에서 환경변수로 넣어줘야 함.
- 새로 빌드 및 기존 빌드로 실행
- `./scripts/start_docker_local.sh`
- 새로 빌드하여 실행
- `./scripts/start_docker_local_build.sh`
3. `docker-compose-hub.yml`
- 도커 허브에 빌드된 앱 포함
- DNS : Docker ServiceName DNS 에 따름. 관련한 엔드포인트 설정 파일에서 환경변수로 넣어줘야 함.
- 새로 빌드 및 기존 빌드로 실행
- `./scripts/start_docker_hub.sh`

* 스크립트 권한 오류 : `chmod +x ./scripts/*`

* Docker ServiceName DNS : localhost:10000) (X) music-app:10000 (O)
- 포트는 호스트(개인 컴퓨터)에 매핑된 주소가 아닌, 도커 컨테이너 내부에 생성되는 주소로 설정 (eg. chart-app 이 10000:8080 이면, chart-app:10000 (X), chart-app:8080 (O) )
- host.docker.internal 을 사용하는 경우 호스트에 매핑된 포트로 매핑
* Host DNS : 호스트(개인 컴퓨터)에 매핑된 포트로 연결. chart-app:8080 (X), localhost:10000 (O)
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
package com.lalala.alarm;

import com.lalala.aop.AuthenticationContext;
import com.lalala.config.KafkaConsumerConfig;
import com.lalala.config.KafkaProducerConfig;
import com.lalala.mvc.aop.PassportAspect;
import com.lalala.mvc.config.CommonMvcModuleConfig;
import com.lalala.mvc.exception.GlobalExceptionHandler;
import com.lalala.mvc.response.BaseResponseBodyAdvice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;

@Import({
CommonMvcModuleConfig.class,
AuthenticationContext.class,
PassportAspect.class,
KafkaConsumerConfig.class,
KafkaProducerConfig.class,
BaseResponseBodyAdvice.class,
GlobalExceptionHandler.class,
})
@SpringBootApplication
public class AlarmApplication {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,35 @@ rabbitmq:
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: "jdbc:mysql://localhost:29000/alarm"
url: jdbc:mysql://localhost:28100/alarm
username: root
password: admin

rabbitmq:
host: localhost
username: admin
password: admin
port: '28300'
port: 28300
listener:
simple:
default-requeue-rejected: 'false'

jpa:
database-platform: org.hibernate.dialect.MySQLDialect
hibernate:
ddl-auto: validate
ddl-auto: create
properties:
dialect: org.hibernate.dialect.MySQLDialect
hibernate:
format_sql: true
show_sql: true
use_sql_comments: true

kafka:
bootstrap-servers: localhost:40000,localhost:40001,localhost:40002
consumer:
group-id: alarm-group

logging:
pattern:
level: "%5p [%X{traceId:-},%X{spanId:-}]"
Expand Down
7 changes: 7 additions & 0 deletions src/backend/alarm-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jar {
}

subprojects {
if (project.name.startsWith("common")) {
return
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
Expand All @@ -39,6 +43,9 @@ subprojects {
}

dependencies {
implementation project(":common-module:common")
implementation project(":common-module:common-mvc")

// spring mvc
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
4 changes: 2 additions & 2 deletions src/backend/alarm-server/docker-compose-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
ports:
- 28000:28000
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://alarm-mysql:3306/user?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
SPRING_DATASOURCE_URL: jdbc:mysql://alarm-mysql:3306/alarm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: admin
SPRING_DATASOURCE_DRIVER-CLASS-NAME: com.mysql.cj.jdbc.Driver
Expand Down Expand Up @@ -46,7 +46,7 @@ services:
- 28100:3306
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: user
MYSQL_DATABASE: alarm
TZ: Asia/Seoul
command:
- --character-set-server=utf8mb4
Expand Down
83 changes: 83 additions & 0 deletions src/backend/alarm-server/docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
version: "3.9"
services:
alarm-app:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 28000:28000
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://alarm-mysql:3306/alarm?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: admin
SPRING_DATASOURCE_DRIVER-CLASS-NAME: com.mysql.cj.jdbc.Driver

SPRING_JPA_PROPERTIES_DIALECT: org.hibernate.dialect.MySQLDialect

SPRING_MAIL_HOST: smtp.gmail.com
SPRING_MAIL_USERNAME: [email protected]
SPRING_MAIL_PASSWORD: b3^weK*zh47gZxm5

SPRING_DATA_REDIS_HOST: alarm-redis
SPRING_DATA_REDIS_PORT: 6379

SPRING_KAFKA_BOOTSTRAP-SERVERS: Kafka00Service:9092,Kafka01Service:9092,Kafka02Service:9092

EUREKA_INSTANCE_HOSTNAME: localhost
EUREKA_CLIENT_SERVICE-URL_DEFAULTZONE: http://discovery-app:34100/eureka

PASSPORT_ALGORITHM: HmacSHA256
PASSPORT_KEY: SECRET_KEY

MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: http://infra-zipkin:9411/api/v2/spans

SPRING_RABBITMQ_HOST: alarm-rabbitmq
SPRING_RABBITMQ_PORT: 5672
depends_on:
- alarm-mysql
- alarm-redis
- alarm-rabbitmq
networks:
- default
- lalala-network

alarm-mysql:
image: mysql:8.2.0
restart: always
ports:
- 28100:3306
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: alarm
TZ: Asia/Seoul
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
volumes:
- ./.docker/mysql/:/var/lib/mysql
- ./infra/:/docker-entrypoint-initdb.d

alarm-redis:
image: redis:7.0
ports:
- 28200:6379

alarm-adminer:
image: adminer
restart: always
ports:
- 29900:8080

alarm-rabbitmq:
image: rabbitmq:3.10-management
ports:
- "28300:5672"
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin

networks:
lalala-network:
driver: bridge
external: true
43 changes: 1 addition & 42 deletions src/backend/alarm-server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,13 @@
version: "3.9"
services:
alarm-app:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 28000:28000
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://alarm-mysql:3306/user?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: admin
SPRING_DATASOURCE_DRIVER-CLASS-NAME: com.mysql.cj.jdbc.Driver

SPRING_JPA_PROPERTIES_DIALECT: org.hibernate.dialect.MySQLDialect

SPRING_MAIL_HOST: smtp.gmail.com
SPRING_MAIL_USERNAME: [email protected]
SPRING_MAIL_PASSWORD: b3^weK*zh47gZxm5

SPRING_DATA_REDIS_HOST: alarm-redis
SPRING_DATA_REDIS_PORT: 6379

SPRING_KAFKA_BOOTSTRAP-SERVERS: Kafka00Service:9092,Kafka01Service:9092,Kafka02Service:9092

EUREKA_INSTANCE_HOSTNAME: localhost
EUREKA_CLIENT_SERVICE-URL_DEFAULTZONE: http://discovery-app:34100/eureka

PASSPORT_ALGORITHM: HmacSHA256
PASSPORT_KEY: SECRET_KEY

MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: http://infra-zipkin:9411/api/v2/spans

SPRING_RABBITMQ_HOST: alarm-rabbitmq
SPRING_RABBITMQ_PORT: 5672
depends_on:
- alarm-mysql
- alarm-redis
- alarm-rabbitmq
networks:
- lalala-network

alarm-mysql:
image: mysql:8.2.0
restart: always
ports:
- 28100:3306
environment:
MYSQL_ROOT_PASSWORD: admin
MYSQL_DATABASE: user
MYSQL_DATABASE: alarm
TZ: Asia/Seoul
command:
- --character-set-server=utf8mb4
Expand Down
10 changes: 10 additions & 0 deletions src/backend/alarm-server/scripts/start_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

script_dir="$(cd "$(dirname "$0")" && pwd)"

cd "$script_dir"

cd ..

docker-compose down
docker-compose up -d
10 changes: 10 additions & 0 deletions src/backend/alarm-server/scripts/start_docker_hub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

script_dir="$(cd "$(dirname "$0")" && pwd)"

cd "$script_dir"

cd ..

docker-compose -f docker-compose-hub.yml down
docker-compose -f docker-compose-hub.yml up -d --build
10 changes: 10 additions & 0 deletions src/backend/alarm-server/scripts/start_docker_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

script_dir="$(cd "$(dirname "$0")" && pwd)"

cd "$script_dir"

cd ..

docker-compose -f docker-compose-local.yml down
docker-compose -f docker-compose-local.yml up -d
10 changes: 10 additions & 0 deletions src/backend/alarm-server/scripts/start_docker_local_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

script_dir="$(cd "$(dirname "$0")" && pwd)"

cd "$script_dir"

cd ..

docker-compose -f docker-compose-local.yml down
docker-compose -f docker-compose-local.yml up -d --build
12 changes: 12 additions & 0 deletions src/backend/alarm-server/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
rootProject.name = 'alarm'

include 'alarm-api'

include ':common-module'
project(':common-module').projectDir = file('../common-module')

include ':common-module:common'
project(':common-module:common').projectDir = file('../common-module/common')

include ':common-module:common-mvc'
project(':common-module:common-mvc').projectDir = file('../common-module/common-mvc')

include ':common-module:common-reactive'
project(':common-module:common-reactive').projectDir = file('../common-module/common-reactive')
3 changes: 2 additions & 1 deletion src/backend/auth-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ repositories {
}

dependencies {
implementation project(":common-module")
implementation project(":common-module:common")
implementation project(":common-module:common-mvc")

// Spring MVC
implementation "org.springframework.boot:spring-boot-starter-web"
Expand Down
44 changes: 44 additions & 0 deletions src/backend/auth-server/docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: "3.9"
services:
auth-app:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 10000:10000
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://user-mysql:3306/lalala?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: admin
SPRING_DATASOURCE_DRIVER-CLASS-NAME: com.mysql.cj.jdbc.Driver

SPRING_JPA_PROPERTIES_DIALECT: org.hibernate.dialect.MySQLDialect

SPRING_DATA_REDIS_HOST: auth-redis
SPRING_DATA_REDIS_PORT: 6379

SPRING_KAFKA_BOOTSTRAP-SERVERS: Kafka00Service:9092,Kafka01Service:9092,Kafka02Service:9092

EUREKA_INSTANCE_HOSTNAME: auth-app
EUREKA_CLIENT_SERVICE-URL_DEFAULTZONE: http://discovery-app:34100/eureka

PASSPORT_ALGORITHM: HmacSHA256
PASSPORT_KEY: SECRET_KEY

MANAGEMENT_ZIPKIN_TRACING_ENDPOINT: http://infra-zipkin:9411/api/v2/spans
depends_on:
- auth-redis
networks:
- default
- lalala-network

auth-redis:
image: redis:7.0
ports:
- 10100:6379

networks:
lalala-network:
driver: bridge
external: true
Loading
Loading