jenkins 를 이용하여 배포를 했는데, 원격지의 tomcat 을 수동으로 hostmanager 에 들어가서 stop, start 하는 것이 불편했습니다.
방법을 찾아보니, host-manager 를 rest 방식으로 액세스하는 인터페이스를 tomcat 에서 만들어두었더군요.
먼저 권한을 부여합니다.
설치디렉토리/conf/tomcat-users.xml 파일에 아래 항목을 넣습니다.
<user username="test" password="pass" roles="admin-script"/>
테스트해봅니다.
curl -u test:pass http://localhost:8080/host-manager/text/list
localhost 는 tomcat 이 설치된 곳입니다.
이제 jenkins 에서 커맨드라인 실행을 추가합니다.
먼저, 구성을 클릭해서 들어간 후,
가장 아래쪽에 Add build step 을 누른 후, Execute shell 을 2개 추가합니다.
stop 과 start 를 하나씩 추가해주면 됩니다.
curl -u test:pass http://localhost:8080/host-manager/text/stop?name=www.awesomeserver.com
curl -u test:pass http://localhost:8080/host-manager/text/start?name=www.awesomeserver.com
hostmanager CLI 참고 : https://tomcat.apache.org/tomcat-8.5-doc/host-manager-howto.html
'(Dev)Ops' 카테고리의 다른 글
AWS EKS #1 - kubectl, eksctl 설치 후 기본 클러스터 배포해보기. (0) | 2022.01.26 |
---|---|
메시지큐의 용도 & AWS SQS 와 SNS 의 차이점. (0) | 2022.01.05 |
SSH 터널링을 통해서 sftp 접속 방법. (0) | 2020.09.01 |
telnet 없이 포트 오픈 여부 체크하기. (0) | 2020.08.26 |
ansible 개요와 사용법. (0) | 2020.08.25 |