This demo sets up a complete Continuous Delivery environment running in Docker containers and uses OpenShift as the deployment environment. As the artifact moves forward in the delivery pipeline, new containers (gears) are created on OpenShift and the artifact gets deployed onto these containers which represent Dev, System Test, Performance Test and Pre-Production environments.
This demo uses Fig as a simple orchestration tool to create the Docker containers required for this demo. Docker is used for simplicity in this demo and is not essential to the delivery pipeline.
This demo uses the following components to create the delivery pipeline. Jenkins, Nexus and Sonar run in their own Docker containers while GitHub is used as an external Git-based source repository.
Jenkins
Description: continuous delivery orchestration engine
Address: http://DOCKER_HOST:8080/jenkins
Sonatype Nexus
Description: artifact repository for archiving release binaries
Address: http://DOCKER_HOST:8081/nexus
SonarQube
Description: static code analysis engine extracting various quality metrics from the code
Address: http://DOCKER_HOST:9000
Git
Description: source repository hosting the ticket-monster Java application
Address: https://github.com/jbossdemocentral/continuous-delivery-demo-app.git
Note: if running boot2docker on Mac OSX, DOCKER_HOST is the ip of boot2docker virtual machine.
The delivery pipeline in this demo is divided into five phases each containing a number of activities (jobs) that need to succeed in order to promote the artefact to the next phase. Each change in the application is a potential production release according to Continuous Delivery principles and can go in production if it successfully passes through all the phases in the pipeline.
- Build: compilation and unit test, integration tests and static code analysis
- Dev: release to Nexus, create release tag in Git, deploy to DEV server (on OpenShift) and running functional tests
- System Test: deploy to System Test server (on OpenShift) and running system tests
- Perf Test: deploy to Performance Test server (on OpenShift) and running performance tests
- Pre Production (Stage): deploy to Pre-Production server (on OpenShift)
-
Install Docker Compose
-
Clone Continuous Delivery demo git repo
git clone https://github.com/jbossdemocentral/continuous-delivery-demo.git cd continuous-delivery-demo
-
Start the containers
docker-compose up -d
This step will download the required Docker images from Docker registery and start Jenkins, Nexus and Sonar containers. Depending on your internet connection, it might take some minutes.
-
Browse to http://DOCKER_HOST:8080/jenkins and go to Manage Jenkins > Configure System. Scroll down to OpenShift section and enter your OpenShift configs. If using OpenShift Online, enter your username and password in the respective textboxes. If using OpenShift Enterprise, also enter the address to your broker. Click on "Check Login" to validate your username and password. If successfull, click on "Upload SSH Public Key" to upload the Jenkins SSH keys to OpenShift.
- Go to jobs list and start the ticket-monster-build job.
- Go to the Delivery Pipeline tab to see how the build progresses in the delivery pipeline.
Special thanks to my collegue Siamak Sadeghianfar, who wrote the OpenShift Jenkins plugin and who implemented most of this demo.