Deployment Steps
-
Install OS (tested on CentOS 7.4 x86_64 kernel 3.10)
-
Install Docker (tested on Docker CE 17.09)
-
Install Docker-compose ( tested on docker-compose 1.17.1 )
-
Get source from github ( git clone https://github.com/AgasiAm/docker-jenkins )
-
Create user jenkins or just create directory /home/jenkins, and change dir to /home/jenkins
-
Get simple maven app from github ( git clone https://github.com/AgasiAm/simple-java-maven-app )
-
Change dir to docker-jenkins
-
Build containers using docker-compose ( docker-compose -p jenkins build )
-
Run containers using docker-compose ( docker-compose -p jenkins up -d jenkinsdata jenkinsmaster jenkinsnginx jenkinselasticsearch jenkinspython jenkinsrabbitmq and after docker-compose -p jenkins up -d jenkinssendmail (rabbitmq startup delay problem) )
-
Configure Jenkins http://yourserverip
-
Configure Jenkins Plugins
Configure system
MQ Notifier Plugin MQ URI - amqp://jenkins-rabbitmq user - guest password - guest (you can change it for security reason) Exchange Name - jenkins Routing Key - buildjenkins
Global Tool Configuration
Logstash Plugin Indexer type - ELASTICSEARCH Host name - http://jenkins-elasticsearch Port - 9200 Key - logstash/maven
-
Create new job -> Pipeline
-
Go to Pipeline tab
-
Configure job
Definition - Pipeline script from SCM SCM - GIT Repository URL - Point to local Repository cloned on step 6 (/home/jenkins/imple-java-maven-app)
-
chmod 777 /var/run/docker.sock
-
Run Pipeline job