분류 전체보기
-
커다란 만능 모듈을 사용하면 만날 수 있는 함정운영 중인 서비스/Coconut. 2024. 4. 30. 17:06
여러 서비스에서 공유되는 모듈을 만들어서 사용하는 과정에서 만난 이슈를 적어봅니다.모듈을 분리하고 개별 서비스에 각각 적용하는 과정을 정리하고 있습니다. 이번 글은 아래와 같은 순서로 작성되었습니다.1. 모든 일을 하는 만능 모듈2. 만능 모듈의 단점3. 어떤 기준으로 분리할 것 인가?4. 변경 반영하기5. 정리하기 1. 모든 일을 하는 만능 모듈코코넛 서비스에 기능이 붙어가면서 점점 복잡도가 올라가고 있습니다.global이란 모듈에서 여러 서비스간에 공유되는 코드를 관리하고 있습니다.어느 순간 복잡성에 문제가 생길 것이라고 예상은 했지만 너무 빠른 시점에 찾아오고 말았습니다.. 글로벌 모듈의 build.gradle 파일의 일부입니다. 엔티티를 만들 때, 중복되는 요소들을 상속받아서 사용하기 위한..
-
왜 멀티모듈 프로젝트로 변경하려고 하는가?운영 중인 서비스/Coconut. 2024. 4. 26. 14:37
멀티 레포 형태로 프로젝트를 관리하면서 느낀 단점과 멀티모듈 형태로 개선하는 과정을 정리하였습니다. 아래의 글은 다음과 같은 순서로 작성되어있습니다.1. 최초에 여러 개의 프로젝트(멀티 프로젝트)를 만든 이유2. 멀티 프로젝트에서 발생하는 이슈3. 멀티 모듈 프로젝트로 변경 1. 최초에 여러 개의 프로젝트(멀티 프로젝트)를 만든 이유처음 프로젝트 관리 방법을 고민하면서 멀티 모듈 프로젝트를 염두에 두었으나 최종적으로는 개별 프로젝트로 만드는 방향을 선택하였습니다. 당시에는 아래의 이유로 개별 프로젝트를 여러개 만드는 것을 선택하였습니다. 1. 본인이 추가 하고 싶은 도메인이 있다면 그 부분에 대해서 독립적으로 작업할 수 있도록 만들자.2. 하나의 큰 프로젝트를 관리하기 보다는 간결한 작은 프로젝트가 더..
-
프로젝트 구조 변경을 CI/CD 파이프라인에 반영하기인프라/aws 2024. 4. 25. 18:06
기존의 싱글 모듈 프로젝트에서 CI/CD를 구축해 두었습니다. 이 프로젝트를 멀티 모듈 형태로 변경하면서 기존 프로젝트의 경로가 변경되었습니다. 이 변경된 내용을 Dockerfile과 각종 yml에 반영하는 과정을 메모합니다. 이 글은 아래와 같은 순서로 작성되었습니다.1. 현재 상황2. 파이프라인 스테이지별 수정사항 반영3. 정리하기 1. 현재 상황왼쪽의 이미지는 현재 구성되어있는 파이프라인의 모습이고 오른쪽은 프로젝트의 폴더 구조입니다.이전에 root 경로에 있던 quiz_service의 파일들이 ./quiz_service로 이동된 모습입니다. 2. 파이프라인 스테이지별 수정사항 반영1. Source Stage우선 깃 브랜치 전략부터 변경이 필요했습니다. 기존에 main quiz_service..
-
SpringBootApplication이 필요한 bean을 찾지 못하는 경우프레임워크/Spring Boot 2024. 4. 25. 00:01
싱글 모듈 형태로 작성된 프로젝트를 멀티 모듈의 형태로 변경 중에 이슈를 해결한 기록을 적어봅니다.새로 분리한 모듈이 다른 모듈에서 생성하는 bean을 인지 하지 못하는 이슈입니다.프로젝트의 실행과 테스트의 실행 두 부분으로 나눠서 살펴보겠습니다. 이 글은 다음과 같이 진행됩니다.1. 프로젝트의 실행2. 테스트 코드의 실행3. @SpringBootApplication vs @ComponentScan4. @WebMvcTest 1. 프로젝트의 실행quiz_service에 있던 RestTemplate관련 설정을 global 프로젝트로 옮겨주었습니다. 헌데 옮기고 나니 quiz_service가 실행될 때 restTemplate bean을 찾지 못하게 되었습니다. 컴포넌트 스캔 시에 global을 스캔하지 않는..
-
적절한 Serialization 방식 선택하기운영 중인 서비스/Coconut. 2024. 4. 22. 19:51
이번에 새로 추가한 기능을 배포한 후에 이슈가 발생해서 급하게 수정을 하고 기록으로 남겨봅니다. 현재 유저가 입력한 답변을 외부 api를 사용해서 채점을 하고 있습니다. 외부 api가 요구하는 형태의 JSON을 String.format을 사용하여 아래와 같이 생성하고 있었습니다. 서비스 운영 중에 한 사용자가 종종 오류가 발생한다는 것을 제보해주셨습니다. 에러 메세지를 확인해보니 요청에 전달하는 JSON에 문제가 있는 듯 합니다. "message": "We could not parse the JSON body of your request. (HINT: This likely means you aren't using your HTTP library correctly.) 아쉬웠던 부분은 예외 처리를 하면서 유..
-
무중단 배포 유지하면서 EC2 교체 하기운영 중인 서비스/Coconut. 2024. 4. 19. 21:32
최초에 모놀리식 아키텍쳐로 서비스 운영을 하도록 간단하게 인프라를 구축하였습니다. 하지만 작업하면서 MSA를 지향하게 되었고 서비스의 앞단에 프록시서버를 두기로 결정하였습니다. 이 글은 현재 배포되어 있는 커뮤니티 서비스는 중단되지 않으면서 앞단에 프록시 서버를 추가하는 과정을 적어보겠습니다. 아래 글은 다음 순서로 작성되었습니다 1. 현재 상황 - 작업을 하는 이유 2. 작업 설계 - 어떻게 작업을 진행할 것인가? 3. 작업 진행 - 3단계의 작업 진행 과정 4. 정리하기 1. 현재 상황 현재 운영 중인 커뮤니티 서비스가 사용자는 많지 않지만, 실제 유저분들이 사용하고 있는 상황입니다. 누적 조회수가 50 ~ 80정도 되는 것을 확인할 수 있습니다 ㅎㅎ ( 서비스 링크 ) 많은 유저가 사용하고 있다고 ..
-
Nginx로 HTTPS 레이어 구축하기인프라/nginx 2024. 4. 19. 21:31
기존 서비스에서 사용하던 AWS의 ALB에서 비용이 발생한다는 사실을 발견하였습니다. 현재는 단일 인스턴스를 사용하고 있는 상황이라 ALB가 하는 역할은 HTTPS 요청을 받아주는 역할 뿐이기 때문에 이번에 Nginx를 사용하는 방법으로 변경해보려고 합니다. (linux는 RHEL을 사용하고 있습니다.) 글은 다음 순서로 진행됩니다. 1. 시작하기 전에 - nginx 설치 및 작동 확인 2. 패키지 설치 - 인증서 발급에 필요한 패키지 설치 3. 인증서 발급 1. 시작하기 전에 EC2에 Nginx 설치를 합니다. // 설치 $ sudo yum update -y $ sudo yum install nginx -y // 서비스 실행 $ sudo systemctl start nginx 80 포트로 접근시 다음과..
-
Post 요청이 Redirect 되면?CS/네트워크 2024. 4. 19. 21:28
HTTP 요청이 들어오면 HTTPS 요청으로 301 Redirect를 하고 있습니다. 이 때 http로 POST 요청이 들어오면 어떻게 될까요? 1. 301 - Moved Permanently 301로 리다이렉트 하는 경우, 브라우저마다 구현이 다를 수 있으나 보통 GET 요청으로 변환되어 요청이 전달됩니다. 이 과정에서 전송하고자 하는 데이터는 전송되지 않습니다. Post를 핸들링 하는 라우터에 Get으로 요청이 가기 때문에 405 Method Not Allowed를 받을 수 있습니다. 2. 308 - Permanent Redirect 308로 리다이렉트 하는 경우, 최초 요청의 메소드와 원문을 그대로 유지한 채로 Redirect를 시킵니다. 3. 적절한 사용처 따라서 301은 url에 변경을 가할 때..