24
Scaling Your Jenkins Master with Docker London, UK 23-24 June

JUC Europe 2015: Scaling Your Jenkins Master with Docker

Embed Size (px)

Citation preview

Page 1: JUC Europe 2015: Scaling Your Jenkins Master with Docker

Scaling Your Jenkins Master with Docker

London, UK 23-24 June

Page 2: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

Contents

● WHO: Wyplay

● WHAT: Docker, Docker in Jenkins, Jenkins in Docker

● WHY: Situation Before, Issues

● HOW: Setup, Usage

● WHERE: Future

2

Page 3: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

Contents

● WHO: Wyplay

● WHAT: Docker, Docker in Jenkins, Jenkins in Docker

● WHY: Situation Before, Issues

● HOW: Setup, Usage

● WHERE: Future

3

Page 4: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHO am I

I Worked in Queueing Networks, Simulation, Smartcards, now TV Software for Operators

– Develop Set-top-box OS (Canal+, Proximus, SkyIt,..)

– 80% of Developers

4

Page 5: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

Contents

● WHO: Wyplay

● WHAT: Docker, Docker in Jenkins, Jenkins in Docker

● WHY: Situation Before, Issues

● HOW: Setup, Usage

● WHERE: Future

5

Page 6: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHAT: Docker

● Company (Docker Inc)

● Open Source (Apache license) platform for building, shipping, running distributed applications

● Technology: manage and run lightweight Linux containers

– Isolation

– Portability, Shipping

6

Page 7: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHAT: Docker in Jenkins7

● Docker Plugin

– Dynamically provisionslaves

– Run build

– Tear-down slave

● Slaves in the Cloud

Page 8: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHAT: Jenkins in Docker

● Official Jenkins LTSdocker image

– From Cloudbees, sponsorof DockerCon

– Open Source

https://github.com/jenkinsci/docker

– Easy to usedocker pull jenkins

docker run -p 8080:8080 jenkins

8

Page 9: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

Contents

● WHO: Wyplay

● WHAT: Docker, Docker in Jenkins, Jenkins in Docker

● WHY: Situation Before, Issues

● HOW: Setup, Usage

● WHERE: Future

9

Page 10: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHY: Situation Before10

● One Master

– 34 attached slaves

– 527 jobs

– 78 plugins

– admin users

● Fast-paced environment. No real control

Page 11: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHY: Issues11

● Performance

● Reliability

● Inability to upgrade

● Downtime

=> Projects spin-off masters

● Security

Page 12: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

Contents

● WHO: Wyplay

● WHAT: Docker, Docker in Jenkins, Jenkins in Docker

● WHY: Situation Before, Issues

● HOW: Setup, Usage

● WHERE: Future

12

Page 13: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

HOW: Setup for one master (1)

● Three possibilities for /var/jenkins_home

– inside the container:

docker run -p 8080:8080 jenkins

– mounted from a host directory:

docker run -v <host-path>:/var/jenkins_home jenkins

– mounted from a data volume container:

docker run -v /var/jenkins_home --name=data busybox true

docker run --volumes-from=data jenkins

13

Page 14: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

HOW: Setup for one master (2)

● Summary for one master:

– pull the official Jenkins image:

$ docker pull jenkins

– create the data volume and master containers:

$ docker run -v /var/jenkins_home --name=frog-data busybox true

– run the master container:

$ docker run -t -i -u root -p 8084:8080 -p 50004:50004 --volumes-from=frog-data --name=frog jenkins

14

Page 15: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

HOW: Setup n masters

● Launch an httpd dispatcher (e.g., Apache)

– 443 (https) → vhosts(name) → 808i

● Launch docker containers:

– the Data Volume containers, with names

– the Jenkins masters containers linked with --volumes-from and 808i / 5000i ports

– map each container port 8080 to host ports 8080+i

15

Page 16: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

HOW: Usage16

PressedJson

DRAFT

Apache

cert.crtprivat.key

frog-data

polka-data

frog

PressedJson

DRAFT

pressed.json

LIVE

PressedJson

DRAFT

PressedJson

DRAFT

polka

PressedJson

DRAFT

PressedJson

DRAFT

pressed.json

LIVE

PressedJson

DRAFT

PressedJson

DRAFT

Frog.confServerNamefrog-ci.comProxyPasslocalh:8084X-F-Port443

g6-data

tools-data

443

8084

8080

8080

808i

--volumes -from

--volumes -from

50004

Slaves

Page 17: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

HOW: Admin Usage (1)

● Install plugins (from /tmp/plugins)

$ docker run -t -i --rm --volumes-from=frog-data -v /tmp:/tmp ubuntu bashroot@1a210c0a1846:/# cd /var/jenkins_home/pluginsroot@1a210c0a1846:/# cp /tmp/plugins/* .root@1a210c0a1846:/# exit

● Similar technique for:

– full backup

– debug data (SCM Sync git repos, Plots csv, etc.)

17

Page 18: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

HOW: Admin Usage (2)

● Change image

– stop container, destroy, create a new one

$ docker stop frog$ docker rm frog$ docker run … --volumes-from=frog-data --name frog

$ docker logs -f frog

18

Page 19: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

HOW: Admin Usage (3)

● Three levels of backup

– Vmware: dump of entire docker server

– Docker: copy all Data Volume

– Jenkins: SCM Sync plugin

● Three levels of monitoring

– Vmware, Docker, Jenkins

● Security: Role Strategy plugin

19

Page 20: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

Contents

● WHO: Wyplay

● WHAT: Docker, Docker in Jenkins, Jenkins in Docker

● WHY: Situation Before, Issues

● HOW: Setup, Usage

● WHERE: Future

20

Page 21: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHERE: do we go from here?

● Orchestration

– manual setup ok for a few

– more => orchestration tool (e.g., Docker Compose)

21

Page 22: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHERE: do we go from here?22

● Docker vs Config/Automation tools (chef, puppet, ansible, saltstack)

Before: use ansible to setup hardware/VM, install packages, deploy code,run app.

After: use ansible to setup hardware/VM, install Docker, run containers.

use Dockerfiles to install packages, deploy code, run app.

Page 23: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

WHERE: do we go from here?

● Monitoring (docker level)

● Find a way to “Configure System” programmatically

– LDAP

– Plugins upgrades

– TCP port for slaves

– Markup formatter

– SCM Sync, Roles, IRC, etc.

23

Page 24: JUC Europe 2015: Scaling Your Jenkins Master with Docker

#jenkinsconf

Thank You@cmuller13 on twitter

24