Más contenido relacionado

Presentaciones para ti(20)

Similar a JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Docker – Johan Janssen(20)


Más de HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association(20)


JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Docker – Johan Janssen

  1. Johan Janssen, Info Support
  2. Continuous Delivery DockerDocker Jenkins build pipeline Questions
  3. Automate everything Software quality Continuous improvement Regular deployments Anyone can deploy
  4. DevOps End users
  5. Automate environment provisioning Automate application deployment
  6. Simple general commands No Domain Specific Language (DSL) Configuration with operating system commands Disk space efficiency Memory efficiency Speed Compatibility (run anywhere) Isolation
  7. Since March 2013 Soon: 1.0 production ready release Around 400 contributorsAround 400 contributors 1.2M+ container downloads
  8. Docker on Ubuntu 14.04 apt-get install run -i -t ubuntu:saucy /bin/bash
  9. FROM ubuntu:saucy # Add oracle java 7 repository RUN apt-get -y install software-properties-common RUN add-apt-repository ppa:webupd8team/java RUN apt-get update && apt-get -y upgradeRUN apt-get update && apt-get -y upgrade # Accept the Oracle Java license RUN echo "oracle-java7-installer shared/accepted-oracle-license- v1-1 boolean true" | debconf-set-selections # Install Oracle Java RUN apt-get -y install oracle-java7-installer ENV JAVA_HOME /usr/lib/jvm/java-7-oracle
  10. FROM GeneralBase RUN apt-get install -y wget unzip RUN wget RUN unzip -d /opt RUN rm EXPOSE 9000 EXPOSE 9092 CMD ["/opt/sonarqube-4.2/bin/linux-x86- 64/", "console", "/bin/bash"]
  11. Create ‘Dockerfile’ Build the containers:Build the containers: build -t GeneralBase . build -t Sonar . Start proces: run -p 9000:9000 –p 9092:9092 -d Sonar
  12. # ps –a CONTAINER ID: ecbecf77461b IMAGE: Sonar:latest COMMAND: /opt/sonarqube-4.2/bCOMMAND: /opt/sonarqube-4.2/b CREATED: 32 minutes ago STATUS: Up 32 minutes PORTS:>9000/tcp,>9092/tcp NAMES: sick_nobel
  13. Start / stop / restart [start / stop / restart] containerid Show processes running in container top containerid
  14. Create image from container commit commit containerid username/imagename push username/imagename
  15. GeneralBaseGeneralBaseGeneralBaseGeneralBase AppServerBaseAppServerBaseAppServerBaseAppServerBase JenkinsJenkinsJenkinsJenkins SonarSonarSonarSonar GitblitGitblitGitblitGitblit NexusNexusNexusNexus Environment DEnvironment DEnvironment DEnvironment D Environment TEnvironment TEnvironment TEnvironment T Environment AEnvironment AEnvironment AEnvironment A Environment PEnvironment PEnvironment PEnvironment P JenkinsDataContainerJenkinsDataContainerJenkinsDataContainerJenkinsDataContainer
  16. Dockerfile ENV JENKINS_HOME /var/JenkinsData Docker commandsDocker commands run -v /var/JenkinsData –name JenkinsDataContainer ubuntu:saucy true run -p 8080:8080 --volumes-from JenkinsDataContainer -d Jenkins
  17. # images --tree └─ 179.9 MB Tags: ubuntu:saucy └─253.6 MB └─741.8 MB Tags: GeneralBase:latest └─763.6 MB Tags: AppServerBase:latest└─763.6 MB Tags: AppServerBase:latest ├─763.6 MB Tags: EnvironmentP:latest ├─763.6 MB Tags: EnvironmentA:latest ├─763.6 MB Tags: EnvironmentT:latest └─763.6 MB Tags: EnvironmentD:latest └─865.6 MB Tags: Nexus:latest └─808.3 MB Tags: Gitblit:latest └─901.5 MB Tags: Sonar:latest └─805.4 MB Tags: Jenkins:latest
  18. Stop containers stop $( ps -a -q) Remove containersRemove containers rm $( ps -a -q) Remove images rmi $( images -q)
  19. real 4m11.729sreal 4m11.729s user 0m3.329s sys 0m10.054s
  20. Simple to use Really popular Used in many organizations Regular updatesRegular updates Big community creating plugins etc. Most developers already use it
  21. Continuous delivery Continuous deployment
  22. 1 2 5 3 4 5 6 7 8
  23. Execute job after several (parallel) jobs are finished. FirstJob ParallelJob1 ParallelJob2 LastJob
  24. Good looking join Complex workflow EtceteraEtcetera Advantage: Jenkins jobs are the basis and can be reused. Try to keep it simple!
  25. Build Flow Plugin oDomain Specific Language oFeatures like retry, parallel,oFeatures like retry, parallel, guard/rescue (similar to try/finally) Multijob Plugin Delivery Pipeline Plugin