윈도우에서 Sentry (On-Premise) 구축

Dev Smile·2024년 5월 24일
1

sentry를 윈도우 환경에서 구축하기 위해 단순히 docker build를 하였을 때, 윈도우 환경과 리눅스 환경의 차이로 인해 발생한 에러를 해결하기 위해 이리저리 시도해 본 구축 진행기입니다.


TL;DR

  1. WSL 환경에서 진행
  2. 권장 사양 준수
    • 4 CPU cores
    • 16 GB RAM
    • 20 GB free disk storage space
  3. dos2unix 이용하여 줄바꿈 형식 변환
    find . -type f -print0 | xargs -0 dos2unix
  1. 이왕이면 Linux 기반 환경에서 구축하자..

  1. https://develop.sentry.dev/self-hosted/ 을 따라 시작

    # Assuming current latest version is 24.1.0
    # Current actual version can be acquired from the Releases page on GitHub
    VERSION="24.1.0"
    git clone https://github.com/getsentry/self-hosted.git
    cd self-hosted
    git checkout ${VERSION}
    sudo ./install.sh
  2. WSL 환경에서 실행 (docker와 docker-compose가 설치되어있는 상황)

    1. "./install.sh" 명령어를 WSL 환경에서 실행하니 아래와 같은 에러 문구가 발생 : /usr/bin/env: ‘bash\r’: No such file or directory

      1. 원인
        1. 스크립트 파일의 줄바꿈 형식(CRLF)이 Unix/Linux 시스템에서 인식되지 않기 때문에 발생
        2. Windows에서는 줄바꿈을 CRLF (\r\n)로, Unix/Linux에서는 LF (\n)로 사용
        3. 이 문제는 Windows에서 생성된 파일이 Unix/Linux 환경에서 실행될 때 자주 발생
      2. 해결 방법 : dos2unix 명령어 사용
        1. dos2unix 설치

          sudo apt-get update
          sudo apt-get install dos2unix
        2. install.sh 파일의 줄바꿈 형식 변환

          dos2unix install.sh
        3. 그러나 install 폴더 내에 sh 파일도 다 변환해주어야 함.

          find . -type f -print0 | xargs -0 dos2unix
    2. 다른 에러도 발생

      • relay/config.yml already exists, skipped creation.
        invalid project name "sentry-self-hosted\r": must consist only of lowercase alphanumeric characters, hyphens, and underscores as well as start with a letter or number
        Error in install/ensure-relay-credentials.sh:27.
        '$dc pull relay' exited with status 15
        -> ./install.sh:main:26
        --> install/ensure-relay-credentials.sh:source:27
      • ~/.docker/config.json 에서 credsStore를 credStore 로 변경
    3. 이메일 패스워드 지정

    4. 실행

      1. docker-compose up -d

      2. docker ps

      3. Vmmem이 화냄

      4. http://localhost:9000/ 접속이 안 됨 (504 Gateway Time-out 에러)

      5. 도커 로그 확인

        1. docker ps ← container id 확인

        2. docker logs -f {container id}

        3. nginx 로그 확인

          1. Sentry의 Nginx 프록시가 Sentry 웹 서비스에서 응답을 받지 못함

      6. docker-compose 재시작

        1. docker-compose restart
        2. 동일 에러로 접속 안 됨
      7. 접속 주소가 잘못됐었음

        1. http://127.0.0.1:9000/

        2. 설정한 ID, Password로 접속

          1. ..? 502 Bad Gateway 에러 발생

          2. 504도 발생

      8. URL 문제가 아니라 자원 문제 같기도 해서 wslconfig 수정

        1. processors, memory 제한
      9. wsl, docker desktop 재시작

        1. wsl --shutdown
        2. wsl
      10. sentry 재실행

        1. docker-compse up -d

        2. Vmmem이 덜 화냄

        1. 근데 실행이 안 됨

      11. wslconfig 수정

        1. processors, memory 권장 사항으로 추가

          1. CPU 코어 4개
          2. 16GB RAM
        2. 쾌-적

        3. 메모리 괴물

  3. 기존 vue 프로젝트에 sentry 설정 추가

    1. https://docs.sentry.io/platforms/javascript/guides/vue/#install
  4. 결과

    1. 에러 메세지 예시

    2. session replay 기능

      1. 정보는 암호화되고 유저 인터랙션을 보여줌

    2. 콘솔창, network도 확인 가능

0개의 댓글

관련 채용 정보