Tales of
Training: Scaling
CodeLabs with
Swarm Mode
and Compose
Damien DUPORTAL
Training Engineer - CloudBees
@DamienDuportal - github.com/dduportal
Agenda
What is this talk about?
● Trench Story
● Drinking champagne
● Training / CodeLabs
● VM workload
● Container workload
● Orchestration
What is this talk NOT about?
● Toolings wars:
○ Kubernetes vs. Swarm
○ AWS vs. Azure
● Showing code (20 min only!)
○ Help yourself (GitHub):
http://bit.ly/2yoYG0v
Drinking my own champagne
Learn by TRYING:
● Experimentation never wastes
time
● Build something that works
and iterate
“CodeLab”?
● Part of a training (learning experience)
● Practical Exercise
● Using an isolated environment
● Dedicated to a single user
● Synonym of “workshop” or
“hands on lab”
CodeLab == Production
Constraints:
● Network
● Configuration diversity
● User Error (Learning process)
● Time boxed Sessions
CodeLab VM Content:
● Jenkins Training:
○ Store Git SCM (Gitea - Go)
○ Jenkins Master + Build Agents (JVMs)
○ Web Command Line (TTYDs - Python)
○ WebIDE (Codiad - PHP)
○ Store Artifacts (Artifactory - JVM)
○ Docker Registry (Go)
Challenges
● CodeLab defined by service list
○ Docker-compose
● Portability
○ Docker as blueprint
● Explicit definition
○ Definition as code
Step 1: VMs
Consul Servers
AWS EC2 VM
Host OS: Ubuntu
Docker & Compose
CodeLab Service Stack
Consul
AWS EC2 VM
Host OS: Ubuntu
Docker & Compose
CodeLab Service Stack
Consul
AWS EC2 VM
Host OS: Ubuntu
Docker & Compose
CodeLab Service Stack
Consul
AWS EC2 VM
Host OS: Ubuntu
Docker & Compose
CodeLab Service Stack
Consul
AWS EC2 VM
Host OS: Ubuntu
Docker & Compose
CodeLab Service Stack
Consul
AWS EC2 VM
Host OS: Ubuntu
Docker & Compose
CodeLab Service Stack
Consul
SSH Bastion
Reverse Proxies
Register into
Consul
End User
Trainer
Deploys with
Terraform
Load-Balancer
Reconfigure with
Consul-Template
Step 1: Take Aways
It works!
Easy to begin with and to operate
Cost (1 attendee per VM)
TTP (Time To Play)
Road to Native Orchestration
● Solving Costs Issue: More attendees per VM
● Solving TTP Issue:
○ Moving to container-based workload
(Look at PWD speed!)
○ Un-tie Infra from Services
Step 2.1: Provide Infra
SSH Bastion“Infra
Admin”
Deploys with
Terraform
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Manager (EC2 VM)
Swarm Manager (EC2 VM)
Swarm Manager (EC2 VM)
Step 2.2: Provide Services
SSH Bastion“Infra
Admin”
Deploys with
Docker
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Manager (EC2 VM)
Swarm Manager (EC2 VM)
Swarm Manager (EC2 VM)
Deploys with
Docker
Trainer
CodeLab Service Stack
Support Services
Support Services
Step 2.3: Benefits
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Worker (EC2 VM)
Swarm Manager (EC2 VM)
Swarm Manager (EC2 VM)
Swarm Manager (EC2 VM)
CodeLab Service Stack
Support Services
Support Services
End User
Step 2: Positive Side Effect
● Relying on Docker ecosystem
● Less side-kicks to maintain
Step 2: Nice problems to have
● CodeLab Scaling Pattern
○ (Deploy N times, NOT Scaling)
● Monitoring / Metrics
● Resource Management
CodeLab Scaling Pattern
● Compose and Swarm:
○ Define a stack of services
○ Scale each horizontally
● Concern here:
○ Deploy N times the same stack
Monitoring/Metrics
It is NOT a challenge
● Should have done it at Step 1
● Feedback loop
● A LOT of “Working Out
of the box” tools
Resource Management
● Resource sharing patterns:
○ VM workloads: 1 stack for 1 VM resources
○ Container workload: N stacks for
N VMs resources
● JVM pattern: Capping Memory (OOM)
● Need to measure and iterate
○ Automation
Step 2: Take Aways
● It still works!
● Easier to begin with and to operate
● Cost: 4x less (4 attendees per VM)
● TTP: ~10 s instead of ~10 min
● Maintaining: 5 tools instead of 8
Thank you and enjoy DockerCon!

Tales of Training: Scaling CodeLabs with Swarm Mode and Docker-Compose

  • 1.
    Tales of Training: Scaling CodeLabswith Swarm Mode and Compose Damien DUPORTAL Training Engineer - CloudBees @DamienDuportal - github.com/dduportal
  • 2.
    Agenda What is thistalk about? ● Trench Story ● Drinking champagne ● Training / CodeLabs ● VM workload ● Container workload ● Orchestration What is this talk NOT about? ● Toolings wars: ○ Kubernetes vs. Swarm ○ AWS vs. Azure ● Showing code (20 min only!) ○ Help yourself (GitHub): http://bit.ly/2yoYG0v
  • 3.
    Drinking my ownchampagne Learn by TRYING: ● Experimentation never wastes time ● Build something that works and iterate
  • 4.
    “CodeLab”? ● Part ofa training (learning experience) ● Practical Exercise ● Using an isolated environment ● Dedicated to a single user ● Synonym of “workshop” or “hands on lab”
  • 5.
    CodeLab == Production Constraints: ●Network ● Configuration diversity ● User Error (Learning process) ● Time boxed Sessions
  • 6.
    CodeLab VM Content: ●Jenkins Training: ○ Store Git SCM (Gitea - Go) ○ Jenkins Master + Build Agents (JVMs) ○ Web Command Line (TTYDs - Python) ○ WebIDE (Codiad - PHP) ○ Store Artifacts (Artifactory - JVM) ○ Docker Registry (Go)
  • 7.
    Challenges ● CodeLab definedby service list ○ Docker-compose ● Portability ○ Docker as blueprint ● Explicit definition ○ Definition as code
  • 8.
    Step 1: VMs ConsulServers AWS EC2 VM Host OS: Ubuntu Docker & Compose CodeLab Service Stack Consul AWS EC2 VM Host OS: Ubuntu Docker & Compose CodeLab Service Stack Consul AWS EC2 VM Host OS: Ubuntu Docker & Compose CodeLab Service Stack Consul AWS EC2 VM Host OS: Ubuntu Docker & Compose CodeLab Service Stack Consul AWS EC2 VM Host OS: Ubuntu Docker & Compose CodeLab Service Stack Consul AWS EC2 VM Host OS: Ubuntu Docker & Compose CodeLab Service Stack Consul SSH Bastion Reverse Proxies Register into Consul End User Trainer Deploys with Terraform Load-Balancer Reconfigure with Consul-Template
  • 9.
    Step 1: TakeAways It works! Easy to begin with and to operate Cost (1 attendee per VM) TTP (Time To Play)
  • 10.
    Road to NativeOrchestration ● Solving Costs Issue: More attendees per VM ● Solving TTP Issue: ○ Moving to container-based workload (Look at PWD speed!) ○ Un-tie Infra from Services
  • 11.
    Step 2.1: ProvideInfra SSH Bastion“Infra Admin” Deploys with Terraform Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Manager (EC2 VM) Swarm Manager (EC2 VM) Swarm Manager (EC2 VM)
  • 12.
    Step 2.2: ProvideServices SSH Bastion“Infra Admin” Deploys with Docker Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Manager (EC2 VM) Swarm Manager (EC2 VM) Swarm Manager (EC2 VM) Deploys with Docker Trainer CodeLab Service Stack Support Services Support Services
  • 13.
    Step 2.3: Benefits SwarmWorker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Worker (EC2 VM) Swarm Manager (EC2 VM) Swarm Manager (EC2 VM) Swarm Manager (EC2 VM) CodeLab Service Stack Support Services Support Services End User
  • 14.
    Step 2: PositiveSide Effect ● Relying on Docker ecosystem ● Less side-kicks to maintain
  • 15.
    Step 2: Niceproblems to have ● CodeLab Scaling Pattern ○ (Deploy N times, NOT Scaling) ● Monitoring / Metrics ● Resource Management
  • 16.
    CodeLab Scaling Pattern ●Compose and Swarm: ○ Define a stack of services ○ Scale each horizontally ● Concern here: ○ Deploy N times the same stack
  • 17.
    Monitoring/Metrics It is NOTa challenge ● Should have done it at Step 1 ● Feedback loop ● A LOT of “Working Out of the box” tools
  • 18.
    Resource Management ● Resourcesharing patterns: ○ VM workloads: 1 stack for 1 VM resources ○ Container workload: N stacks for N VMs resources ● JVM pattern: Capping Memory (OOM) ● Need to measure and iterate ○ Automation
  • 19.
    Step 2: TakeAways ● It still works! ● Easier to begin with and to operate ● Cost: 4x less (4 attendees per VM) ● TTP: ~10 s instead of ~10 min ● Maintaining: 5 tools instead of 8
  • 20.
    Thank you andenjoy DockerCon!