Skip to content

Commit c144572

Browse files
committed
Added CJOC Lesson
1 parent d6bd39f commit c144572

9 files changed

+314
-4
lines changed

_includes/footer.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,19 @@ <h4 class="h h--3 tci">Do you enjoy our videos?</h4>
3434
<li class="list-item"><a href="http://devblackops.io/" class="footer-list-link list-item-link">DevBlackOps.io</a></li>
3535
<li class="list-item"><a href="https://devopscollective.org/" class="footer-list-link list-item-link">DevOpsCollective.org</a></li>
3636
<li class="list-item"><a href="http://duffney.io/#blog" class="footer-list-link list-item-link">Duffney.io</a></li>
37+
<li class="list-item"><a href="http://flynnbundy.com" class="footer-list-link list-item-link">FlynnBundy.com</a></li>
3738
</ul>
3839
</div>
3940
<div class="g-b g-b--m--1of2 g-b--xl--1of3">
4041
<ul class="footer-list list mbs mbm--xl">
4142
<li class="list-item"><span class="footer-list-link link link--underline list-item-link">Continued</span></li>
42-
<li class="list-item"><a href="http://flynnbundy.com" class="footer-list-link list-item-link">FlynnBundy.com</a></li>
4343
<li class="list-item"><a href="https://gaelcolas.com/" class="footer-list-link list-item-link">GaelColas.com</a></li>
4444
<li class="list-item"><a href="http://www.greenreedtech.com/" class="footer-list-link list-item-link">GreenReedTech.com</a></li>
4545
<li class="list-item"><a href="https://hodgkins.io/#blog" class="footer-list-link list-item-link">Hodgkins.io</a></li>
4646
<li class="list-item"><a href="http://www.hurryupandwait.io/" class="footer-list-link list-item-link">HurryUpAndWait.io</a></li>
4747
<li class="list-item"><a href="http://pshdo.com" class="footer-list-link list-item-link">Pshdo.com</a></li>
4848
<li class="list-item"><a href="http://stevenmurawski.com" class="footer-list-link list-item-link">StevenMurawski.com</a></li>
49+
<li class="list-item"><a href="http://hindenes.com/trondsworking/" class="footer-list-link list-item-link">Hindenes.com/trondsworking</a></li>
4950
<li class="list-item"><a href="https://xainey.github.io/#blog" class="footer-list-link list-item-link">Xainey.github.io</a></li>
5051
</ul>
5152
</div>

_posts/2015-10-13-Jenkins & GitHub + Powershell Params.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2015-10-13 12:00:00 -0500
55
categories: Jenkins
66
permalink: lessons/jenkins-github-powershell-params
77
excerpt: "In this lesson, we're going to integrate Jenkins and Github for version control. We'll start off with a Jenkins master running on Ubuntu, with a Server"
8-
weight: 11
8+
weight: 14
99
difficulty: medium
1010

1111
---

_posts/2015-10-13-Jenkins for Operations.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: 2015-10-13 12:00:00 -0500
55
categories: Jenkins
66
permalink: lessons/jenkins-for-operations
77
excerpt: "If you haven't heard of Jenkins, it's something that your developer friends have probably been using for several years, but it can help tremendously"
8-
weight: 12
8+
weight: 13
99
difficulty: easy
1010

1111
---
Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
---
2+
layout: post
3+
title: "CCJPE: Jenkins Operations Center"
4+
date: 2016-9-5 12:00:00 -0500
5+
categories: Jenkins
6+
permalink: lessons/jenkins-cjoc
7+
excerpt: "Learn how to manage multiple masters from CJOC!"
8+
weight: 12
9+
image: 'jenkinscourse.png'
10+
difficulty: hard
11+
12+
---
13+
{% include youtube.html id="mxo_EDkyzlg" %}
14+
{% include hired.html %}
15+
16+
1. Table of Contents
17+
{:title="Table of Contents"}
18+
{:toc}
19+
20+
Introduction
21+
------------
22+
Welcome to the DevOps Library! This is Samantha, and today we're going to set
23+
up Cloudbees Jenkins Operations Center, or CJOC for short. If you've never
24+
heard of it, the CJOC is used for managing multiple Jenkins Masters. It makes
25+
it much easier to scale Jenkins horizontally, as it makes it possible to share
26+
build nodes between masters. You can also enforce security compliance, manage
27+
update centers, setup single sign on, and monitor the everything all from the
28+
CJOC. Sounds pretty cool huh? It is, trust us!
29+
30+
Before we begin, we'd like to give a quick shout out to
31+
[Hired.com](http://www.hired.com/devopslibrary) for being kind enough to sponsor
32+
our Jenkins course. If you aren’t familiar with Hired, it’s a great company that
33+
completely reverses the traditional job search, by having companies apply to
34+
you, instead of you always doing the tedious work of applying.
35+
36+
Thousands of companies look to Hired to connect with the best of the best in our
37+
field, like you! OH. And if you do end up signing up through our [personal link](http://www.hired.com/devopslibrary), and landing a new job, Hired will give you a 2k bonus for being a loyal
38+
supporter of the DevOps Library!
39+
40+
Terminology
41+
-----------
42+
Alright, let's go ahead and get started! First, let's talk about some new
43+
Jenkins terminology related to Operations Center. You'll typically have at
44+
least one "Operations Center Server", ideally in HA mode. This server is a
45+
special type of Jenkins instance that acts as a central authority over your
46+
entire Jenkins environment. It's also what we'll be setting up in a few
47+
minutes.
48+
49+
Next, we have "client masters". A client master is just a normal Jenkins master
50+
that we've joined to our Operations center cluster for management purposes.
51+
These masters can then use normal slaves, shared slaves, or a shared cloud.
52+
53+
Shared slaves are exactly what they sound like, slave nodes that are available
54+
for any master to use.
55+
56+
A "shared cloud" is used to spin up temporary slaves
57+
when demand exceeds what's available from the shared slaves.
58+
59+
Next, we have "folders", which behave a bit differently than the folder's you
60+
would normally associate with Jenkins. When it comes to Operations center,
61+
folders are used for scoping the availability of resources. For example, you
62+
could have a folder with credentials, shared slaves, and a shared cloud. Each
63+
of those items would then only be available to other items within the same
64+
folder or same subfolder.
65+
66+
Lastly, we have "Sub-licensing". Normally you have to worry about keeping each
67+
master licensed, but with CJOC, it includes the ability to generate sub-licenses
68+
for all client masters within the CJOC cluster.
69+
70+
Setting up CJOC
71+
---------------
72+
Alright, that's enough terminology for now. Let's go ahead and create our
73+
Operations Center Server! First, we'll start out with a fresh Ubuntu 14.04
74+
server. If you'd like to cheat a bit, you can use our cloud config file HERE,
75+
which configures everything for you automatically.
76+
77+
If you'd like to do it by hand, the first thing that we need to do is to add all
78+
of the keys and repositories for installing Jenkins & Java. Just copy and paste
79+
the following lines, then run an apt-get update.
80+
81+
Once that finishes, let's install Java by running:
82+
83+
apt-get install oracle-java8-installer -y
84+
After Java finishes installing, we're now finally ready to install Jenkins
85+
Operations center. To do so, run:
86+
87+
apt-get install jenkins-oc
88+
89+
Configuration
90+
-------------
91+
Nice job!! That's all that we needed to do to setup CJOC. Now let's open up a
92+
web browser and go to the IP address of the VM, on port 8888. You will need to
93+
sign up for a trial license if you don' have an enterprise license yet.
94+
95+
After licensing the server, we need to configure the Jenkins URL before doing
96+
anything else. Go to "Manage Jenkins", followed by "Configure System". You
97+
should see a line titled "Jenkins URL" near the bottom of the page. If you've
98+
set up a DNS name for the CJOC server, you can use that here, otherwise just
99+
leave it as is and click save.
100+
101+
Client Masters
102+
--------------
103+
Alright, we're finally ready to add some client masters. If you already have
104+
some masters available feel free to use them, otherwise you can use our two
105+
cloud config files below to spin up some new ones.
106+
107+
After the masters come up, we need to add them to Operations center. On the
108+
JCOC web interface, select "New Item". Then type in a name for the master, and
109+
select "Client Master" for the item type. On the configuration page, we'll
110+
stick with the defaults. Before we move on though, let's talk about what a few
111+
of the settings are used for.
112+
113+
The "On-master executors" setting is used to force a set number of executors.
114+
From a security and performance perspective, we highly recommend checking the
115+
"Enforce" box and setting this to zero, as every job should be running on
116+
slaves, not masters.
117+
118+
Another useful setting is the "Master Owner" configuration. This lets you
119+
specify an email address or a list of addresses that are notified anytime the
120+
master goes offline.
121+
122+
The licensing section is helpful is well, as you can have operations center take
123+
care of the licensing on your masters, as well as telling them to use a specific
124+
Jenkins update center, which works sort of the same way that a WSUS server works
125+
on Windows. Alright, go ahead and click save.
126+
127+
On the next page, type in the URL of the Jenkins master, then click "Push
128+
configuration". Within a minute or so, you'll be redirected to the master
129+
you're trying to add. Now click "Join Operations Center" to complete the
130+
process.
131+
132+
Perfect!! Go ahead and go through the same steps to add the other one. Once
133+
you're finished, the CJOC should look something like this. Great job! At this
134+
point, it's really up to you on how you configure it, but we'll run through some
135+
of the most commonly used features.
136+
137+
Shared Configurations
138+
---------------------
139+
First, let's talk about "Shared Configurations". You know how on each master,
140+
there's a "Configure System" section with a ton of settings? A "Shared
141+
Configuration" is used to configure those settings once, and share them across
142+
your masters.
143+
144+
Let's try it out. We'll set up a shared configuration that ensures the latest
145+
version of Java is installed on all of our masters. Click "New Item", type in a
146+
name, then select "Miscellaneous Configuration Container". On the next page,
147+
click "Add Snippet". We'll go with "Tools Installation", followed by
148+
"Add Tool". Select JDK, give it a name, and select which version you'd like to
149+
use. Once you have the settings that you'd like, hit "Save".
150+
151+
At this point, every one of our masters will now ensure that the latest JDK is
152+
installed, pretty cool huh? If for some odd reason you have a master that
153+
should NOT share configurations, you can always opt out on its individual system
154+
config page.
155+
156+
Shared Slaves
157+
-------------
158+
Alright, next we have "Shared Slaves". Don’t worry, they’re super easy to
159+
setup, and if you’ve already set up a slave before feel free to skip ahead.
160+
Basically we just follow the same steps that we'd normally do to set up a slave,
161+
but do it from the CJOC.
162+
163+
Just like everything else so far, the first step is to go to “New Item”. Next,
164+
name the agent, and select “Shared Slave” as the item type. Alright, now that
165+
we’re on the configuration page, a lot of these settings are environment
166+
specific. We tend to use one executor per core, but it’s really up to you.
167+
168+
For the FS root, make you’ve already created the directory on your slave server.
169+
If you use our slave.yaml cloud configuration, be sure to specify /Jenkins as
170+
that’s the directory we typically use.
171+
172+
After you’ve added a host and credentials, click “Save”. Great job!!! We now
173+
have a slave that any of our masters can use. We do have a bit more to cover,
174+
but if you’d like to take a break to try it out go ahead!
175+
176+
Cluster Operations
177+
------------------
178+
Ok, we’re almost finished, but we have two more features we’d like to cover,
179+
Cluster Operations and the Update Center Plugin.
180+
181+
A “Cluster Operation” is a new item type that lets you perform maintenance on a
182+
variety of items, including client masters and update centers. They’re not
183+
nearly as complicated as they sound, but they are pretty powerful! Let’s try
184+
setting one up for restarting all of our masters. Click “New Item”, name it
185+
“Restart All Masters” and select “Cluster Operations” as the item type.
186+
187+
Alright, there are three important parts of an “Operation”. The first is the
188+
type of operation, which can be either “Client Master” or “Update Center”.
189+
Because the operation we’re setting up affects masters, select “Client Master”.
190+
191+
Secondly, we need to choose how to target the masters. We’ll select “From
192+
Operations Center Root”, that way it selects all of them. You can optionally
193+
specify a filter if you’d like to get a bit more granular than the list of
194+
target sources.
195+
196+
Third, we need to specify what steps the operation should actually take. For
197+
this operation, select “Restart Now”, then save the operation.
198+
199+
Great job!! You’ve successfully set up a cluster operation. If you’d like,
200+
you can run it now and both of our masters will be restarted immediately.
201+
202+
Pretty cool huh?
203+
204+
Update Centers
205+
--------------
206+
Well, we’re finally almost finished, we have one final topic to cover, Update
207+
Centers! An Update center is created the same way everything else was created,
208+
just go to New Item, name the Update center, and select “Update Center” as the
209+
job type. You’ll then need to select a plugin versioning strategy, signature
210+
provider, upstream source, and any maintenance tasks that you’d like.
211+
212+
The plugin versioning strategy can be set to explicit or implicit publishing.
213+
Explicit means that the update center won’t publish any versions of a plugin
214+
until the administrator specifically chooses a version, while implicit defaults
215+
to publishing the latest version of each plugin.
216+
217+
You can usually just leave the signature provider as is. For the upstream
218+
source we recommend selecting “Jenkins Enterprise by Cloudbees”, unless there’s
219+
a specific reason to include experimental plugins. Go ahead and hit save.
220+
221+
That’s it for the update center, but do note, you will have to configure the
222+
masters to point to the update center. Once that’s complete you’ll never have
223+
to worry about someone installing a plugin that hasn’t already been approved.
224+
You can do it manually, or by using the update center installer plugin.
225+
226+
Conclusion
227+
----------
228+
Well, that was a pretty long lesson! We covered a ton of material, great job
229+
following along! We set up a Jenkins Operations Center, two masters, a shared
230+
slave, a cluster operation, and an update center, all in a single lesson!
231+
232+
Thank you so much for watching!
233+
234+
We'd like to give another shout out to Hired for sponsoring this course. If
235+
you're into DevOps, there's a pretty good chance you've had to deal with pushy
236+
recruiters and countless emails, as well as spent many hours searching for
237+
DevOps opportunities.
238+
239+
The reason we love using Hired is that it completely reverses this situation
240+
and puts the power back in your hands, by having companies send you interview
241+
requests that you can choose to pursue.
242+
243+
(They even come with upfront salary and equity!)
244+
245+
By having you fill out information that is specific to what you’re looking for
246+
and your individual strengths and talents, it ensures that the only companies
247+
you'll hear from will be a great fit for you. Plus, Hired is entirely free,
248+
and they’ll even give you a $2,000 bonus after you land a job, using our DevOps
249+
Library link!
250+
251+
We highly recommend giving them a shot, they do a fantastic job, especially
252+
for the DevOps community.
253+
254+
Thanks for Watching!
255+
--------------------
256+
[Subscribe to our YouTube channel](https://www.youtube.com/channel/UCOnioSzUZS-ZqsRnf38V2nA?sub_confirmation=1) or follow [DevOpsLibrary on Twitter](https://twitter.com/intent/user?screen_name=devopslibrary).
257+
258+
{% include subscribe.html %}

css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ textarea {
787787

788788
@media screen and (min-width: 68.75em) {
789789
.footer {
790-
height: 21.5625em;
790+
height: 24em;
791791
}
792792
}
793793

scripts/cjoc.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#cloud-config
2+
hostname: cjoc
3+
fqdn: cjoc.devopslibrary.com
4+
manage_etc_hosts: true
5+
runcmd:
6+
- add-apt-repository ppa:webupd8team/java -y
7+
- echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
8+
- echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
9+
- wget -q -O - http://downloads.cloudbees.com/cjoc/latest/debian/cloudbees.com.key | sudo apt-key add -
10+
- echo deb http://downloads.cloudbees.com/cjoc/latest/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins-oc.list
11+
- apt-get update
12+
- apt-get install oracle-java8-installer -y
13+
- apt-get install jenkins-oc -y

scripts/master01.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#cloud-config
2+
hostname: master01
3+
fqdn: master01
4+
manage_etc_hosts: true
5+
runcmd:
6+
- add-apt-repository ppa:webupd8team/java -y
7+
- echo 'deb http://nectar-downloads.cloudbees.com/nectar/debian binary/' >> /etc/apt/sources.list
8+
- echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
9+
- echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
10+
- wget -q -O - http://nectar-downloads.cloudbees.com/nectar/debian/cloudbees.com.key | sudo apt-key add -
11+
- apt-get update
12+
- apt-get install oracle-java8-installer nfs-common -y
13+
- apt-get install jenkins -y

scripts/master02.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#cloud-config
2+
hostname: master02
3+
fqdn: master02
4+
manage_etc_hosts: true
5+
runcmd:
6+
- add-apt-repository ppa:webupd8team/java -y
7+
- echo 'deb http://nectar-downloads.cloudbees.com/nectar/debian binary/' >> /etc/apt/sources.list
8+
- echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
9+
- echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
10+
- wget -q -O - http://nectar-downloads.cloudbees.com/nectar/debian/cloudbees.com.key | sudo apt-key add -
11+
- apt-get update
12+
- apt-get install oracle-java8-installer nfs-common -y
13+
- apt-get install jenkins -y

scripts/slave01.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#cloud-config
2+
hostname: slave01
3+
fqdn: slave01
4+
manage_etc_hosts: true
5+
runcmd:
6+
- add-apt-repository ppa:webupd8team/java -y
7+
- echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
8+
- echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
9+
- apt-get update
10+
- apt-get install oracle-java8-installer nfs-common -y
11+
- mkdir /jenkins
12+
- chown ubuntu /jenkins/

0 commit comments

Comments
 (0)