분류 전체보기
-
단일 진입점으로 개별 서비스의 Swagger 접근하기운영 중인 서비스/Coconut. 2024. 4. 13. 22:02
서비스의 진입점에 Nginx를 사용하여 리버스 프록시 서버를 사용하고 있습니다. 퀴즈 서비스와 커뮤니티 서비스에 떠있는 Swagger를 단일 진입점에서 접근가능하도록 설정하는 과정을 정리하고있습니다. (실제 서비스 swagger 주소는 블로그 작성 이후 변경하였습니다~ 접근하지말아주세요~) 1. 기존 URI를 proxy_pass로 전달하는 방법 프로젝트를 구성하면서 Nginx를 앞단에 리버스 프록시 서버로 사용하고 있습니다. /answer의 경우 처럼 기존에는 host 주소만 변경해서 라우팅을 처리하고 있었습니다. 각 서비스에 정의되어있는 swagger를 연결하기 위해서 위와 같이 연결을 하였더니 바로 에러가 발생합니다. proxy_pass에 location과 동일한 regex가 들어있으면 안된다고 이야..
-
RHEL에서 port에 실행 중인 프로세스 확인하기인프라/linux 2024. 4. 12. 16:09
80포트에 도커 컨테이너를 띄우려고 하는데 자꾸 이미 80 포트에 프로세스가 있다고 이야기합니다. 아무리 생각해도 80에 띄워놓것이 없는데 이상하여 한번 찾아봅니다. $ lsof -i :80 맥에서는 기본으로 설치되어있어서 별 생각없이 사용했는데 RHEL에서는 yum으로 별도의 설치가 필요한 패키지인 것 같습니다. 그렇다면 다른 명령어로 확인해봅니다. $ sudo ss -tulpn | grep :80 며칠 전에 테스트를 위해 띄워놓은 nginx가 문제였습니다. PID 1049번에서 Nginx가 실행 중이니 해당 프로세스를 제거해보겠습니다. $ sudo kill 1048 제거 되지 않고 다른 프로세스에서 다시 살아납니다? Nginx 를 종료하는 명령어로 정지시켜봅니다. $ sudo nginx -s stop..
-
보조 계정으로 ECR에서 Push / Pull 하기인프라/aws 2024. 4. 10. 00:27
ECR에 권한을 부여하는 페이지가 2종류가 있습니다. 다음 번에는 여기서 헤매지 않기 위해 글로 남깁니다. 글을 진행하기에 앞서서, ECR repository를 가지고 있는 계정을 main 계정이라고 부르고, push/pull을 하려는 계정을 sub 계정이라고 정리하고 시작하겠습니다. 아래의 글은 다음의 순서로 진행됩니다. 1. Push를 하려는 서비스에서 사용하는 권한 확인하기 2. Repository를 가지고 있는 계정에서 권한을 부여하기 3. Push를 하는 측 권한 수정하기 4. 확인하기 1. Push를 하려는 서비스에서 사용하는 권한 확인하기 sub계정의 CodePipeline에서 CodeBuild stage가 ECR에 접근해야하는 상황입니다. 따라서 현재 CodeBuild에 적용되어있는 Rol..
-
Multi Module Project 생성하기빌드 자동화 도구/Gradle 2024. 4. 8. 03:34
프로젝트 진행 중에 서비스 별로 레포지토리를 생성하여 관리하니, 공통으로 들어가는 코드들의 중복이 발생하는 것을 느낄 수 있었습니다. 그래서 프로젝트를 멀티모듈의 형태로 바꾸고 한 개의 레포지토리에서 관리해야겠다고 생각하던 차에, 실제 프로젝트에 적용하기에 앞서서 연습삼아 한번 멀트 모듈 프로젝트를 만들어보겠습니다. 이 프로젝트는 블로의 Junit에 사용될 프로젝트 입니다 아래의 글은 다음의 순서로 작성되었습니다. 1. 시작하기 전에 2. setting.gradle 설정하기 3. build.gradle 설정하기 4. 동작 확인하기 1. 시작하기 전에 현재 디렉토리 구성은 이렇습니다. /Junit/concurrency /concurrency 경로에는 테스트 작성을 위해서 스프링부트 프로젝트를 생성해 두었습..
-
왜 Minor GC는 S0과 S1을 두고 사용하는가?엔진/JVM 2024. 4. 7. 18:53
매주 진행하고 있는 스터디의 이번 주 주제는 'JVM의 GC' 였습니다~ 잘 정리된 블로그 글을 읽다가 생긴 궁금증에 대한 내용을 적어봅니다. 아래의 글은 다음과 같은 순서로 작성되었습니다. 1. Heap의 사용 2. 왜 S0과 S1을 구분하는가 1. JVM에서 Heap의 사용 1. Heap의 공간 구분 JVM은 Heap을 크게 Young과 Old로 공간을 나눠서 구분하고, Young을 다시 Eden과 S0, S1의 형태로 나눠서 메모리를 관리합니다. 2. 공간 구분의 기준? Heap을 설계할 때 아래의 2가지를 전제로 두고 만들어졌습니다. (Genertaional Hypothesis) 1. 대부분의 객체는 금방 접근 불가능한 상태가된다. (Weak Generational Hypothesis) 대부분의 ..
-
Nginx 로그 살펴보기 ( feat. 웹 스캐닝 )운영 중인 서비스/Coconut. 2024. 4. 7. 17:07
프로젝트에 새로운 도메인을 MSA 형태로 추가하기 위해서 앞단에 Nginx를 사용해서 프록시 서버를 구축하였습니다. 잘 작동하던 서버가 어느날 안되는 것을 발견하여 로그를 살펴보고 많은 일들이 일어나고 있다는 것을 발견하고 글을 써봅니다. 아래의 글은 다음과 같은 구성으로 작성되어있습니다. 1. 현재 Nginx 설정 구성 2. 로그 살펴보기 3. 대응하기 1. 현재 Nginx 설정 구성 아래와 같이 conf를 구성하여서 들어오는 프록시 서버로 들어오는 요청에 대해 access_log를 남기고 매칭되는 주소로 라우팅을 진행합니다. 2. 로그 살펴보기 인프라 세팅 이후 로컬에서 작업을 했기 때문에 한동안 요청을 한 적이 없음에도 로그가 많이 쌓여있어서 로그를 살펴보았습니다. gz 확장자를 갖는 로그를 살펴볼..
-
corretto17 openjdk에서 발생한 인코딩 이슈해결 (error: error while writing...)운영 중인 서비스/Coconut. 2024. 3. 29. 02:25
Code Build 환경에서 사용되는 corretto17에서 한글로 작성된 클래스 이름을 인식하지 못하는 이슈를 해결하는 과정입니다. 한글로 작성된 클래스 이름을 영문으로 변경하는 방법과 jdk를 바꾸는 방법을 선택할 수 있었고, 그 중 실행환경과 동일한 jdk로 변경하는 방법으로 해결한 내용을 정리한 글입니다. 이 글은 아래 3가지로 구성 되어있습니다. 1. 문제의 발생 2. 시도해본 해결책 2가지 3. 해결 및 정리 1. 문제의 발생 테스트를 작성할 때는 해당 테스트 케이스를 설명하는 이름을 짓는데, 이 때 한글을 사용하는 것이 보다 보기에 편하다는 의견을 받은 적이 있습니다. 그래서 테스트 관련 클래스에서는 한글을 일정부분 사용하고 있습니다. 작성된 코드는 작업하는 로컬환경에서는 테스트와 빌드가 문..
-
InvalidUseOfMatchersException프레임워크/JUnit 2024. 3. 27. 09:05
테스트 작성하면서 발생한 에러 중 종종 만나는 예외를 정리해봅니다. mockMvc를 사용하고 있고 아래와 같은 헬퍼함수를 하나 작성해서 공통으로 사용 중에 있습니다. private ResultActions patchAndVerify(String id, String body) throws Exception { return mockMvc.perform(patch(baseUrl + "/" + id) .contentType(MediaType.APPLICATION_JSON) .content(body) ); } 수정하기 api의 컨트롤러에 대한 테스트를 작성하고 있습니다. when() 절에서 any(JobPostingEditReq.class)를 사용하기 때문에 입력에 따른 결과값의 형태는 serviceTest에거 ..