CI/CD(2) : ngrok

NOHHYEONGJUN·2024년 9월 11일

CI/CD

목록 보기
3/15

ngrok

로컬 환경에서 가상 머신에 Jenkins나 gitlab을 사용할 때, 공개 서버로 url을 제공해주는 터널링 프로그램.


 

 

 


1. ngrok 설치

macOS 기준

brew install ngrok/ngrok/ngrok

 

2. ngrok web 접속 및 토큰 확인

ngrok config add-authtoken <token>

 

3. http 터널링

ngrok http http://192.168.60.1:8080

ngrok http http://localhost:8082

여러 형태로 사용 가능!


 

 

 


ngrok process 종료 시 연결 해제

연결을 유지하고 싶다면?

 

  1. 백그라운드 실행
nohup ngrok http 192.168.60.1:8080 &

 

  1. docker container로 실행
version: '3'
services:
  ngrok:
    image: ngrok/ngrok:latest
    ports:
      - "4040:4040"
    environment:
      - NGROK_AUTHTOKEN=your_auth_token
    command: "http host.docker.internal:8081"
    restart: unless-stopped

 

 

 


동시에 여러 Port 개방

  1. yaml 파일 작성
version: "2"
authtoken : 발급 받은 토큰
tunnels:
  server:
    proto: tcp
    addr: 22
  jenkins:
    proto: http
    addr: 8080

 

  1. ngrok 실행
ngrok start --config ngrok.yaml --all

 

 

 


모니터링

http://localhost:4040

ngrok 프로세스 실행 중일때, 트래픽 모니터링 가능!


profile
Cloud/DevOps & Network Virtualization에 관심 있는 대학생입니다. 🐳

0개의 댓글