Buildbot is a continuous integration tool based on Python which automates the build, test and release software cycles. It is built using the Twisted networking engine, supports parallel execution of jobs across multiple platforms and it is compatible with all major operating systems. The Buildbot installation can have one or more masters and number of workers. In this tutorial, we will show you how to install Buildbot master and worker on a CentOS VPS.
Table of Contents
1. Update the System
Before continuing with the tutorial, make sure all the system packages are up to date:
sudo yum update
2. Installing Buildbot
Installing Buildbot with pip is pretty straight forward process. First you need to install pip and python development packages using the yum package manager:
sudo yum install python-pip python-devel
Check out the tutorial on how to install pip on CentOS 7.
Execute the following command to upgrade the pip to the latest version:
sudo pip install --upgrade pip
The output should look something like this:
Collecting pip Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB) 100% |████████████████████████████████| 1.3MB 165kB/s Installing collected packages: pip Found existing installation: pip 8.1.2 Uninstalling pip-8.1.2: Successfully uninstalled pip-8.1.2 Successfully installed pip-10.0.1
Once the pip is installed and updated to the latest version we can proceed with the Buildbot installation. Execute the following command to install Buildbot with pip:
sudo pip install 'buildbot[bundle]'
If the installation is successfully completed you should see something like this:
Installing collected packages: Twisted, PyJWT, future, buildbot-www, buildbot-worker, buildbot-console-view, buildbot-waterfall-view, buildbot-grid-view, buildbot Running setup.py install for Twisted ... done Running setup.py install for future ... done Successfully installed PyJWT-1.6.1 Twisted-18.4.0 buildbot-1.1.1 buildbot-console-view-1.1.1 buildbot-grid-view-1.1.1 buildbot-waterfall-view-1.1.1 buildbot-worker-1.1.1 buildbot-www-1.1.1 future-0.16.0
4. Verify the Buildbot installation
To verify if Buildbot has been correctly installed type:
sudo buildbot --version
Buildbot version: 1.1.1 Twisted version: 18.4.0
5. Create a new system user for Buildbot
We will create a new system user and group which will run our Buildbot services:
sudo adduser --home /opt/buildbot --shell /bin/bash buildbot
6. Configuring the Buildbot Master
Now that we have Buildbot installed we can continue and create and configure our first Buildbot master.
Before continue with the next commands switch to the new buildbot user by typing:
sudo su - buildbot
To create the Buildbot master run the following command:
buildbot create-master master
The output should look something like this:
mkdir /opt/buildbot/master creating /opt/buildbot/master/master.cfg.sample creating database (sqlite:///state.sqlite) buildmaster configured in /opt/buildbot/master
Copy the default sample Buildbot configuration file by using the following command:
cp master/master.cfg.sample master/master.cfg
If you want to be able to access the Buildbot’s web interface on your server IP address or domain you need to change the BuildbotURL setting in the configuration file.
Open the configuration file:
nano master/master.cfg c['buildbotURL'] = "http://your_ip_or_domain:8010/"
Do not forget to replace your_ip_or_domain with your actual domain or IP address.
Once you save the file run the following command to verify the master configuration:
buildbot checkconfig master
If everything is ok you should see the following output:
Config file is good!
To start the Buildbot master run the following command:
buildbot start master
If there are no errors you should see the following output:
Following twistd.log until startup finished.. The buildmaster appears to have (re)started correctly.
Once the Buildbot master is started you can access the web interface at:
http://yor_ip_or_domain:8010/
7. Configuring a Buildbot Worker
For sake of simplicity we will install and configure our first Buildbot worker on the same server as the master.
To create the Buildbot worker named ‘example-worker’ with password ‘pass’ on ‘localhost’, execute the following command:
buildbot-worker create-worker worker localhost example-worker pass
The output should look something like this:
mkdir /opt/buildbot/worker mkdir /opt/buildbot/worker/info Creating info/admin, you need to edit it appropriately. Creating info/host, you need to edit it appropriately. Not creating info/access_uri - add it if you wish Please edit the files in /opt/buildbot/worker/info appropriately. worker configured in /opt/buildbot/worker
If you want to use a different username (example-worker), and password (pass) you need to update the following line in the master/master.cfg
file:
# a Worker object, specifying a unique worker name and password. The same # worker name and password must be configured on the worker. c['workers'] = [worker.Worker("example-worker", "pass")]
Finally we can start the worker by typing:
buildbot-worker start worker
If there are no errors you should see the following output:
Following twistd.log until startup finished.. The buildbot-worker appears to have (re)started correctly.
8. Finalize the Buildbot installation via web browser
You can now navigate to http://yor_ip_or_domain:8010/ and start configuring your Buildbot instillation.
Of course you don’t have to install Buildbot on CentOS 7, if you use one of our managed CentOS VPS hosting services, in which case you can simply ask our expert Linux admins to install Buildbot for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to install Buildbot on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.