-
Notifications
You must be signed in to change notification settings - Fork 142
/
Jenkins-Running-Notes.txt
294 lines (161 loc) · 6.63 KB
/
Jenkins-Running-Notes.txt
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
=======================
Jenkins Workshop Agenda
=======================
What is Build & Deployment Process
Application Environments In Real-Time
Challenges in Manual Build & Deployments
What is CI CD & Why we need ?
Jenkins Introduction
Jenkins Setup
Jenkins Job Creation
Job Scheduling
Conclusion
========================
Build & Deployment Process
========================
Take latest source code from Git Hub
Compile project source code
Execute Unit Test cases
Perform Code Review using SonarQube
Package the application ( jar / war )
Upload Build Artifact in Nexus
Deploy the Application in Server
=======================
Application Environments:
======================
Environment : A platform which is used to run our application
DEV env : Developers will use to perform code integration testing
QA env : Testers will use to perform functional testing
UAT env : User acceptance testing ( client side team will perform application testing )
Pilot env : It is also called as Pre-Prod environment ( performance testing )
Prod env : Live environment. End users will access application running in PROD environment.
www.gmail.com ----> Production env url of the project
www.facebook.com ---> Production env url of the project
================================
Challenges in Manaul Build Process
================================
Every day we need to deploy latest code
Deploy code in multiple environments
Takes lot of time
Repeated Work
Error Prone
================
Project Teams
================
Devlopment Team : Responsible for project development ( Coding )
Testing Team : Responsible for project functionality testing ( verification & validation )
Operations Team : Responsible for Build & Deployment process
Dev + Ops ====> DevOps
Development + Operations =============> DevOps
DevOps is a process which is used to colloborate development team work & operations team work
Using DevOps process we can simply application Build & Deployment process
===========
Jenkins
===========
-> Jenkins is a free software
-> Jenkins developed using java langauge
-> Jenkins is used to automate build & deployment process
-> We can implement CI CD using jenkins
==============
What is CI CD ?
===============
CI : Continuous Integration
CD : Continuous Delivery / Continuous Deployment
-> CI CD is one of the trending approach in software development life cycle
-> CI CD is used to simplify and automate project deployment & delivery process
Continous Integration : When code changes happend it should be ready to test
Continuous Delivery : Keep it ready in repository for release
Continuous Deployment : Release / deploy the project to Production
Note: For Production deployment we need to take Client Approval.
===============
Part-1 : Summary
===============
1) What is Build & Deployment Process
2) Application Environments
3) Why we need several environments for our application
4) Challenges in Manual Build & Deployment process
5) What is Jenkins
6) What is CI CD
====================
Part-2
====================
================
Manual Deployment
================
Git Hub Repo URL : https://github.com/ashokitschool/maven-web-app.git
1) Downloaded code from git hub
2) Executed Maven Goal ( clean package ) ==> war file created
3) Uploaded war file into tomcat server (deployment)
4) Access application from tomcat dashboard
===================
Infrastructure Setup
====================
-> Create Linux VM using EC2 in AWS cloud and install tomcat server
-> Create Linux VM using EC2 in AWS cloud and install Jenkins server
-> Clone Git Hub Repository
===========================
Build & Deployment Process
===========================
Download project from git hub
package the project using maven
Maven will create war file
Deploy war file into tomcat (post build action)
Note: Above build & deployment process can be automated using Jenkins
Access application using URL in browser
============================
Jenkins Job Creation Process
=============================
1) Login into Jenkins
2) Configure Maven in Global Tool Configuration (Jenkins will download maven)
-> Manage Jenkins
-> Global tools Configurations
-> Add Maven
3) Install 'Deploy To Container' Plugin (To deploy war to tomcat server)
-> Manage Jenkins
-> Manage Plugins
-> Go to available tab
-> search for 'Deploy To Container' plugin
-> Click on install without re-start
Note: Git s/w will be available by default in Jenkins Gloabl Tools Configuration
4) Create Free Style Project
5) Enter Git Repo URL
6) Build Trigger (configure Maven which is added in Global Tools and Provide Maven Goals as clean package)
7) Add Tomcat Server in Post Build Action For deployment
8) Save the Job configuration
9) Run the Job
10) See Tomcat Dashboard (Application should display) and access the application
=================
Poll SCM
==================
-> Click on Job name
-> Click On Configure
-> Configure Poll SCM with cron expression as ( * * * * *)
-> Every minute it will check for code changes, if code changes available then jenkins job will run
============================
How to deploy web application ?
============================
-> To deploy a web application we need a server
-> We are using Apache Tomcat as webserver to run web applications
-> Web Application will be packaged as war file
-> WAR file we will keep in tomcat server webapps folder.
-> webapps folder is called as Deployment folder
===================================
How to deploy Spring Boot Application ?
===================================
-> Spring Boot application will execute from main ( ) method
-> Spring Boot Application can be deployed as jar file
-> We no need to configure external server to run / deploy spring boot application
-> Spring Boot having embedded server to run Spring Boot Application
========================================
Running Spring Boot Application In AWS Cloud
========================================
1) Create Linux Virtual Machine (Amazon Linux)
2) Connect Linux Virtual Machine using MobaXterm
3) Install Java software
$ sudo yum install java
4) Upload Spring Boot Jar file into Linux VM
5) Run Spring Boot Jar file using below command
$ java -jar <jar-file-name>
6) Enable 8080 port number in security group of our Linux Virtual Machine
7) Access our application in browser
URL : http://public-ip:8080/