티스토리 뷰

728x90
728x170

본 포스팅에서는 Jenkins 설치 가이드에 대해 살펴보겠습니다.

전형적인 Legacy 환경의 Web Application Server의 Continuous Delivery & Continuous Deploy 구성을 위한 Jenkins를 구성하여 github와 was 간의 자동 배포 환경을 구성하는데 목적이 있습니다.

 

1) Jenkins 다운로드 및 구성

먼저 Jenkins 기동을 위한 파일을 다운로드 받습니다. (wget http://mirrors.jenkins.io/war/latest/jenkins.war)

[root@kubemaster ~]# wget http://mirrors.jenkins.io/war/latest/jenkins.war 
--2019-09-21 15:53:03--  http://mirrors.jenkins.io/war/latest/jenkins.war 
Resolving mirrors.jenkins.io (mirrors.jenkins.io)... 52.202.51.185 
Connecting to mirrors.jenkins.io (mirrors.jenkins.io)|52.202.51.185|:80... connected. 
HTTP request sent, awaiting response... 302 Found 
Location: http://mirror.serverion.com/jenkins/war/2.195/jenkins.war [following] 
--2019-09-21 15:53:04--  http://mirror.serverion.com/jenkins/war/2.195/jenkins.war 
Resolving mirror.serverion.com (mirror.serverion.com)... 94.228.210.101 
Connecting to mirror.serverion.com (mirror.serverion.com)|94.228.210.101|:80... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: 78319303 (75M) 
Saving to: jenkins.war
100%[==========================================================] 78,319,303   589KB/s   in 2m 4s   
2019-09-21 15:55:12 (617 KB/s) - jenkins.war [78319303/78319303] 
[root@kubemaster ~]#

다음으로 Jenkins를 설치하기 위한 환경 구성 및 기동 Shell Script를 생성해 보도록 하겠습니다.

[root@kubemaster jenkins]# ls -la 
total 30776 
drwxr-xr-x.  3 root root       53 Sep 21 15:58 . 
dr-xr-x---. 10 root root      275 Sep 21 15:58 .. 
-rw-r--r--.  1 root root      212 Sep 21 15:58 jboot.sh 
-rw-r--r--.  1 root root 31506848 Sep 21 15:53 jenkins.war 
drwxr-xr-x.  2 root root        6 Sep 21 15:58 logs 
[root@kubemaster jenkins]# cat jboot.sh  
#!/bin/bash 
export JAVA_HOME=/home/jenkins/java-1.8.0 
export HTTP_PORT=8080 

nohup $JAVA_HOME/bin/java -jar jenkins.war --httpPort=$HTTP_PORT --sessionTimeout=120 -XX:+AggressiveOpts >> ./logs/jenkins.log 2>&1 & 
[root@kubemaster jenkins]#

위와 같이 jenkins.war 파일과 logs 디렉토리 그리고 jboot.sh을 생성합니다.

Shell Script에는 Jenkins를 기동할 때 사용할 JAVA_HOME과 Jenkins 기동을 위한 HTTP_PORT 그리고 Jenkins 로그인 Timeout 및 로그 경로 등을 지정하는 옵션을 포함하고 있습니다.

 

2) Jenkins 기동 및 구성

다음으로 Jenkins를 기동해 보도록 하겠습니다.

[root@kubemaster jenkins]# sh jboot.sh 
[root@kubemaster jenkins]# tail -f logs/jenkins.log
Running from: /root/jenkins/jenkins.war
webroot: $user.home/.jenkins
2019-09-21 07:46:09.840+0000 [id=1]     INFO    org.eclipse.jetty.util.log.Log#initialized: Logging initialized @482ms to org.eclipse.jetty.util.log.JavaUtilLog
2019-09-21 07:46:09.944+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file
2019-09-21 07:46:10.854+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2019-09-21 07:46:10.896+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-9.4.z-SNAPSHOT; built: 2019-05-02T00:04:53.875Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_222-b10
2019-09-21 07:46:11.189+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2019-09-21 07:46:11.237+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2019-09-21 07:46:11.238+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2019-09-21 07:46:11.239+0000 [id=1]     INFO    o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 660000ms
Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
2019-09-21 07:46:11.651+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@5ae76500{Jenkins v2.195,/,file:///root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}
2019-09-21 07:46:11.690+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@7fd50002{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2019-09-21 07:46:11.691+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started @2333ms
2019-09-21 07:46:11.699+0000 [id=20]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine v4.0 running: controlPort=disabled
2019-09-21 07:46:13.570+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2019-09-21 07:46:13.604+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2019-09-21 07:46:14.801+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2019-09-21 07:46:14.806+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2019-09-21 07:46:14.839+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2019-09-21 07:46:15.763+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2019-09-21 07:46:15.898+0000 [id=41]    INFO    hudson.model.AsyncPeriodicWork$1#run: Started Download metadata
2019-09-21 07:46:15.928+0000 [id=41]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2019-09-21 07:46:16.726+0000 [id=26]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@5e014a2a: display name [Root WebApplicationContext]; startup date [Sat Sep 21 16:46:16 KST 2019]; root of context hierarchy
2019-09-21 07:46:16.726+0000 [id=26]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@5e014a2a]: org.springframework.beans.factory.support.DefaultListableBeanFactory@5255f082
2019-09-21 07:46:16.735+0000 [id=26]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5255f082: defining beans [authenticationManager]; root of factory hierarchy
2019-09-21 07:46:16.920+0000 [id=26]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@3006b098: display name [Root WebApplicationContext]; startup date [Sat Sep 21 16:46:16 KST 2019]; root of context hierarchy
2019-09-21 07:46:16.920+0000 [id=26]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@3006b098]: org.springframework.beans.factory.support.DefaultListableBeanFactory@19b521a0
2019-09-21 07:46:16.921+0000 [id=26]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@19b521a0: defining beans [filter,legacy]; root of factory hierarchy
2019-09-21 07:46:17.167+0000 [id=26]    INFO    jenkins.install.SetupWizard#init: 

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

c571ede39450466a997402522bc1c130

This may also be found at: /root/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

2019-09-21 07:46:24.596+0000 [id=41]    INFO    hudson.model.UpdateSite#updateData: Obtained the latest update center data file for UpdateSource default
2019-09-21 07:46:24.780+0000 [id=26]    INFO    hudson.model.UpdateSite#updateData: Obtained the latest update center data file for UpdateSource default
2019-09-21 07:46:25.260+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2019-09-21 07:46:25.299+0000 [id=19]    INFO    hudson.WebAppMain$3#run: Jenkins is fully up and running
2019-09-21 07:46:25.430+0000 [id=41]    INFO    h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
2019-09-21 07:46:25.431+0000 [id=41]    INFO    hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1
2019-09-21 07:46:25.433+0000 [id=41]    INFO    hudson.model.AsyncPeriodicWork$1#run: Finished Download metadata. 9,531 ms

위와 같이 Shell Script를 통해 Jenkins를 기동할 수 있습니다. Jenkins의 기동 상태를 확인하기 위해 logs/jenkins.log 파일을 지속적으로 모니터링하는 것이 필요합니다.

728x90

3) Jenkins 설정 구성

먼저 Jenkins UI에 접속합니다. 접속 URL은 http://[Jenkins_Server_IP]:[Jenkins_Port] 로 접속하며, 최초 접속 시 다음과 같은 화면을 볼 수 있습니다.

화면에 표시된 해당 위치의 initialAdminPassword의 내용을 입력 후 Continue를 선택합니다.

[root@kubemaster jenkins]# cat /root/.jenkins/secrets/initialAdminPassword
c571ede39450466a997402522bc1c130
[root@kubemaster jenkins]#

다음 화면은 아래와 같이 Customize Jenkins 설정 화면입니다.

기본 Plug-In이 포함되어 있는 Install suggested plugins와 Plug-In을 선택해서 설치할 수 있는 Select plugins to install 중 선택할 수 있으며, Select plugins to install을 선택하여 진행하도록 하겠습니다.

아래와 같이 다양한 Plugins 중 원하는 Plugin을 체크하고 Install 버튼을 선택한다.

다음으로 선택이 완료된 Jenkins Plugin 설치가 진행됩니다.

Plugin 설치가 완료되면, Admin User를 생성하게 됩니다.

Create First Admin User 화면에서는 계정명, 암호, 이름, 이메일 주소를 입력하여 Super User를 생성하고 Save and Continue를 입력합니다.

다음으로 Jenkins Web UI에 접근하기 위한 Jenkins URL을 입력하고 Save and Finish를 선택합니다.

마지막으로 Start using Jenkins를 선택하면 Jenkins 메인 화면으로 접속하게 됩니다.

728x90

다음은 Jenkins의 메인 화면입니다.

위와 같이 로그인이 완료되면 설치 및 구성이 완료됩니다.

다음 시간에는 Jenkins를 활용한 WildFly에 배포 자동 환경을 구성해 보도록 하겠습니다.

728x90
그리드형
댓글
댓글쓰기 폼
250x250
Total
1,301,002
Today
50
Yesterday
1,934
«   2021/12   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
글 보관함