Thursday, June 25, 2015

Horizontal Scaling with CloudBees Jenkins Operation Center

This article was sponsored by CloudBees. Thank you for supporting the sponsors who make SitePoint possible!

Picture this: You start using Jenkins, probably with one machine. As both the number of projects and the size of the projects themselves start to grow, you start to add slaves. Slowly, your cluster of Jenkins servers grows, and you slowly start to lose your grip. What if your Jenkins master crashes? If you recognize this feeling or you want to avoid this, you definitely should read on.

In this article we’ll take a small peak at CloudBees Jenkins Operation Center (CJOC). CJOC, created by CloudBees, offers you a lot of additional functionality to take your Jenkins cluster to the next level. The key features for CJOC are:

  • Consolidated navigation experience across all the client masters.
  • Shared build slave resources that can be used by any client masters.
  • Control of authentication and authorization schemes used by client masters. This enables features such as: single sign-on and consolidated permission schemes.
  • Management of update centers used by client masters.
  • Consolidated management of Jenkins Enterprise licenses.
  • Management and enforcement of certain key security settings on client masters.

Within this article we’ll just use a small amount of the available features. We’ll be creating a client master and a shared slave. For this we will be using three separate servers. The first one will run CJOC, the second one will run Jenkins Enterprise and the third will be used as a shared slave. We will be explaining everything in the next couple of chapters.

Preparation

I’ll be using three virtual machines on my local computer. If you want to follow along, you might want to make sure your own computer is powerful enough. If you happen to have three spare servers somewhere, you can also try it directly on those servers.

The three servers will be managed through Vagrant. I created a multi-machine Vagrant file which will boot all three servers. If you’re not familiar with Vagrant yet, you might want to read this article.

Let’s start off with our Vagrant file. You can find the content here

Note: All three boxes are running CentOS 7. You can easily replace them with Ubuntu boxes if you prefer, but do note that all commands below are meant for CentOS.

The three servers which will be created when you run vagrant up. They all got a different IP:

  • 192.168.56.105: CloudBees Jenkins Operation Center (CJOC)
  • 192.168.56.106: Jenkins Enterprise - Client Master (master)
  • 192.168.56.107: Shared Slave (slave)

Installing CloudBees Jenkins Operation Center

We start by installing CJOC on our first server. CJOC is our main control hub to manage all Jenkins instances. We’ll be using it to create our client master and shared slave. After logging in to the first Vagrant machine by running vagrant ssh CJOC in your terminal, you can perform the following commands to install CJOC.

[code language="php"]
sudo rpm --import http://ift.tt/1fFTj2a
sudo wget -O /etc/yum.repos.d/jenkins-oc.repo http://ift.tt/1CwgT6D
sudo yum update
sudo yum install java jenkins-oc
sudo chkconfig jenkins-oc on
sudo service jenkins-oc start
[/code]

You will receive an ok message to indicate CJOC has been successfully installed and started.

Before we can actually start using CJOC, we’ll have to open the web service port to allow access as well as allow our other servers to access this server. We can do this by changing the firewall by running the following commands.

[code language="php"]
sudo firewall-cmd --zone=public --permanent --add-port=8888/tcp --permanent
sudo firewall-cmd --zone=public --permanent --add-rich-rule='rule family="ipv4" source address="192.168.56.105/32" accept'
sudo firewall-cmd --zone=public --permanent --add-rich-rule='rule family="ipv4" source address="192.168.56.106/31" accept'
sudo firewall-cmd --reload
[/code]

By now, you should be able to reach CJOC with the following URL: http://ift.tt/1CwgTmR. After entering the above URL, a registration form will show up. You can register for an evaluation license if you haven’t bought the product yet from CloudBees. Just fill in your details and press Next.

When you’ve registered yourself, I recommend you update all the plugins. CJOC requires some specific versions of plugins so we want to make sure we have these. Generally, it’s not recommended to update plugins when it’s not needed, as indicated in this article, 7 ways to improve Jenkins.

Note: Problems installing CJOC, or using a different server setup? Have a look at the official manual_ for troubleshooting._

Continue reading %Horizontal Scaling with CloudBees Jenkins Operation Center%


by Peter Nijssen via SitePoint

No comments:

Post a Comment