전체 글
-
[keycloak] 키클락 import error 해결Infra 2024. 10. 21. 02:56
디비 이전으로 인해 keycloak 을 이전할 일이 생겼다.이 때 기존에 사용하던 렐름 정보를 새로운 키클락 서버로 이전을 해야하는데script 를 활용한 upload 가 실패하는 문제가 생겼다. 위와 같은 에러가 발생한다.이는 인터넷에서 쉽게 찾을 수 있었는데authorization setting 값을 빈 객체로 설정하면 위와 같이 에러 없이 가져오기를 할 수 있다. 이는 client 의 authorization 세팅을 없애고 가져온 것이다. 들어가보면 이와 같이 default 로 설정되어있을텐데이전 설정을 기반으로 다시 세팅해줘야 한다. 하지만 키클락 ui 를 활용한 export 로는 유저 정보를 같이 가져갈 수 없다.그렇게 하기 위해서는 내가 운영중인 컨테이너에 bash 접속하여 docker ..
-
[aws] private subnet에 있는 ec2 인스턴스의 ip 확인하기Infra/aws 2024. 10. 9. 22:21
외부 api 사용을 위해 우리 서비스의 ip를 알려줘야할 일이 있었다.지금은 ifconfig 라는 서비스을 알게 되어서 1초컷할 수 있지만(팀장님 감사합니다ㅎㅎ) curl ifconfig.me 그 때는 어떻게 해야하나 고민이었다.퇴근 직전이었기에...검증은 못하고전에 공부를 해둔 지식으로private subnet 의 아웃바운드 요청은NAT gateway를 통해서 나가게 된다는 것을 알고있어서이를 확인하여 알려드렸다. https://ryeoryeoryeo.tistory.com/6 VPC 란 무엇인가공부하기에 앞서..필자는 인프라 구축을 담당하고 있다.그러던 중 멀티 리전간의 통신을 가능하게 하기 위해VPC Peering 설정을 하려던 중무언가 잘못건드려 인터넷 통신을 끊어버렸던 전적이 있ryeoryeory..
-
[코드 컴플리트] 방어적 프로그래밍개발론 2024. 9. 26. 19:31
방어적 프로그래밍이란 무엇일까? 방어적 프로그래밍은 프로그램이 예상치 못한 상황에서도 안정적으로 동작하도록 하는 기법이다. 오류를 쉽게 찾고, 수정하기 쉽게 만들며, 프로덕션 코드에 미치는 영향을 최소화하는 것이 목적이다. a 를 넣으면 b 를 리턴하는 f1 이라는 함수가 있다고 해보자. 여기서 에러값인 a' 를 입력하면 어떻게 동작해야 할까? 책에서 말하는 내용은 다음과 같다. 소프트웨어에서 쓰레기를 넣으면 쓰레기가 나온다고 말해서는 안된다. 좋은 프로그램은 쓰레기를 입력받았다고 하더라도 절대로 쓰레기를 내뱉지 않는다. 따라서 우측처럼 잘못된 입력이 들어왔다고 시스템이 고장나거나 쓰레기값을 뱉는 것이 아닌, 그에 맞는 error 를 뱉도록 해서 외부로부터 잘못된 값을 받더라도 정상적으로 처리를 해줘야 ..
-
디버깅하는 법개발론 2024. 9. 11. 14:00
필자는 코드 컴플리트라는 책을 읽고 있다.여기서는 다음과 같이 말하고 있다. 고급 제품을 만드는 가장 좋은 방법은 요구사항을 주의 깊게 개발하고 잘 설계하고 고급 코드 작성 방법을 사용해야 한다. 디버깅은 최후의 수단이다. 뭔가 와닿지 않는다.그 이유는 내가 만들었든 외부의 프로젝트를 받아서 하든 결함이 있었고 디버깅은 언제나 해야 했기 때문이다. 그렇다면 디버깅은 어떻게 하는 것일까?어디서도 디버깅하는 법에 대해서 배워본 적이 없기 때문에그것을 어떻게 하면 잘하는 것인지 모른다. 다음은 책에서 본 4년 이상의 전문적인 개발자들이 얼마나 효과적으로 디버깅하는지 비교한 표이다. 가장 빠른 세 명의 개발자가장 느린 세 명의 개발자평균 디버깅 시간(분)5.014.1미발견된 평균 결함 수0.71.7결함 수정..
-
Virtual HostInfra 2024. 8. 20. 09:42
Virtual Host(가상 호스트)는 하나의 물리적 서버에서 여러 개의 웹사이트를 호스팅할 수 있게 해주는 기술이다. 쉽게 말해, 하나의 컴퓨터로 여러 개의 웹사이트를 운영할 수 있게 해주는 방법이다.그래서 여러 웹사이트를 위해 각각 서버를 구매하는 것보다 경제적이다. Virtual Host는 주로 두 가지 방식으로 작동한다a) Name-based Virtual Hostingb) IP-based Virtual Hosting이 중 Name-based Virtual Hosting이 더 일반적으로 사용되고 있다. virtual host 를 적용하게 된 계기는 다음과 같다. https://aws.amazon.com/ko/blogs/korea/new-aws-public-ipv4-address-charge-pub..
-
Docker 의 전체적인 동작 구조Infra/docker 2024. 8. 13. 18:49
사내 모니터링 시스템을 구축하는 업무를 맡게 되었다.처음에는 Java Management Extensions (JMX) 에서 제공하는com.sun.management.OperatingSystemMXBean 패키지를 사용하려 했다. 하지만 이는 JVM 머신의 cpu 사용량을 나타내기 때문에 운영할 컨테이너 자체의 상태는 알려주지 않았기에우리의 환경에는 어울리지 않았다. 우리는 한 ec2 인스턴스에서 여러 컨테이너를 띄우고 있었고이 각 컨테이너들의 cpu 사용량을 알고 싶었기 때문이다. 그래서 찾아보니 docker.sock 을 활용하면 이 container 의 status에 대한많은 정보를 얻을 수 있었다! 나는 docker 정확히는 몰라도 어느 정도는 알고있었다 생각했는데...docker에 대한 공부가 ..
-
DB 테이블 날아가는 것을 보며 배운 포스트 모템의 중요성개발론 2024. 7. 20. 16:48
업무를 하다보면 문제가 생기기 마련이다. 얼마 전,우리 회사에서 디비 관련한 이슈가 생겼었는데 새로오신 경력직 사원분이 포스트 모템을 요청하여우리 회사의 구조의 위험성을 발견한 적이 있었다.그래서 디비 백업을 더 주기적으로 하고계정의 분리 작업을 진행하였다. 개발자가 쉽게 prod 테이블에 접근할 수 있는 것이 문제였다. 다들 그동안 문제라는 것은 알았지만 ... 모두의 타조 증후군이었던 것이었는데결국 문제가 터지고 말았다.dev 테이블을 비워야 하는데 prod 테이블을 비우신 것이다. 다행히 작업자분이 백업해두신게 있었고truncate 이후 유저 작업이 없어 큰 일은 일어나지 않았다. 그래서 포스트 모템이 무엇인가? 포스트 모템은 프로젝트나 작업이 완료된 후, 특히 문제가 발생했을 때 이를 분..
-
한 ec2 인스턴스로 여러 서비스 배포하기 - 2 (컨테이너 배포 이후의 프로세스)Infra/aws 2024. 7. 20. 14:11
지난 포스트에서 작성한 배포 프로세스에서는 한 ec2 인스턴스에 여러 컨테이너를 올리는 작업이었다. 그럼 이제 위의 그림에서 백엔드 파트의 ELB 설정 혹은 NGINX 를 사용한 리버스 프록시를 통해배포된 컨테이너로 DNS 주소를 라우팅하는 과정을 기록하려 한다. 먼저 ELB 는 뭘까? AWS ELB (Elastic Load Balancing)은 클라우드 환경에서 여러 대의 EC2 인스턴스나 다양한 서비스들 사이에 트래픽을 분산시켜주는 서비스다.ELB는 사용자의 요청을 여러 EC2 인스턴스로 자동으로 분배하여 각 인스턴스의 부하를 고르게 분산시켜서비스의 가용성과 신뢰성을 높이는 역할을 한다.ELB의 종류나는 Application LoadBalancer 를 사용했는데 주요 기능부하 분산: ELB는 트래..