How to install Buildbot on Debian 9

How to install Buildbot on Debian 9

Spread the love

Buildbot is a continuous integration framework written in Python which automates the test, build and release software cycles. It is built using the Twisted networking engine, supports parallel execution of jobs across multiple platforms and runs on all major operating systems. The Buildbot installation can have one or more masters and multiple workers. In this tutorial, we will show you how to install Buildbot master and worker on Debian 9.

1. Update the System

Before continuing with the tutorial, make sure the package index is updated and all system packages are up to date:

sudo apt-get update
sudo apt-get upgrade

2. Installing Buildbot

Installing Buildbot with pip is pretty simple process. If you don’t have pip installed on your Debian server you can install pip and python development packages with the following command:

sudo apt-get install python-pip python-dev

To upgrade the pip to the latest version, execute the following command:

sudo pip install --upgrade pip

The output should look something like bellow:

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 82kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-10.0.1

Once pip is installed and updated to the latest version you can proceed with the Buildbot installation. Buildbot can be installed as any other pip package. Execute the following command to install Buildbot with pip:

sudo pip install 'buildbot[bundle]'

If the installation is successful the output should look something like bellow:

Successfully built future Twisted sqlalchemy zope.interface MarkupSafe Tempita
Installing collected packages: txaio, autobahn, future, PyJWT, attrs, Automat, constantly, idna, hyperlink, incremental, zope.interface, Twisted, sqlalchemy, python-dateutil, MarkupSafe, Jinja2, pbr, sqlparse, decorator, Tempita, sqlalchemy-migrate, buildbot-console-view, buildbot-grid-view, buildbot-waterfall-view, buildbot-www, buildbot-worker, buildbot
  Found existing installation: idna 2.2
    Uninstalling idna-2.2:
      Successfully uninstalled idna-2.2
Successfully installed Automat-0.6.0 Jinja2-2.10 MarkupSafe-1.0 PyJWT-1.6.1 Tempita-0.5.2 Twisted-18.4.0 attrs-18.1.0 autobahn-18.5.1 buildbot-1.1.2 buildbot-console-view-1.1.2 buildbot-grid-view-1.1.2 buildbot-waterfall-view-1.1.2 buildbot-worker-1.1.2 buildbot-www-1.1.2 constantly-15.1.0 decorator-4.3.0 future-0.16.0 hyperlink-18.0.0 idna-2.6 incremental-17.5.0 pbr-4.0.3 python-dateutil-2.7.3 sqlalchemy-1.2.7 sqlalchemy-migrate-0.11.0 sqlparse-0.2.4 txaio-2.10.0 zope.interface-4.5.0

4. Verify the Buildbot installation

To verify if Buildbot has been correctly installed issue the following command which will print the Buildbot version:

sudo buildbot --version
Buildbot version: 1.1.2
Twisted version: 18.4.0

5. Create a new system user for Buildbot

To create a new system user and group which will run our Buildbot services, type the following command:

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 executing the next commands make sure you switch to the new buildbot user by typing:

sudo su - buildbot

To create the Buildbot master type the following command:

buildbot create-master master

The output should look something like this:
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

To be able to access the Buildbot’s web interface on your server IP address or domain you will need to edit the Buildbot configuration file and change the BuildbotURL setting. 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 server IP address or your actual domain.

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 the server starts successfully 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://your_ip_or_domain:8010/

7. Configuring a Buildbot Worker

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 to start the worker type:

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 installation.

Of course you don’t have to install Buildbot on Debian 9, if you use one of our Linux Server Support 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 Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

One thought on “How to install Buildbot on Debian 9

  1. Thanks for sharing the descriptive information on python course. It’s really helpful to me since I’m taking python training. Keep doing the good work.

Leave a Reply

Your email address will not be published. Required fields are marked *