Developer/Posting

Jenkins Port 변경하기_최신판 (젠킨스 2.332 버전 이상이라면 봐야함)

codingzipsa 2022. 5. 3. 22:16
반응형

이전에 CI/CD 환경은 여러번 구축해보았지만 최근 외주 프로젝트 서버 내 CI/CD 환경을 구축해보면서 겪은 일이다. (서버 OS는 우분투 18.04)

 

젠킨스는 기본 포트를 8080으로 쓰고 있어 포트가 중복될 확률이 좀 높은 편이다. (대표적으로 톰캣) 그래서 이전에 구축할 당시에는 아래 이동욱님 블로그처럼 설정파일에서 포트번호를 변경해주었었다.

 

https://jojoldu.tistory.com/354

 

Jenkins Port 변경하기

Jenkins의 기본 포트는 8080입니다. 사정상 한대의 서버에 이것저것 설치해서 쓸 경우 8080포트는 사용하기 어렵습니다. (Upsource, Tomcat 등 대부분의 소프트웨어는 8080 포트를 기본으로 쓰고 있습니다

jojoldu.tistory.com

 

하지만 위 방식대로 몇번을 해보고 잘못한 부분이 없는지 여러번 체크를 해보았음에도 포트번호는 여전히 변경되지 않았다.

 

국내외 블로그 및 자료들을 리서치를 해보아도 이와 관련된 내용이 나오지 않았으며, 혹시 젠킨스 버전이 업그레이드되면서 해당 설정 관련해서 변경이 되었는지 찾아보았다.

 

https://www.jenkins.io/changelog/

 

Changelog

Changelog Legend: security fix major bug fix bug fix major enhancement enhancement Community feedback: no major issues notable issues required rollback What's new in 2.345 (2022-04-25) Refresh the login and signup page. (issue 68293) Remove unnecessary pad

www.jenkins.io

 

한참 리서칭해본 결과, 포트 설정 관련하여 유의미해보이는 로그와 이슈 내역을 찾게 되었고, 이슈 커밋이 2.339버전 릴리즈에 앞서 병합된 것을 확인하였다.

 

https://github.com/jenkinsci/packaging/pull/296/files

 

[JENKINS-68007] Prefer `--httpPort` from `JENKINS_ARGS` over `HTTP_PORT` when the two differ by basil · Pull Request #296 · je

Problem Originally reported in #295 (thanks @nomis!). I distilled the problem statement from that PR into a set of steps to reproduce, expected result, and actual result in JENKINS-68007. Note that...

github.com

https://issues.jenkins.io/browse/JENKINS-68007

 

[JENKINS-68007] Prefer --httpPort from JENKINS_ARGS over HTTP_PORT when the two differ - Jenkins Jira

Steps to reproduce On Debian, migrate from an installation with HTTP_PORT=9999 # Garbage, only used by old Debian system V init script to check if the port was in use, not to actually start Jenkins JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=80

issues.jenkins.io

이에 해당하는 수정은 위 링크에서와 같이 젠킨스 하위의 override.conf에 해당내용을 작성, 반영해주면 된다. 즉, 각 OS에 해당하는 경로로 이동, override.conf 내 [service] 부분에 포트를 명시해주면 된다.

자세한 내용은 아래 링크를 가져왔으니 참조하면 될 것 같다.

[Service]
Environment="JENKINS_PORT=9999"

https://www.jenkins.io/doc/book/system-administration/systemd-services/

 

Managing systemd services

Beginning with Jenkins 2.332.1 and Jenkins 2.335, the Linux package installers use systemd to manage services. The RPM and deb package installers migrate configuration settings from System V init to systemd overrides.

www.jenkins.io

 

맨처음에는 기존에 알던대로 빠르게 세팅해야지 했으나 되지 않아 당황스러웠는데 사용하는 프로덕트나 기술에 발전에 있어 알고 있는 내용임에도 적용이 안될 수 있다는 점을 다시 한번 되새기게 되었다.

 

즉, 개발자로서의 숙명...항상 해보고 새롭게 배움을 얻어야된다는 것을 다시금 일깨우는 계기가 되었다.

 

끝!

반응형