Overview

Continuous Integration Platform Using Docker Containers: Jenkins, SonarQube, Nexus, GitLab

No Comments

In 2015, the concepts and advantages of Continuous Integration (CI) should be well known to most software developers. There are plenty of tools, books and blog articles that cover that topic. One of the first articles was written in 2006 by Martin Fowler, and covers good Practices of Continuous Integration. All of these best practices are still valid today and I will go through each practice later on in this article.

Every once in a while a customer comes up to us and asks us for some help to improve their existing CI infrastructure or to get them started with the concepts and right tools. At other times we give demo presentations, hold workshops or organize OpenSpaces. In all of these cases we typically need a Continuous Integration Platform that is ready to compile, test, deploy and run some piece of software.

For that reason I decided to setup a handful of Docker containers that are up and running with a single command, without having to install every single tool manually. Another nice advantage of using Docker containers is that you can easily try out new versions of the tools. All tools that I am using are Open Source and have commercial support if your company requires that.

Get me started right away

In case you can not wait and want to try out the CI tools right away, simply follow the next steps. You need to have Git and Docker installed on your computer:

  • Git (Distributed Version Control System)
  • Docker (Lightweight Container Virtualization)

After that, you can clone the GitHub repository and start all containers using docker-compose.

https://gist.github.com/marcelbirkner/f7afc704ddb3cdb58f96

If you are running Docker for the first time on your computer, it might take some time to download all images. While you are waiting, this might be a good time to read-up on some Docker basics 🙂 I suggest the article by Lukas Pustina – Lightweight Virtual Machines Made Simple with Docker

Once all Docker images have been downloaded, you will be able to access the tools locally on your machine. The IP depends on your local settings. Use docker-machine to figure out your Docker IP.

ToolLinkCredentials
Jenkinshttp://${docker-machine ip default}:18080/jenkins/no login required
SonarQubehttp://${docker-machine ip default}:19000/admin/admin
Nexushttp://${docker-machine ip default}:18081/nexusadmin/admin123
GitLabhttp://${docker-machine ip default}:10080/root/5iveL!fe
Selenium Gridhttp://${docker-machine ip default}:4444/grid/consoleno login required

Here is an overview of the tools. Each tool runs in a separate docker container.

Docker CI Tools

  • GitLab is used for storing the source code in Git repositories and is a great alternative to GitHub.com. GitLab uses a PostgreSQL database for storing user information and Redis for storing tasks. For more details on the Redis and PostgreSQL Docker containers have a look at GitLab architecture.
  • Jenkins is used for automating the software development process. The Jenkins Docker container contains several example Maven build jobs that run Unit tests, execute the static source code analysis and deploy the build artifacts to Nexus.
  • Nexus is a typical Maven Artifact Repository. The Maven build uses Nexus as a Proxy Repository for third party libs. After the build the packaged artifacts are deployed to the Nexus Release Repository.
  • SonarQube is the most widespread Source Code Quality Management Tool. As part of the CI build, Jenkins triggers a static source code analysis and the results are stored in SonarQube. It uses typical code analysis frameworks like FindBugs, Checkstyle, PMD and others.
  • The Selenium Grid is used for managing different browser types. The Docker CI stack contains a Docker container with Firefox installed and one with Chrome. Therefore you can run your UI tests against different browsers.

Comment

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